1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-11-20 02:18:20 +01:00

fix top view

This commit is contained in:
Xuan Sang LE 2018-02-25 02:31:13 +01:00
parent 7c7caa7b6e
commit 16287ce58e
4 changed files with 22 additions and 5 deletions

View File

@ -10,7 +10,6 @@ view.html = function(name)
end
view.render = function(action, data, sort)
view.html("top")
local path = BLOG_ROOT.."/view"
local fn = nil
local e
@ -22,6 +21,7 @@ view.render = function(action, data, sort)
--fn = require("blog.view.compiledd")
else
--fn = require("blog.view.compiledd")
fn, e = loadscript(path.."/entries.ls")
end
if fn then
@ -30,6 +30,7 @@ view.render = function(action, data, sort)
echo(o)
end
else
loadscript(path.."/top.ls")("Welcome to my blog")
echo(e)
end
view.html("bot")

View File

@ -2,7 +2,11 @@
local arg = {...}
local data = arg[1]
local order = arg[2]
local content = nil;
local topview = loadscript(BLOG_ROOT.."/view/top.ls")
local title = "Welcome to my blog"
if not #data or #order == 0 then
topview(title)
?>
<div class = "notfound">
<p>No entry found</p>
@ -15,6 +19,15 @@
return
else
data = data[0]
content = bytes.__tostring(std.b64decode(data.rendered)):gsub("%%","%%%%")
local a,b = content:find("<[Hh]1[^>]*>")
if a then
local c,d = content:find("</[Hh]1>")
if c then
title = content:sub(b+1, c-1)
end
end
topview(title)
end
?>
@ -41,8 +54,6 @@
<div class = "blogentry">
<div class = "shortcontent">
<?lua
local content = bytes.__tostring(std.b64decode(data.rendered))
local r, s = content:find("<hr/?>")
if r then
echo(content:sub(0,r-1))

View File

@ -2,6 +2,7 @@
local arg = {...}
local datas = arg[1]
local order = arg[2]
loadscript(BLOG_ROOT.."/view/top.ls")("Welcome to my blog")
if #order == 0 then
?>
<div class = "notfound">
@ -41,7 +42,7 @@
<div class = "blogentry">
<div class = "shortcontent">
<?lua
local content = bytes.__tostring(std.b64decode(data.rendered))
local content = bytes.__tostring(std.b64decode(data.rendered)):gsub("%%","%%%%")
local r, s = content:find("(<hr/?>)")
if r then

View File

@ -1,7 +1,11 @@
<?lua
local arg = {...}
local title = arg[1]
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hi, I'm Xuan Sang LE</title>
<title><?=title?></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="rst/ubuntu-regular.css" />