1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-12-25 17:08:22 +01:00
This commit is contained in:
Xuan Sang LE 2018-02-23 19:52:10 +01:00
parent 6d6f2bdbac
commit e88b5470cc
20 changed files with 908 additions and 219 deletions

View File

@ -1,6 +1,6 @@
BUILDDIR = ../build/blog
copyfiles = index.html assets
copyfiles = *.html assets *.lua *.ls view
main:
- mkdir $(BUILDDIR)

43
blog/api.lua Normal file
View File

@ -0,0 +1,43 @@
local get = {}
get.fetch = function(user, exp, limit)
local db = require("db.model").get(user,"blogs",nil)
if not db then return nil end
local cond = { exp = exp, order = { ctime = "DESC" }}
if limit then
cond.limit = limit
end
local data, sort = db:find(cond)
db:close()
return data, sort
end
get.top = function(user, limit)
return get.fetch(user, nil, limit)
end
get.id = function(user, id)
return get.fetch(user, { ["="] = { id = id } }, nil)
end
get.afterof = function(user, id, limit)
return get.fetch(user, { [">"] = { id = id } }, limit)
end
get.beforeof = function(user, id, limit)
return get.fetch(user, { ["<"] = { id = id } }, limit)
end
get.nextof = function(user, id)
return get.afterof(user, id, 1)
end
get.prevof = function(user, id)
return get.beforeof(user, id, 1)
end
get.bytag = function(user, b64tag, limit)
local tag = bytes.__tostring(std.b64decode(b64tag.."=="))
return get.fetch(user, { ["LIKE"] = { tags = "%%"..tag.."%%" } }, limit)
end
return get

BIN
blog/assets/mrsang.min.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -101,7 +101,7 @@ button{
color: white;
border: 0;
border-radius: 5px;
padding:3px;
padding:5px;
margin-right: 10px;
box-shadow: 1px 1px 1px #9f9F9F;
}
@ -110,32 +110,106 @@ button{
flex-direction: row;
}
#container .card .date{
padding-top:20px;
#container .card .side{
padding-top:28px;
padding-bottom: 0;
margin: 0;
min-width: 74px;
line-height: 1.0;
display: block;
margin-right: 10px;
width: 120px;
flex: 1 0 auto;
color:#3170B2;
text-align: right;
}
#container .card .date .day{
font-weight: bold;
#container .card .side .date{
display: inline-block;
color: #662702;
padding-right: 5px;
padding-bottom: 7px;
border-right: 1px solid #cccccc;
}
#container .card .side .tags{
display: block;
font-size: 60px;
padding-right: 5px;
line-height: 1.1;
font-size: 13px;
color:#878887;
border-right: 1px solid #cccccc;
}
#container .card .date .monthyear{
font-weight: bold;
display: block;
#container .card .side .tags a{
color:#878887;
text-decoration: none;
}
#container .card .side .tags a:hover{
text-decoration: underline;
text-decoration-color: #cccccc;
}
/*
#container .card .side .tags a:before{
font-family: "FontAwesome";
content: "\f02b";
padding-right: 3px;
color: #cccccc;
}*/
#container .blogentry{
padding-top:20px;
/*border-bottom: 1px solid #cccccc;
padding-bottom: 20px;*/
}
#container h1{
#container .blogentry p {
margin: 0;
text-indent: 20pt;
margin-bottom: 20px;
}
#container .blogentry img{
margin-bottom: 20px;
display: block;
margin-left: auto;
margin-right: auto;
}
#container .blogentry a{
text-decoration: none;
color:#3170B2;
}
#container .blogentry hr{
display: block;
height: 1px;
border: 0;
border-top: 1px solid #878887;
padding: 0;
}
#container .blogentry table{
margin-bottom: 20px;
margin-left: auto;
margin-right: auto;
text-align: center;
border-collapse: collapse;
}
#container .blogentry table th,#container .blogentry table td{
border: 1px solid #878787;
padding:3px;
padding-left: 10px;
padding-right: 10px;
}
#container .blogentry pre table {
margin: 0;
text-align: left;
}
#container .blogentry pre table td, #container .blogentry pre table td{
border:0;
padding:0;
}
/*
#
#container .blogentry table th, #container .blogentry table tr, #container .blogentry table td{
border: 1px solid #878787;
margin:0;
}
#container .blogentry table th{
background-color: #878787;
padding:3px;
}*/
#container .blogentry h1{
font-size: 20px;
padding:0;
margin: 0;
@ -165,15 +239,20 @@ div.search-icon:before{
font-size: 18px;
border-bottom: 1px solid #878887;
}
div.logo:before{
div.logo{
display: block;
width: 75px;
width: 122px;
height:50px;
color:white;
font-family: "FontAwesome";
font-size:48px;
line-height: 1.0;
content: "\f0ac";
background-image: url(mrsang.min.png);
background-repeat: no-repeat;
background-position: right;
background-size: 34% 85%;
}
div.logo a{
display: block;
text-decoration: none;
width: 100%;
height: 100%;
}
div.detail {
display: flex;
@ -191,7 +270,7 @@ div.detail a{
display: block;
height: 32px;
border: 1px solid #cccccc;
border: 1px solid #878887;
text-decoration: none;
border-radius: 16px;
margin-left: 10px;
@ -203,5 +282,88 @@ div.detail a:before{
font-family: "FontAwesome";
line-height: 2.0;
padding-left:8px;
color: #cccccc;
color: #878887;
}
div.notfound {
max-width: 400px;
margin: 0 auto;
}
div.notfound p{
margin: 0;
margin-top:20px;
color: #662702;
font-weight: bold;
padding:0;
border-radius: 10px;
}
div.notfound p:before{
font-size:16px;
content:"\f06a";
font-family: "FontAwesome";
line-height: 2.0;
padding-right:8px;
}
div.notfound blockquote{
margin: 0;
}
div.notfound blockquote span{
display: block;
text-align: right;
font-style: italic;
}
td.hljs-ln-numbers {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
text-align: center;
color: #ccc;
vertical-align: top;
font-size: 14;
/* your custom style here */
}
/* for block of code */
#container .blogentry .hljs-ln td.hljs-ln-code {
padding-left: 10px;
}
div.commentform .inputbox{
display:flex;
flex-direction: row;
border-bottom: 1px solid #ccc;
}
div.commentform .inputbox input{
margin-top:3px;
}
div.commentform .inputbox .label{
padding-right: 5px;
}
div.commentform .inputboxbt{
display: flex;
flex-direction: row-reverse;
}
div.commentform textarea{
min-height: 120px;
flex:1;
margin:0;
margin-top:7px;
width: calc( 100% - 20px );
}
div.commentform {
margin: 0 auto;
border: 1px solid #ccc;
padding: 10px;
/*border-radius: 5px;*/
margin-bottom: 20px;
}
#container h1.commentsec{
text-align: center;
border-top: 1px dashed #3170B2;
color:#3170B2;
padding-top: 10px;
padding-bottom: 10px;
}

View File

@ -1,193 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hi, I'm Xuan Sang LE</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" />
<link rel="stylesheet" type="text/css" href="rst/font-awesome.css" />
<link rel="stylesheet" type="text/css" href="assets/style.css" />
<script src="rst/gscripts/jquery-3.2.1.min.js"> </script>
</head>
<body>
<div id = "top">
<div id = "navbar">
<div class = "logo"></div>
<input type = "text" class = "search-box"></input>
<div class= "search-icon"></div>
<ul>
<li ><i class = "fa fa-address-card"></i><a href="https://info.lxsang.me" target="_blank">Porfolio</a></li>
<li><i class = "fa fa-newspaper-o"></i><a href="https://blog.lxsang.me" target="_blank">Blog</a></li>
<li><i class = "fa fa-paper-plane"></i><a href="#" onclick="" >Contact</a></li>
<li > <i class = "fa fa-globe"></i><a href = "https://os.lxsang.me" target="_blank">Web OS</a></li>
</ul>
</div>
</div>
<div id = "center">
<div id = "container">
<div class = "card">
<div class = "date">
<span class = "day">24</span>
<span class = "monthyear">July 2017</span>
</div>
<div class = "blogentry">
<h1>What is Lorem Ipsum?</h1>
<div class = "shortcontent">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsumhas been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It ha
</div>
<div class = "detail">
<span></span>
<a href="#" ></a>
<span></span>
</div>
</div>
</div>
<div class = "card">
<div class = "date">
<span class = "day">24</span>
<span class = "monthyear">July 2017</span>
</div>
<div class = "blogentry">
<h1>What is Lorem Ipsum?</h1>
<div class = "shortcontent">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsumhas been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It ha
</div>
<div class = "detail">
<span></span>
<a href="#" ></a>
<span></span>
</div>
</div>
</div>
<div class = "card">
<div class = "date">
<span class = "day">24</span>
<span class = "monthyear">July 2017</span>
</div>
<div class = "blogentry">
<h1>What is Lorem Ipsum?</h1>
<div class = "shortcontent">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsumhas been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It ha
</div>
<div class = "detail">
<span></span>
<a href="#" ></a>
<span></span>
</div>
</div>
</div>
<div class = "card">
<div class = "date">
<span class = "day">24</span>
<span class = "monthyear">July 2017</span>
</div>
<div class = "blogentry">
<h1>What is Lorem Ipsum?</h1>
<div class = "shortcontent">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsumhas been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It ha
</div>
<div class = "detail">
<span></span>
<a href="#" ></a>
<span></span>
</div>
</div>
</div>
<div class = "card">
<div class = "date">
<span class = "day">24</span>
<span class = "monthyear">July 2017</span>
</div>
<div class = "blogentry">
<h1>What is Lorem Ipsum?</h1>
<div class = "shortcontent">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsumhas been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It ha
</div>
<div class = "detail">
<span></span>
<a href="#" ></a>
<span></span>
</div>
</div>
</div>
<div class = "card">
<div class = "date">
<span class = "day">24</span>
<span class = "monthyear">July 2017</span>
</div>
<div class = "blogentry">
<h1>What is Lorem Ipsum?</h1>
<div class = "shortcontent">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsumhas been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It ha
</div>
<div class = "detail">
<span></span>
<a href="#" ></a>
<span></span>
</div>
</div>
</div>
<div class = "card">
<div class = "date">
<span class = "day">24</span>
<span class = "monthyear">July 2017</span>
</div>
<div class = "blogentry">
<h1>What is Lorem Ipsum?</h1>
<div class = "shortcontent">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsumhas been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It ha
</div>
<div class = "detail">
<span></span>
<a href="#" ></a>
<span></span>
</div>
</div>
</div>
<div class = "card">
<div class = "date">
<span class = "day">24</span>
<span class = "monthyear">July 2017</span>
</div>
<div class = "blogentry">
<h1>What is Lorem Ipsum?</h1>
<div class = "shortcontent">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsumhas been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It ha
</div>
<div class = "detail">
<span></span>
<a href="#" ></a>
<span></span>
</div>
</div>
</div>
</div>
</div>
<div id = "bottom">
Powered by antd server, (c) 2017 - 2018 Xuan Sang LE
</div>
</body>
</html>

28
blog/index.ls Normal file
View File

@ -0,0 +1,28 @@
<?lua
BLOG_ROOT = __ROOT__.."/blog"
-- if a file request, just respond it
local action = REQUEST.query.action
if not action or action == "" then
return require("blog.router")("top:10")
end
local path = BLOG_ROOT.."/"..action
if unix.exists(path) then
local mime = std.mime(path)
if mime == "application/octet-stream" then
std.html()
echo("Acess denied to: "..path)
else
std.header(mime)
if std.is_bin(path) then
std.fb(path)
else
std.f(path)
end
end
else
print("Perform action.."..action)
return require("blog.router")(action)
end
?>

31
blog/router.lua Normal file
View File

@ -0,0 +1,31 @@
BLOG_ROOT = __ROOT__.."/blog"
MAX_ENTRY = 10
local user = "mrsang"
local handle = function(p)
std.html()
local args = {}
local sort = {}
local i = 1
for s in p:gmatch("%:*([^%:]*)") do
args[i] = s
table.insert(sort, i)
i = i+1
end
table.sort(sort)
local api = require("blog.api")
if #args == 0 or api == nil then
echo("Unknow request "..p)
elseif not api[args[1]] then
echo("Unknow action.."..args[1])
else
local action = args[1]
args[1] = user
local data, sort = api[action](table.unpack(args))
if data == nil then
echo("Cannot query data")
else
require("blog.view").render(action, data, sort)
end
end
end
return handle

144
blog/template.html Normal file
View File

@ -0,0 +1,144 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hi, I'm Xuan Sang LE</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" />
<link rel="stylesheet" type="text/css" href="rst/font-awesome.css" />
<link rel="stylesheet" type="text/css" href="rst/hermit-light.css" />
<link rel="stylesheet" type="text/css" href="assets/style.css" />
<script src="rst/gscripts/jquery-3.2.1.min.js"> </script>
</head>
<body>
<div id = "top">
<div id = "navbar">
<div class = "logo"></div>
<ul>
<li ><i class = "fa fa-address-card"></i><a href="https://info.lxsang.me" target="_blank">Porfolio</a></li>
<li><i class = "fa fa-newspaper-o"></i><a href="https://blog.lxsang.me" target="_blank">Blog</a></li>
<li><i class = "fa fa-paper-plane"></i><a href="#" onclick="" >Contact</a></li>
<li > <i class = "fa fa-globe"></i><a href = "https://os.lxsang.me" target="_blank">Web OS</a></li>
</ul>
<input type = "text" class = "search-box"></input>
<div class= "search-icon"></div>
</div>
</div>
<div id = "center">
<div id = "container">
<div class = "card">
<div class = "side">
<span class = "date">24 July 2017</span>
<span class = "tags">
<a href= "#">ROS</a>,
<a href= "#">distributed system</a>,
<a href= "#">middleware</a>,
<a href= "#">robotic</a>,
<a href= "#">SLAM</a>,
<a href= "#">autonomous exploration</a>
</span>
</div>
<div class = "blogentry">
<h1>What is Lorem Ipsum?</h1>
<div class = "shortcontent">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsumhas been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It ha
</div>
<div class = "detail">
<span></span>
<a href="#" ></a>
<span></span>
</div>
</div>
</div>
<div class = "card">
<div class = "side">
<span class = "date">24 July 2017</span>
<span class = "tags">
<a href= "#">ROS</a>,
<a href= "#">distributed system</a>,
<a href= "#">middleware</a>,
<a href= "#">robotic</a>,
<a href= "#">SLAM</a>,
<a href= "#">autonomous exploration</a>
</span>
</div>
<div class = "blogentry">
<h1>What is Lorem Ipsum?</h1>
<div class = "shortcontent">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsumhas been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It ha
</div>
<div class = "detail">
<span></span>
<a href="#" ></a>
<span></span>
</div>
</div>
</div>
<div class = "card">
<div class = "side">
<span class = "date">24 July 2017</span>
<span class = "tags">
<a href= "#">ROS</a>,
<a href= "#">distributed system</a>,
<a href= "#">middleware</a>,
<a href= "#">robotic</a>,
<a href= "#">SLAM</a>,
<a href= "#">autonomous exploration</a>
</span>
</div>
<div class = "blogentry">
<h1>What is Lorem Ipsum?</h1>
<div class = "shortcontent">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsumhas been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It ha
</div>
<div class = "detail">
<span></span>
<a href="#" ></a>
<span></span>
</div>
</div>
</div>
<div class = "card">
<div class = "side">
<span class = "date">24 July 2017</span>
<span class = "tags">
<a href= "#">ROS</a>,
<a href= "#">distributed system</a>,
<a href= "#">middleware</a>,
<a href= "#">robotic</a>,
<a href= "#">SLAM</a>,
<a href= "#">autonomous exploration</a>
</span>
</div>
<div class = "blogentry">
<h1>What is Lorem Ipsum?</h1>
<div class = "shortcontent">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsumhas been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It ha
</div>
<div class = "detail">
<span></span>
<a href="#" ></a>
<span></span>
</div>
</div>
</div>
</div>
</div>
<div id = "bottom">
Powered by antd server, (c) 2017 - 2018 Xuan Sang LE
</div>
</body>
</html>

27
blog/view.lua Normal file
View File

@ -0,0 +1,27 @@
local view = {}
view.html = function(name)
local path = BLOG_ROOT.."/view/"..name..".html"
local f = io.open(path, "rb")
if f then
echo(f:read("*all"))
f:close()
else
echo("Cannot find "..path)
end
end
view.render = function(action, data, sort)
view.html("top")
local path = BLOG_ROOT.."/view"
if action == "id" then
_G.dbmodel = data[0]
doscript(path.."/detail.ls")
else
_G.dbmodel = { data = data, order = sort }
doscript(path.."/entries.ls")
end
_G.dbmodel = nil
view.html("bot")
end
return view

7
blog/view/bot.html Normal file
View File

@ -0,0 +1,7 @@
</div>
</div>
<div id = "bottom">
Powered by antd server, (c) 2017 - 2018 Xuan Sang LE
</div>
</body>
</html>

68
blog/view/detail.ls Normal file
View File

@ -0,0 +1,68 @@
<?lua
local data = _G.dbmodel
if not #data then
?>
<div class = "notfound">
<p>No entry found</p>
<blockquote>
“In many ways my life has been rather like a record of the lost and found. Perhaps all lives are like that.”
<span>― Lucy Foley, The Book of Lost and Found</span>
</blockquote >
</div>
<?lua
return
end
?>
<div class = "card">
<div class = "side">
<span class = "date"><?=data.ctimestr:gsub("%s+.*$","")?></span>
<span class = "tags">
<?lua
local atags = {}
local i = 1
for tag in data.tags:gmatch(",*([^,]+)") do
tag = std.trim(tag, " ")
local b64tag = std.b64encode(tag)
atags[i] = '<a href = "./bytag:'..b64tag:gsub("=","")..':'..MAX_ENTRY..'">'..tag.."</a>"
i = i+ 1
end
echo(table.concat(atags, ", "))
?>
</span>
</div>
<div class = "blogentry">
<div class = "shortcontent">
<?lua
local content = bytes.__tostring(std.b64decode(data.rendered)):gsub("%%","%%%%")
local r, s = content:find("<hr/?>")
if r then
echo(content:sub(0,r-1))
echo(content:sub(s+1))
else
echo(content)
end
?>
</div>
<h1 class = "commentsec">Comments</h1>
<div class = "commentform">
<div class = "inputbox">
<div class = "label">Name:</div>
<input data-class = "data" type = "text" name = "name" />
</div>
<div class = "inputbox">
<div class = "label">Email:</div>
<input data-class = "data" type = "text" name = "email" />
</div>
<textarea data-class = "data" name = "content"></textarea>
<div class = "inputboxbt">
<div data-id="status"></div>
<button data-id = "send" >Comment</button>
</div>
</div>
</div>
</div>

58
blog/view/entries.ls Normal file
View File

@ -0,0 +1,58 @@
<?lua
local model = _G.dbmodel
if #model.order == 0 then
?>
<div class = "notfound">
<p>No entry found</p>
<blockquote>
“In many ways my life has been rather like a record of the lost and found. Perhaps all lives are like that.”
<span>― Lucy Foley, The Book of Lost and Found</span>
</blockquote >
</div>
<?lua
return
end
for idx,v in pairs(model.order) do
local data = model.data[v]
?>
<div class = "card">
<div class = "side">
<span class = "date"><?=data.ctimestr:gsub("%s+.*$","")?></span>
<span class = "tags">
<?lua
local atags = {}
local i = 1
for tag in data.tags:gmatch(",*([^,]+)") do
tag = std.trim(tag, " ")
local b64tag = std.b64encode(tag)
atags[i] = '<a href = "./bytag:'..b64tag:gsub("=","")..':'..MAX_ENTRY..'">'..tag.."</a>"
i = i+ 1
end
echo(table.concat(atags, ", "))
?>
</span>
</div>
<div class = "blogentry">
<div class = "shortcontent">
<?lua
local content = bytes.__tostring(std.b64decode(data.rendered)):gsub("%%","%%%%")
local r, s = content:find("(<hr/?>)")
if r then
content = content:sub(0,r-1)
end
echo(content)
?>
</div>
<div class = "detail">
<span></span>
<?='<a href="./id:'..data.id..'" ></a>'?>
<span></span>
</div>
</div>
</div>
<?lua
end
?>

40
blog/view/top.html Normal file
View File

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hi, I'm Xuan Sang LE</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" />
<link rel="stylesheet" type="text/css" href="rst/font-awesome.css" />
<link rel="stylesheet" type="text/css" href="rst/hljs/github.css" />
<link rel="stylesheet" type="text/css" href="assets/style.css" />
<script src="rst/gscripts/jquery-3.2.1.min.js"> </script>
<script src="rst/hljs/highlight.pack.js"> </script>
<script src="rst/hljs/highlightjs-line-numbers.min.js"> </script>
<script>
$(document).ready(function() {
$('pre code').each(function(i, block) {
hljs.highlightBlock(block);
hljs.lineNumbersBlock(block);
});
});
</script>
</head>
<body>
<div id = "top">
<div id = "navbar">
<div class = "logo"><a href = "https://lxsang.me"></a></div>
<ul>
<li><i class = "fa fa-home"></i><a href="./">Home</a></li>
<li ><i class = "fa fa-address-card"></i><a href="https://info.lxsang.me" >Porfolio</a></li>
<li><i class = "fa fa-paper-plane"></i><a href="#" onclick="" >Contact</a></li>
<li > <i class = "fa fa-globe"></i><a href = "https://lxsang.me" target="_blank">#Me</a></li>
</ul>
<input type = "text" class = "search-box"></input>
<div class= "search-icon"></div>
</div>
</div>
<div id = "center">
<div id = "container">

View File

@ -1,6 +1,6 @@
BUILDDIR = ../build/grs
copyfiles = font-awesome.css fonts images showdown.min.js ubuntu-regular.css mainsite.css sendto.html
copyfiles = font-awesome.css fonts images showdown.min.js ubuntu-regular.css mainsite.css sendto.html hermit-light.css hljs
main:
- mkdir $(BUILDDIR)

12
grs/hermit-light.css Executable file
View File

@ -0,0 +1,12 @@
/*! Generated by Font Squirrel (https://www.fontsquirrel.com) on August 6, 2017 */
@font-face {
font-family: 'HermitLight';
src: url('resources/themes/antos/fonts/hermit-light-webfont.woff2') format('woff2'),
url('resources/themes/antos/fonts/hermit-light-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}

71
grs/hljs/github-gist.css Normal file
View File

@ -0,0 +1,71 @@
/**
* GitHub Gist Theme
* Author : Louis Barranqueiro - https://github.com/LouisBarranqueiro
*/
.hljs {
display: block;
background: white;
padding: 0.5em;
color: #333333;
overflow-x: auto;
}
.hljs-comment,
.hljs-meta {
color: #969896;
}
.hljs-string,
.hljs-variable,
.hljs-template-variable,
.hljs-strong,
.hljs-emphasis,
.hljs-quote {
color: #df5000;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-type {
color: #a71d5d;
}
.hljs-literal,
.hljs-symbol,
.hljs-bullet,
.hljs-attribute {
color: #0086b3;
}
.hljs-section,
.hljs-name {
color: #63a35c;
}
.hljs-tag {
color: #333333;
}
.hljs-title,
.hljs-attr,
.hljs-selector-id,
.hljs-selector-class,
.hljs-selector-attr,
.hljs-selector-pseudo {
color: #795da3;
}
.hljs-addition {
color: #55a532;
background-color: #eaffea;
}
.hljs-deletion {
color: #bd2c00;
background-color: #ffecec;
}
.hljs-link {
text-decoration: underline;
}

99
grs/hljs/github.css Normal file
View File

@ -0,0 +1,99 @@
/*
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
color: #333;
background: #f8f8f8;
}
.hljs-comment,
.hljs-quote {
color: #998;
font-style: italic;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-subst {
color: #333;
font-weight: bold;
}
.hljs-number,
.hljs-literal,
.hljs-variable,
.hljs-template-variable,
.hljs-tag .hljs-attr {
color: #008080;
}
.hljs-string,
.hljs-doctag {
color: #d14;
}
.hljs-title,
.hljs-section,
.hljs-selector-id {
color: #900;
font-weight: bold;
}
.hljs-subst {
font-weight: normal;
}
.hljs-type,
.hljs-class .hljs-title {
color: #458;
font-weight: bold;
}
.hljs-tag,
.hljs-name,
.hljs-attribute {
color: #000080;
font-weight: normal;
}
.hljs-regexp,
.hljs-link {
color: #009926;
}
.hljs-symbol,
.hljs-bullet {
color: #990073;
}
.hljs-built_in,
.hljs-builtin-name {
color: #0086b3;
}
.hljs-meta {
color: #999;
font-weight: bold;
}
.hljs-deletion {
background: #fdd;
}
.hljs-addition {
background: #dfd;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}

89
grs/hljs/googlecode.css Normal file
View File

@ -0,0 +1,89 @@
/*
Google Code style (c) Aahan Krish <geekpanth3r@gmail.com>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: white;
color: black;
}
.hljs-comment,
.hljs-quote {
color: #800;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-section,
.hljs-title,
.hljs-name {
color: #008;
}
.hljs-variable,
.hljs-template-variable {
color: #660;
}
.hljs-string,
.hljs-selector-attr,
.hljs-selector-pseudo,
.hljs-regexp {
color: #080;
}
.hljs-literal,
.hljs-symbol,
.hljs-bullet,
.hljs-meta,
.hljs-number,
.hljs-link {
color: #066;
}
.hljs-title,
.hljs-doctag,
.hljs-type,
.hljs-attr,
.hljs-built_in,
.hljs-builtin-name,
.hljs-params {
color: #606;
}
.hljs-attribute,
.hljs-subst {
color: #000;
}
.hljs-formula {
background-color: #eee;
font-style: italic;
}
.hljs-selector-id,
.hljs-selector-class {
color: #9B703F
}
.hljs-addition {
background-color: #baeeba;
}
.hljs-deletion {
background-color: #ffc8bd;
}
.hljs-doctag,
.hljs-strong {
font-weight: bold;
}
.hljs-emphasis {
font-style: italic;
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
!function(n,e){"use strict";function t(){var n=e.createElement("style");n.type="text/css",n.innerHTML=h(".{0}{border-collapse:collapse}.{0} td{padding:0}.{1}:before{content:attr({2})}",[f,m,j]),e.getElementsByTagName("head")[0].appendChild(n)}function r(t){"complete"===e.readyState?l(t):n.addEventListener("DOMContentLoaded",function(){l(t)})}function l(t){try{var r=e.querySelectorAll("code.hljs");for(var l in r)r.hasOwnProperty(l)&&i(r[l],t)}catch(o){n.console.error("LineNumbers error: ",o)}}function i(n,e){if("object"==typeof n){e=e||{singleLine:!1};var t=e.singleLine?0:1;u(function(){s(n),n.innerHTML=o(n.innerHTML,t)})}}function o(n,e){var t=c(n);if(t.length>e){for(var r="",l=0,i=t.length;l<i;l++)r+=h('<tr><td class="{0}"><div class="{1} {2}" {3}="{5}"></div></td><td class="{4}"><div class="{1}">{6}</div></td></tr>',[p,v,m,j,g,l+1,t[l].length>0?t[l]:" "]);return h('<table class="{0}">{1}</table>',[f,r])}return n}function s(n){var e=n.childNodes;for(var t in e)if(e.hasOwnProperty(t)){var r=e[t];d(r.textContent)>0&&(r.childNodes.length>0?s(r):a(r))}}function a(n){var e=n.parentNode.className;if(/hljs-/.test(e)){for(var t=c(n.textContent),r=0,l="";r<t.length;r++)l+=h('<span class="{0}">{1}</span>\n',[e,t[r]]);n.parentNode.innerHTML=l.trim()}}function c(n){return 0===n.length?[]:n.split(L)}function d(n){return(n.trim().match(L)||[]).length}function u(e){n.setTimeout(e,0)}function h(n,e){return n.replace(/\{(\d+)\}/g,function(n,t){return e[t]?e[t]:n})}var f="hljs-ln",v="hljs-ln-line",g="hljs-ln-code",p="hljs-ln-numbers",m="hljs-ln-n",j="data-line-number",L=/\r\n|\r|\n/g;n.hljs?(n.hljs.initLineNumbersOnLoad=r,n.hljs.lineNumbersBlock=i,t()):n.console.error("highlight.js not detected!")}(window,document);