among other things, wrote a tag index and improved gopher page generation
This commit is contained in:
parent
47ef6350fd
commit
d658119ea3
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
|||||||
/src
|
/src
|
||||||
/static
|
/static
|
||||||
/out
|
/out
|
||||||
|
/gopher
|
||||||
|
@ -5,4 +5,5 @@
|
|||||||
./home.lua
|
./home.lua
|
||||||
./genrss.lua
|
./genrss.lua
|
||||||
./gengopher.lua
|
./gengopher.lua
|
||||||
|
./gopherblog.lua
|
||||||
./gopher-home.lua
|
./gopher-home.lua
|
||||||
|
@ -3,7 +3,7 @@ local sitelib = require "sitelib"
|
|||||||
local fs = require "lfs"
|
local fs = require "lfs"
|
||||||
|
|
||||||
print("Copying static content...")
|
print("Copying static content...")
|
||||||
os.execute("cp -rv static/* out/")
|
os.execute("rsync -avzh --delete static/* out/")
|
||||||
|
|
||||||
print("Building list of markdown files")
|
print("Building list of markdown files")
|
||||||
local mdfiles = {}
|
local mdfiles = {}
|
||||||
|
@ -29,7 +29,7 @@ for k,infile in ipairs(mdfiles) do
|
|||||||
local page = sitelib.parsepage(c)
|
local page = sitelib.parsepage(c)
|
||||||
if page.date then page.title = string.format("%s (%s)",page.title,page.date) end
|
if page.date then page.title = string.format("%s (%s)",page.title,page.date) end
|
||||||
local fline = page.md:match("\n\n(.-)\n")
|
local fline = page.md:match("\n\n(.-)\n")
|
||||||
index = string.format("0%s\t%s\t%s\t%d\ni%s\n%s",page.title,fpath,sitelib.hostname,sitelib.gopherport,fline,index)
|
index = string.format("0%s\t%s\t%s\t%d\ni%s\ni\n%s",page.title,fpath,sitelib.hostname,sitelib.gopherport,fline,index)
|
||||||
end
|
end
|
||||||
index=sitelib.gheader .. index .. sitelib.gfooter
|
index=sitelib.gheader .. index .. sitelib.gfooter
|
||||||
|
|
||||||
|
20
tags.lua
20
tags.lua
@ -52,3 +52,23 @@ for tag,v in pairs(tags) do
|
|||||||
f:write(sitelib.footer)
|
f:write(sitelib.footer)
|
||||||
f:close()
|
f:close()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
print("Writing overall tag index...")
|
||||||
|
local ti = {}
|
||||||
|
for tag, v in pairs(tags) do
|
||||||
|
ti[#ti+1] = tag
|
||||||
|
end
|
||||||
|
table.sort(ti)
|
||||||
|
local f = io.open(sitelib.outpath.."/tag/index.html","wb")
|
||||||
|
f:write("<html><head><title>Tag Index</title>\n")
|
||||||
|
f:write(sitelib.header)
|
||||||
|
f:write("<h1>Tag index</h1>\n")
|
||||||
|
for k,v in pairs(ti) do
|
||||||
|
if #tags[v] > 1 then
|
||||||
|
f:write("<h3><a href=\""..v..".html\">"..v.."</a> ("..#tags[v].." entries)</h3>\n")
|
||||||
|
else
|
||||||
|
f:write("<h3><a href=\""..v..".html\">"..v.."</a> ("..#tags[v].." entry)</h3>\n")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
f:write(sitelib.footer)
|
||||||
|
f:close()
|
||||||
|
Loading…
Reference in New Issue
Block a user