From b3d558481cbddc40327127f87c28ae4d14eb6521 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Tue, 15 Nov 2022 02:50:09 +0000 Subject: conte nt --- autobuild.sh | 2 ++ bg.png | Bin 0 -> 100 bytes build.sh | 5 +++ h.lua | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ head.html | 18 +++++++++++ index2.lua | 51 ++++++++++++++++++++++++++++++ me.png | Bin 0 -> 6326 bytes 7 files changed, 178 insertions(+) create mode 100755 autobuild.sh create mode 100644 bg.png create mode 100755 build.sh create mode 100644 h.lua create mode 100644 head.html create mode 100644 index2.lua create mode 100644 me.png diff --git a/autobuild.sh b/autobuild.sh new file mode 100755 index 0000000..4c3d3e7 --- /dev/null +++ b/autobuild.sh @@ -0,0 +1,2 @@ +#!/bin/sh +while sleep 1; do find . | entr -d ./build.sh out; done diff --git a/bg.png b/bg.png new file mode 100644 index 0000000..d35576e Binary files /dev/null and b/bg.png differ diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..f769b2f --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +# this will become more advanced later +date +lua index2.lua >index2.html diff --git a/h.lua b/h.lua new file mode 100644 index 0000000..b36c855 --- /dev/null +++ b/h.lua @@ -0,0 +1,102 @@ +-- possible things that thing can be: +-- string: gets escaped +-- safe-str: returned as is +-- table list: concatentated +-- tag: printified + + +-- maths +local el=math.exp(-4.79) +function blorem() local o={} for i=1,math.random(25,150) do local i,u=0,1 repeat i=i+1 u=u*math.random() until u"..bf..""):format(tag.tname,a,html(tag.body),tag.tname) +end + +function tag(tname, a1, a2) + 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}) +end + +function safe(s) + -- marks s as safe, doesn't escape it + assert(type(s) == "string","can only mark string as safe") + return setmetatable({safe=true,s=s},{__tostring=function(x)return x.s end}) +end + +function escape(s) + s=s:gsub("&","&") + s=s:gsub("<","<") + s=s:gsub(">",">") + s=s:gsub('"',""") + return safe(s) +end + + +function html(x) + if type(x) == "string" then + return escape(x) + elseif type(x) == "table" then + if x.safe then + -- safestr. already escaped + return x + elseif x.tag then + -- it's a tag + return safe( tostring(x) ) + else + -- just a regular list + local o = "" + for _,item in ipairs(x) do + o = o .. tostring(html(item)) .. "\n" + end + return safe(o) + end + end +end + +function tagfn(tname) + return function(a1,a2) return tag(tname,a1,a2) end +end +function qw(s) + local t = {} + 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" +for _,n in ipairs(tnames) do + _G[n] = tagfn(n) +end +function a(b,href) return tag("a",{href=href},b) end + +function readf(fname) + local f = io.open(fname,"r") + local c = f:read("a") + f:close() + return c +end +function safereadf(fname) return safe(readf(fname)) end diff --git a/head.html b/head.html new file mode 100644 index 0000000..d3c2d34 --- /dev/null +++ b/head.html @@ -0,0 +1,18 @@ + + + + + diff --git a/index2.lua b/index2.lua new file mode 100644 index 0000000..afb653a --- /dev/null +++ b/index2.lua @@ -0,0 +1,51 @@ +require"h" + +head ={ safereadf "head.html", tag("title","ubq323's website") } +top = header { + tag("img",{id="me",src="me.png"},""), + h1 "ubq323's website", + p [[rebecca, "ubq323" (she/her, 20) - eminently engromulent]], +} + +function l(text,path) return li(a(text,path or "/"..text)) end +mainsect = section { + p [[hello, i am rebecca, and this is my website. on it are some things:]]; + ul { + l(",flappy fly bird man?","/ffbm"); + l "morrison"; + li "blog"; + li "microblog"; + l("apioforum","//a.gh0.pw"); + l("ubq323 git","//g.gh0.pw"); + l("some music","//ubq323.bandcamp.com"); + li "projects"; + }; + p [[(if a link is missing, it is because i haven't created that thing yet)]] +} + + + +contact = section { + h2 "contact"; + + p "i enjoy it when people contact me. if you are cool, please contact me."; + ul { + li [[email: ubq323@ubq323.website]], + li [[xmpp: ubq323@ubq323.website]], + li { [[irc: ubq323 on ]], a("apionet","irc:ubq323.website/#a") }, + li [[discord (if you must): ubq323#9691]], + }, +} +footer = safe [[ +
+ + + + + +]] + + +print(html{ + head, top, mainsect, things, contact, footer +}) diff --git a/me.png b/me.png new file mode 100644 index 0000000..d213c65 Binary files /dev/null and b/me.png differ -- cgit v1.2.3