summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2023-04-15 16:47:26 +0100
committerubq323 <ubq323@ubq323.website>2023-04-15 16:47:26 +0100
commitb5ea24207d9a6b1d6d7bc37d83952848588cd2e0 (patch)
tree102120dc2922a03d99697ddd5871407651d71af5
parent5358e5164e29aee379e58c2408110caf78eb8fd8 (diff)
further blog infra structure
-rw-r--r--blog/test-post.lua17
-rw-r--r--blogindex.lua37
-rwxr-xr-xbuild.sh8
-rw-r--r--h.lua1
-rw-r--r--head.html7
-rw-r--r--index.lua1
6 files changed, 62 insertions, 9 deletions
diff --git a/blog/test-post.lua b/blog/test-post.lua
index c6cbd84..06fe9e3 100644
--- a/blog/test-post.lua
+++ b/blog/test-post.lua
@@ -1,20 +1,24 @@
require'h'
-head = mkhead'reblogcca'
-
-
+local meta = {
+ title='what do i mean by "telephony"',
+ date="2022-12-22",
+ tags={"telephony"},
+}
+if ... then return meta end
+local head = mkhead'reblogcca'
-top = header {
+local top = header {
img({id='me',src='/me.png'},''),
h1 'rebecca blog',
p [[ there is some text here ]],
}
-breadcrumbs = bcrumb {
+local breadcrumbs = bcrumb {
{'< home','/'},
{'rebecca blog','/blog'},
- {'what do i mean by "telephone"'}
+ {meta.title},
}
sect = section {
@@ -25,3 +29,4 @@ sect = section {
print(html{
head, top, breadcrumbs, sect,
})
+
diff --git a/blogindex.lua b/blogindex.lua
new file mode 100644
index 0000000..4322164
--- /dev/null
+++ b/blogindex.lua
@@ -0,0 +1,37 @@
+require'h'
+
+local head = mkhead'blog listing'
+local top = mktopbox('/me.png','rebecca blog',p'page listing')
+local bread = bcrumb{
+ {'< home','/'},
+ {'rebecca blog'}
+}
+
+local metas={}
+local posix = require'posix'
+for fname in posix.dirent.files'blog' do
+ if fname:sub(1,1) ~= '.' then
+ local meta = loadfile('blog/'..fname)(true)
+ meta.fname = meta.fname or fname:gsub('%.lua$','')
+ table.insert(metas,meta)
+ end
+end
+table.sort(metas,function(a,b) return a.date>b.date end)
+
+local list = {}
+for _,it in ipairs(metas) do
+ table.insert(list, li{
+ tag('time',{datetime=it.date},it.date),
+ a(it.title,'/blog/'..it.fname..'.html')
+ })
+end
+
+local listsect = section {
+ p'the',
+ ul({class="postlist"},list)
+}
+
+
+print(html{
+ head, top, bread, listsect
+})
diff --git a/build.sh b/build.sh
index 03ce4db..2590b09 100755
--- a/build.sh
+++ b/build.sh
@@ -35,7 +35,11 @@ bpn index
cf bg.png
cf me.png
-md blog/
-bpn blog/test-post
+
+# md blog/
+# bpn blog/test-post
+# bpn blog/post-alpha
+# bpn blog/post-beta
+# bp blogindex.lua blog/index.html
cf 4d.html
diff --git a/h.lua b/h.lua
index 16ccb21..60b9ce3 100644
--- a/h.lua
+++ b/h.lua
@@ -39,6 +39,7 @@ local function fmt_tag(tag)
end
function tag(tname, a1, a2)
+ -- tag(tname,body) or tag(tname,attrs,body)
local body, attrs
if a2 then attrs=a1 body=a2 else attrs=nil body=a1 end
return setmetatable({tag=true,tname=tname,attrs=attrs,body=body},{__tostring=fmt_tag})
diff --git a/head.html b/head.html
index ef35088..6a4b2e9 100644
--- a/head.html
+++ b/head.html
@@ -4,16 +4,21 @@
<link rel="icon" href="/m/interesting3.png">
<style>
body {font-family: sans-serif;font-size:larger;max-width:60ch;margin:auto}
-body {background-image: url("bg.png")}
+body {background-image: url("/bg.png")}
h1 {color:#e79e00; text-shadow: 0 0 1px #000, 0 0 1px #000, 0 0 1px #000, 0 0 1px #000, 0 0 1px #000, 0 0 1px #000;}
section {margin:20px 0;padding:20px;border-radius:20px;border:1px solid rebeccapurple;background-color:white}
+
header {border: 2px solid black;max-width:100%;margin:1em;background-color:white}
header {display:grid;grid-template-columns:1fr 3fr;}
#me {max-width:100%;grid-row: 1/3;grid-column:1;margin:auto}
header * {margin:auto}
header p {padding:1em}
+
.breadcrumb {font-size:smaller;}
.breadcrumb ol {list-style:none;padding-left:1em}
.breadcrumb li {display:inline;}
.breadcrumb li+li::before {content:"|\00a0";padding:4px;}
+
+.postlist li {list-style:none;}
+.postlist time {color:#555;font-style:italic}
</style>
diff --git a/index.lua b/index.lua
index d8f7c2e..59a6879 100644
--- a/index.lua
+++ b/index.lua
@@ -38,6 +38,7 @@ footer = safe [[
<iframe height="50" src="https://george.gh0.pw/embed.cgi?ubq323" style="border:none;width:100%"></iframe>
<!-- johnvertisements -->
<iframe src="https://john.mondecitronne.com/embed?ref=ubq323.website" style="margin-left:auto;display:block;margin-right:auto;max-width:732px;width:100%;height:12.367%;border:none;"></iframe>
+<script></script>
]]