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

View File

@ -2,7 +2,11 @@
local arg = {...} local arg = {...}
local data = arg[1] local data = arg[1]
local order = arg[2] 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 if not #data or #order == 0 then
topview(title)
?> ?>
<div class = "notfound"> <div class = "notfound">
<p>No entry found</p> <p>No entry found</p>
@ -15,6 +19,15 @@
return return
else else
data = data[0] 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 end
?> ?>
@ -41,8 +54,6 @@
<div class = "blogentry"> <div class = "blogentry">
<div class = "shortcontent"> <div class = "shortcontent">
<?lua <?lua
local content = bytes.__tostring(std.b64decode(data.rendered))
local r, s = content:find("<hr/?>") local r, s = content:find("<hr/?>")
if r then if r then
echo(content:sub(0,r-1)) echo(content:sub(0,r-1))

View File

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

View File

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