From 5358e5164e29aee379e58c2408110caf78eb8fd8 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Sat, 15 Apr 2023 04:11:20 +0100 Subject: bloggous things. infrastructure. --- blog/test-post.lua | 27 +++++++++++++++++++++++++++ build.sh | 3 +-- h.lua | 45 ++++++++++++++++++++++++++++----------------- head.html | 7 ++++--- 4 files changed, 60 insertions(+), 22 deletions(-) create mode 100644 blog/test-post.lua diff --git a/blog/test-post.lua b/blog/test-post.lua new file mode 100644 index 0000000..c6cbd84 --- /dev/null +++ b/blog/test-post.lua @@ -0,0 +1,27 @@ +require'h' + +head = mkhead'reblogcca' + + + +top = header { + img({id='me',src='/me.png'},''), + h1 'rebecca blog', + p [[ there is some text here ]], +} + +breadcrumbs = bcrumb { + + {'< home','/'}, + {'rebecca blog','/blog'}, + {'what do i mean by "telephone"'} +} + +sect = section { + h2 'what do i mean by "telephone"'; + p(blorem()); +} + +print(html{ + head, top, breadcrumbs, sect, +}) diff --git a/build.sh b/build.sh index fd17047..03ce4db 100755 --- a/build.sh +++ b/build.sh @@ -32,11 +32,10 @@ md () { } bpn index -#cf icons cf bg.png cf me.png md blog/ -bpn blog/first_post +bpn blog/test-post cf 4d.html diff --git a/h.lua b/h.lua index 5c62e66..16ccb21 100644 --- a/h.lua +++ b/h.lua @@ -88,7 +88,7 @@ function qw(s) for a in s:gmatch("%w+") do table.insert(t,a) end return t end -local tnames = qw"h1 h2 p b ul li dl dt dd div section header figure figcaption img title" +local tnames = qw"h1 h2 p b ul ol li dl dt dd div section header figure figcaption img title nav" for _,n in ipairs(tnames) do _G[n] = tagfn(n) end @@ -110,22 +110,33 @@ function mkhead(t) } end --- the box at the top with the cool picture of me in, etc --- presumably the same on all pages -site_top = header { - img({id="me",src="/me.png"},""), - h1 "ubq323's website", - p [[rebecca, "ubq323" (she/her, 20) - eminently engromulent]], -} +function mktopbox(imgsrc,name,rest) + return header { + img({id='me',src=imgsrc},''), + h1(name), + rest + } +end +function bcrumb(items) + -- items are {text,href} + local lis = {} + for _,it in ipairs(items) do + if it[2] then + table.insert(lis, li(a(it[1],it[2]))) + else + table.insert(lis,li(it[1])) + end + end + return nav( + {class='breadcrumb',['aria-label']='Breadcrumb'}, + ol(lis) + ) +end -function blogpost(meta, content) - -- creates a whole page +-- the box at the top with the cool picture of me in, etc +-- presumably the same on all pages +site_top = mktopbox('/me.png',"ubq323's website", + p [[rebecca, "ubq323" (she/her, 20) - eminently engromulent]] +) - return { - mkhead(meta.title), - site_top, - section(content), - -- maybe footer? - } -end diff --git a/head.html b/head.html index d3c2d34..ef35088 100644 --- a/head.html +++ b/head.html @@ -12,7 +12,8 @@ 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} - -#things {display:flex} -#things div {flex:1;border:1px solid black} +.breadcrumb {font-size:smaller;} +.breadcrumb ol {list-style:none;padding-left:1em} +.breadcrumb li {display:inline;} +.breadcrumb li+li::before {content:"|\00a0";padding:4px;} -- cgit v1.2.3