Browse Source

among other things, wrote a tag index and improved gopher page generation

master
XeonSquared 3 weeks ago
parent
commit
d658119ea3
5 changed files with 24 additions and 2 deletions
  1. +1
    -0
      .gitignore
  2. +1
    -0
      genall.sh
  3. +1
    -1
      genpages.lua
  4. +1
    -1
      gopherblog.lua
  5. +20
    -0
      tags.lua

+ 1
- 0
.gitignore View File

@@ -2,3 +2,4 @@
/src
/static
/out
/gopher

+ 1
- 0
genall.sh View File

@@ -5,4 +5,5 @@
./home.lua
./genrss.lua
./gengopher.lua
./gopherblog.lua
./gopher-home.lua

+ 1
- 1
genpages.lua View File

@@ -3,7 +3,7 @@ local sitelib = require "sitelib"
local fs = require "lfs"

print("Copying static content...")
os.execute("cp -rv static/* out/")
os.execute("rsync -avzh --delete static/* out/")

print("Building list of markdown files")
local mdfiles = {}

+ 1
- 1
gopherblog.lua View File

@@ -29,7 +29,7 @@ for k,infile in ipairs(mdfiles) do
local page = sitelib.parsepage(c)
if page.date then page.title = string.format("%s (%s)",page.title,page.date) end
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
index=sitelib.gheader .. index .. sitelib.gfooter


+ 20
- 0
tags.lua View File

@@ -52,3 +52,23 @@ for tag,v in pairs(tags) do
f:write(sitelib.footer)
f:close()
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…
Cancel
Save