mirror of
https://github.com/lxsang/antd-web-apps
synced 2025-07-17 06:09:50 +02:00
blog now use silk
This commit is contained in:
130
blog/views/default/layout.ls
Normal file
130
blog/views/default/layout.ls
Normal file
@ -0,0 +1,130 @@
|
||||
|
||||
|
||||
<?lua
|
||||
local title = __main__:get("title")
|
||||
local render = __main__:get("render")
|
||||
local url = __main__:get("url")
|
||||
local tags = __main__:get("tags")
|
||||
local cls = ""
|
||||
if HEADER.mobile then
|
||||
cls = "navmobile"
|
||||
end
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title><?=title?></title>
|
||||
<meta charset="UTF-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/rst/ubuntu-regular.css" />
|
||||
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/rst/font-awesome.css" />
|
||||
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/assets/style.css" />
|
||||
<script src="<?=HTTP_ROOT?>/rst/gscripts/riot.min.js"> </script>
|
||||
<script src="<?=HTTP_ROOT?>/rst/resources/antos_tags.js"></script>
|
||||
<script src="<?=HTTP_ROOT?>/rst/gscripts/jquery-3.2.1.min.js"> </script>
|
||||
<script src="<?=HTTP_ROOT?>/rst/main.js"></script>
|
||||
<meta property="og:image" content="" />
|
||||
<?lua if render then ?>
|
||||
<meta name="twitter:card" content="summary" />
|
||||
<meta name="twitter:site" content="@blog.lxsang.me" />
|
||||
<meta name="twitter:creator" content="@lexsang" />
|
||||
<meta property="og:url" content="<?=url?>" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:title" content="<?=title?>" />
|
||||
<meta property="og:description" content="<?=tags?>" />
|
||||
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/rst/hljs/github.css" />
|
||||
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/rst/katex/katex.min.css" />
|
||||
<script src="<?=HTTP_ROOT?>/rst/hljs/highlight.pack.js"> </script>
|
||||
<script src="<?=HTTP_ROOT?>/rst/hljs/highlightjs-line-numbers.min.js"> </script>
|
||||
<script src="<?=HTTP_ROOT?>/rst/katex/katex.min.js"> </script>
|
||||
<script src="<?=HTTP_ROOT?>/rst/katex/auto-render.min.js"> </script>
|
||||
<?lua else ?>
|
||||
<meta property="og:url" content="https://blog.lxsang.me" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:title" content="Xuan Sang LE's blog" />
|
||||
<meta property="og:description" content="Blog Home" />
|
||||
<?lua end ?>
|
||||
<script>
|
||||
|
||||
<?lua if render then ?>
|
||||
$(document).ready(function() {
|
||||
renderMathInElement($("#container")[0]);
|
||||
$('pre code').each(function(i, block) {
|
||||
hljs.highlightBlock(block);
|
||||
hljs.lineNumbersBlock(block);
|
||||
});
|
||||
});
|
||||
<?lua end ?>
|
||||
window.twttr = (function(d, s, id) {
|
||||
var js, fjs = d.getElementsByTagName(s)[0],
|
||||
t = window.twttr || {};
|
||||
if (d.getElementById(id)) return t;
|
||||
js = d.createElement(s);
|
||||
js.id = id;
|
||||
js.src = "https://platform.twitter.com/widgets.js";
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
|
||||
t._e = [];
|
||||
t.ready = function(f) {
|
||||
t._e.push(f);
|
||||
};
|
||||
|
||||
return t;
|
||||
}(document, "script", "twitter-wjs"));
|
||||
|
||||
// facebook
|
||||
(function(d, s, id) {
|
||||
var js, fjs = d.getElementsByTagName(s)[0];
|
||||
if (d.getElementById(id)) return;
|
||||
js = d.createElement(s); js.id = id;
|
||||
js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.12';
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
}(document, 'script', 'facebook-jssdk'));
|
||||
|
||||
/*(function() {
|
||||
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
|
||||
po.src = 'https://apis.google.com/js/plusone.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
|
||||
})();*/
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="fb-root"></div>
|
||||
|
||||
<div id = "top">
|
||||
<div id = "navbar" class = "<?=cls?>">
|
||||
<div class = "logo"><a href = "https://lxsang.me"></a></div>
|
||||
<ul>
|
||||
<li><i class = "fa fa-home"></i><a href="<?=HTTP_ROOT?>">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-envelope"></i><a href="#" onclick="mailtoMe('rst')" >Contact</a></li>
|
||||
<?lua
|
||||
if not HEADER.mobile then
|
||||
?>
|
||||
<li> <i class = "fa fa-paper-plane"></i><a href="#" onclick="subscribe('rst')">Subscribe</a></li>
|
||||
<li > <i class = "fa fa-globe"></i><a href = "https://os.lxsang.me" target="_blank">AntOS</a></li>
|
||||
<?lua end ?>
|
||||
</ul>
|
||||
<?lua
|
||||
if not HEADER.mobile then
|
||||
?>
|
||||
<input type = "text" class = "search-box"></input>
|
||||
<div class= "search-icon"></div>
|
||||
<?lua
|
||||
end
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div id = "desktop">
|
||||
<div id = "container">
|
||||
<?lua
|
||||
__main__:render()
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div id = "bottom">
|
||||
Powered by antd server, (c) 2017 - 2018 Xuan Sang LE
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
8
blog/views/default/notfound/index.ls
Normal file
8
blog/views/default/notfound/index.ls
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
<div class = "notfound">
|
||||
<p><?=error?></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>
|
3
blog/views/default/post/analyse.ls
Normal file
3
blog/views/default/post/analyse.ls
Normal file
@ -0,0 +1,3 @@
|
||||
<?lua
|
||||
echo("<h3>"..message.."</h3>")
|
||||
?>
|
94
blog/views/default/post/detail.ls
Normal file
94
blog/views/default/post/detail.ls
Normal file
@ -0,0 +1,94 @@
|
||||
<?lua
|
||||
local data = post
|
||||
local class = "card"
|
||||
if HEADER.mobile then
|
||||
class = "card mobile"
|
||||
end
|
||||
local content = data.rendered
|
||||
?>
|
||||
<div class = "<?=class?>">
|
||||
<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, " ")
|
||||
if tag ~= "" then
|
||||
local b64tag = std.b64encode(tag)
|
||||
atags[i] = '<a href = "'..HTTP_ROOT..'/post/bytag/'..b64tag:gsub("=","")..'/'..POST_LIMIT..'">'..tag.."</a>"
|
||||
i = i+ 1
|
||||
end
|
||||
end
|
||||
echo(table.concat(atags, ", "))
|
||||
?>
|
||||
</span>
|
||||
<div class="fb-like" data-href="<?=url?>" data-layout="button_count" data-action="like" data-size="small" data-show-faces="true" data-share="true"></div>
|
||||
<!--div class="g-plusone" data-action="share" data-size="medium" data-href="<?=url?>"></div-->
|
||||
<a class="twitter-share-button" href='https://twitter.com/intent/tweet?url=<?=url?>&text=<?=data.title?>'></a>
|
||||
</div>
|
||||
<div class = "blogentry">
|
||||
<div class = "shortcontent">
|
||||
<?lua
|
||||
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>
|
||||
<?lua
|
||||
if similar_posts then
|
||||
?>
|
||||
<h1 class = "commentsec">Related posts</h1>
|
||||
<?lua
|
||||
echo("<ul>")
|
||||
for k,v in pairs(similar_posts) do
|
||||
echo("<li><a href='./r:id:"..v.st.sid.."'>"..v.post.title.."</a> (<b>Score</b>: "..string.format("%2.2f",v.st.score)..")</li>")
|
||||
end
|
||||
echo("</ul>")
|
||||
end?>
|
||||
<h1 class = "commentsec"></h1>
|
||||
<div id="disqus_thread"></div>
|
||||
<script>
|
||||
|
||||
/**
|
||||
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
|
||||
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
|
||||
|
||||
var disqus_config = function () {
|
||||
this.page.url = "<?=url?>"; // Replace PAGE_URL with your page's canonical URL variable
|
||||
this.page.identifier = "<?=std.md5(url)?>"; // Replace PAGE_IDENTIFIER with your
|
||||
};
|
||||
|
||||
(function() { // DON'T EDIT BELOW THIS LINE
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = 'https://https-blog-lxsang-me.disqus.com/embed.js';
|
||||
s.setAttribute('data-timestamp', +new Date());
|
||||
(d.head || d.body).appendChild(s);
|
||||
})();
|
||||
</script>
|
||||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
||||
|
||||
<!--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>
|
8
blog/views/default/post/notfound.ls
Normal file
8
blog/views/default/post/notfound.ls
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
<div class = "notfound">
|
||||
<p><?=error?></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>
|
91
blog/views/default/post/posts.ls
Normal file
91
blog/views/default/post/posts.ls
Normal file
@ -0,0 +1,91 @@
|
||||
<?lua
|
||||
local datas = posts
|
||||
local class = "card"
|
||||
local first_id = nil
|
||||
local last_id = nil
|
||||
if HEADER.mobile then
|
||||
class = "card mobile"
|
||||
end
|
||||
|
||||
for idx,v in pairs(order) do
|
||||
local data = datas[v]
|
||||
if not last_id then last_id = data.id end
|
||||
first_id = data.id
|
||||
?>
|
||||
<div class = "<?=class?>">
|
||||
<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, " ")
|
||||
if tag ~= "" then
|
||||
local b64tag = std.b64encode(tag)
|
||||
atags[i] = '<a href = "'..HTTP_ROOT..'/post/bytag/'..b64tag:gsub("=","")..'/'..POST_LIMIT..'">'..tag.."</a>"
|
||||
i = i+ 1
|
||||
end
|
||||
end
|
||||
echo(table.concat(atags, ", "))
|
||||
local url = HTTP_ROOT.."/post/id/"..data.id
|
||||
?>
|
||||
</span>
|
||||
<div class="fb-like" data-href="<?=url?>" data-layout="button_count" data-action="like" data-size="small" data-show-faces="true" data-share="true"></div>
|
||||
<!--div class="g-plusone" data-action="share" data-size="medium" data-href="<?=url?>"></div-->
|
||||
<a class="twitter-share-button" href='https://twitter.com/intent/tweet?url=<?=url?>&text=<?=data.title?>'></a>
|
||||
</div>
|
||||
<div class = "blogentry">
|
||||
<div class = "shortcontent">
|
||||
<?lua
|
||||
local content = bytes.__tostring(std.b64decode(data.rendered)):gsub("%%","%%%%")
|
||||
local r, s = content:find("(<hr/?>)")
|
||||
local title = nil
|
||||
if r then
|
||||
content = content:sub(0,r-1)
|
||||
end
|
||||
local a,b = content:find("<[Hh]1[^>]*>")
|
||||
local c,d
|
||||
if a then
|
||||
c,d = content:find("</[Hh]1>")
|
||||
if c then
|
||||
title = content:sub(b+1, c-1)
|
||||
end
|
||||
end
|
||||
if title then
|
||||
echo(content:sub(0, b))
|
||||
echo("<a class = 'title_link' href='"..HTTP_ROOT.."/post/id/"..data.id.."'>"..title.."</a>")
|
||||
echo(content:sub(c))
|
||||
else
|
||||
echo(content)
|
||||
end
|
||||
?>
|
||||
</div>
|
||||
<div class = "detail">
|
||||
<span></span>
|
||||
<?='<a href="'..HTTP_ROOT..'/post/id/'..data.id..'" ></a>'?>
|
||||
<span></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?lua
|
||||
end
|
||||
local beforelk = HTTP_ROOT.."/post/beforeof/"..first_id.."/"..POST_LIMIT
|
||||
local afterlk = HTTP_ROOT.."/post/afterof/"..last_id.."/"..POST_LIMIT
|
||||
if action == "bytag" or action == "search" then
|
||||
beforelk = HTTP_ROOT.."/post/"..action.."/"..query.."/"..POST_LIMIT.."/before/"..first_id
|
||||
afterlk = HTTP_ROOT.."/post/"..action.."/"..query.."/"..POST_LIMIT.."/after/"..last_id
|
||||
end
|
||||
?>
|
||||
<div class = "time-travel">
|
||||
<?lua
|
||||
if first_id ~= minid then
|
||||
?>
|
||||
<a href = "<?=beforelk?>" class = "past"><< Older posts</a>
|
||||
<?lua
|
||||
end
|
||||
if last_id ~= maxid then
|
||||
?>
|
||||
<a href = "<?=afterlk?>" class = "future">Newer posts >></a>
|
||||
<?lua end ?>
|
||||
</div>
|
Reference in New Issue
Block a user