diff options
| author | dvs1 | 2025-03-27 09:47:22 +1000 |
|---|---|---|
| committer | dvs1 | 2025-03-27 09:47:22 +1000 |
| commit | f100e861884cb261bf0598215d3e7d8aba1f3f89 (patch) | |
| tree | 218ebc3aadc8eaef91ca88860131e0fa9c24acdc | |
| parent | Add the help page, link it to the help widget. (diff) | |
| download | notYetAnotherWiki-f100e861884cb261bf0598215d3e7d8aba1f3f89.zip notYetAnotherWiki-f100e861884cb261bf0598215d3e7d8aba1f3f89.tar.gz notYetAnotherWiki-f100e861884cb261bf0598215d3e7d8aba1f3f89.tar.bz2 notYetAnotherWiki-f100e861884cb261bf0598215d3e7d8aba1f3f89.tar.xz | |
directory -> folder
Let's be consistent, now we are using a folder icon.
| -rw-r--r-- | README | 6 | ||||
| -rw-r--r-- | TODO.md | 2 | ||||
| -rw-r--r-- | about/index.md | 2 | ||||
| -rwxr-xr-x | notYetAnotherWiki.lua | 25 |
4 files changed, 18 insertions, 17 deletions
| @@ -59,13 +59,13 @@ the one system. They can chat about it, on the one system. | |||
| 59 | 59 | ||
| 60 | ## What does it do already? | 60 | ## What does it do already? |
| 61 | 61 | ||
| 62 | Currently it'll scan the current directory and subdirectories looking for | 62 | Currently it'll scan the current folder and sub folders looking for |
| 63 | .md files in CommonMark syntax. This should cover some MarkDown | 63 | .md files in CommonMark syntax. This should cover some MarkDown |
| 64 | variations. Then it produces .HTML files converted from these .md files, | 64 | variations. Then it produces .HTML files converted from these .md files, |
| 65 | and links them all together into a web site. | 65 | and links them all together into a web site. |
| 66 | 66 | ||
| 67 | Any .md file that is just the beginning metadata block doesn't get | 67 | Any .md file that is just the beginning metadata block doesn't get |
| 68 | rendered into HTML, but is global metadata for this directory and subs, | 68 | rendered into HTML, but is global metadata for this folder and subs, |
| 69 | though the subs can override this with their own metadata.md files. | 69 | though the subs can override this with their own metadata.md files. |
| 70 | 70 | ||
| 71 | git is used to store the .md files, and provides edit history. Added on | 71 | git is used to store the .md files, and provides edit history. Added on |
| @@ -73,7 +73,7 @@ the footer is links to cgit, which is used to store the files in git on | |||
| 73 | your server. This provides acces to the source code, history, and ATOM | 73 | your server. This provides acces to the source code, history, and ATOM |
| 74 | feed for the site. | 74 | feed for the site. |
| 75 | 75 | ||
| 76 | It can also scan an external directory and merge that with the current | 76 | It can also scan an external folder and merge that with the current |
| 77 | one, but this isn't tested yet. | 77 | one, but this isn't tested yet. |
| 78 | 78 | ||
| 79 | ## other stuff | 79 | ## other stuff |
| @@ -37,7 +37,7 @@ Mostly from something chomwitt deleted. | |||
| 37 | ~~~ | 37 | ~~~ |
| 38 | 38 | ||
| 39 | - Syntax highlighting in code blocks. | 39 | - Syntax highlighting in code blocks. |
| 40 | - Allow default.template files in sub directories. | 40 | - Allow default.template files in sub folders. |
| 41 | - Might be useful to automatically convert anything looking like a URL into a linky. | 41 | - Might be useful to automatically convert anything looking like a URL into a linky. |
| 42 | 42 | ||
| 43 | Automate symlinks. | 43 | Automate symlinks. |
diff --git a/about/index.md b/about/index.md index 6086d85..3f15be7 100644 --- a/about/index.md +++ b/about/index.md | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | # notYetAnotherWiki is not another wiki, at least not yet. It'll be much more than that, eventually. | 1 | # notYetAnotherWiki is not another wiki, at least not yet. It'll be much more than that, eventually. |
| 2 | 2 | ||
| 3 | This is a new directory, an entire PR department can hang out here. | 3 | This is a new folder, an entire PR department can hang out here. |
| 4 | 4 | ||
| 5 | This would just be a duplicate of README, but for testing purposes. | 5 | This would just be a duplicate of README, but for testing purposes. |
diff --git a/notYetAnotherWiki.lua b/notYetAnotherWiki.lua index f12547a..0883d87 100755 --- a/notYetAnotherWiki.lua +++ b/notYetAnotherWiki.lua | |||
| @@ -215,10 +215,11 @@ else | |||
| 215 | print("Can't open everything.md for writing.") | 215 | print("Can't open everything.md for writing.") |
| 216 | end | 216 | end |
| 217 | 217 | ||
| 218 | -- Scan the subdirectories looking for our files. | 218 | -- Scan the sub folders looking for our files. |
| 219 | local Directory = arg[1] | 219 | local Folder = arg[1] |
| 220 | toSub('') | 220 | toSub('') |
| 221 | if nil == Directory then Directory = '.' end | 221 | if nil == Folder then Folder = '.' end |
| 222 | --GlobalMetaData.root = Folder | ||
| 222 | 223 | ||
| 223 | --[[ Sort out realURL for symlinked .md.md files. | 224 | --[[ Sort out realURL for symlinked .md.md files. |
| 224 | realURL is the generic URL part for this page. By policy it points to whatever is the latest copy / symlink of the original download .md.md. | 225 | realURL is the generic URL part for this page. By policy it points to whatever is the latest copy / symlink of the original download .md.md. |
| @@ -230,7 +231,7 @@ if nil == Directory then Directory = '.' end | |||
| 230 | For the "page moved" problem, that'll be the most recent symlink, the old one still has it's symlink pointing to the download .md.md, which gets updated with the current realURL. | 231 | For the "page moved" problem, that'll be the most recent symlink, the old one still has it's symlink pointing to the download .md.md, which gets updated with the current realURL. |
| 231 | So when some external old URL points to someplace a page used to be, it's old symlink points to the up to date download .md.md, and we know where to go to find the page now. | 232 | So when some external old URL points to someplace a page used to be, it's old symlink points to the up to date download .md.md, and we know where to go to find the page now. |
| 232 | ]] | 233 | ]] |
| 233 | for l in io.popen('find -L ' .. Directory .. ' -name unsorted -prune -o -name "*.md.md" -xtype l -printf "%P\n"'):lines() do | 234 | for l in io.popen('find -L ' .. Folder .. ' -name unsorted -prune -o -name "*.md.md" -xtype l -printf "%P\n"'):lines() do |
| 234 | local metadata = readMdMd(string.sub(l, 1, -4), {}) | 235 | local metadata = readMdMd(string.sub(l, 1, -4), {}) |
| 235 | if nil == metadata.realURL then | 236 | if nil == metadata.realURL then |
| 236 | metadata.realURL = string.sub(l, 1, -7) | 237 | metadata.realURL = string.sub(l, 1, -7) |
| @@ -256,7 +257,7 @@ for l in io.popen('find -L ' .. Directory .. ' -name unsorted -prune -o -name "* | |||
| 256 | end | 257 | end |
| 257 | 258 | ||
| 258 | -- Clean up unsorted. | 259 | -- Clean up unsorted. |
| 259 | for l in io.popen('find -L ' .. Directory .. ' -name unsorted -prune -o -name "*.md" -a -not -name "*.md.md" -xtype l -printf "%P\n"'):lines() do | 260 | for l in io.popen('find -L ' .. Folder .. ' -name unsorted -prune -o -name "*.md" -a -not -name "*.md.md" -xtype l -printf "%P\n"'):lines() do |
| 260 | local tp = '_fos' | 261 | local tp = '_fos' |
| 261 | local metadata = readMdMd(l, {}) | 262 | local metadata = readMdMd(l, {}) |
| 262 | if nil ~= metadata then | 263 | if nil ~= metadata then |
| @@ -273,7 +274,7 @@ for l in io.popen('find -L ' .. Directory .. ' -name unsorted -prune -o -name "* | |||
| 273 | end | 274 | end |
| 274 | 275 | ||
| 275 | -- Look for copied pages from the other wikis. | 276 | -- Look for copied pages from the other wikis. |
| 276 | for l in io.popen('find -L ' .. Directory .. ' -name "*.HTM" -type f,l -printf "%P\n"'):lines() do | 277 | for l in io.popen('find -L ' .. Folder .. ' -name "*.HTM" -type f,l -printf "%P\n"'):lines() do |
| 277 | -- Only do this if .HTM is newer than .md, or .md doesn't exist. | 278 | -- Only do this if .HTM is newer than .md, or .md doesn't exist. |
| 278 | local htime = io.popen("date -ur " .. l .. " +%s"):read('l') | 279 | local htime = io.popen("date -ur " .. l .. " +%s"):read('l') |
| 279 | local mtime = io.popen("date -ur " .. string.sub(l, 1, -4) .. "md +%s 2>/dev/null"):read('l') | 280 | local mtime = io.popen("date -ur " .. string.sub(l, 1, -4) .. "md +%s 2>/dev/null"):read('l') |
| @@ -424,14 +425,14 @@ writeString(l .. '_ORIGINAL1', body) | |||
| 424 | end | 425 | end |
| 425 | end | 426 | end |
| 426 | 427 | ||
| 427 | if '.' ~= Directory then | 428 | if '.' ~= Folder then |
| 428 | for l in io.popen('find -L . -name "*.md" -type f,l -printf "%P\n"'):lines() do | 429 | for l in io.popen('find -L . -name "*.md" -type f,l -printf "%P\n"'):lines() do |
| 429 | toFile(string.gsub(l, '%.md$', '')) | 430 | toFile(string.gsub(l, '%.md$', '')) |
| 430 | end | 431 | end |
| 431 | end | 432 | end |
| 432 | 433 | ||
| 433 | -- Can add in a distant directory to, for putting it's results in the current directory. | 434 | -- Can add in a distant folder to, for putting it's results in the current folder. |
| 434 | for l in io.popen('find -L ' .. Directory .. ' -name "*.md" -type f,l -printf "%P\n"'):lines() do | 435 | for l in io.popen('find -L ' .. Folder .. ' -name "*.md" -type f,l -printf "%P\n"'):lines() do |
| 435 | local n = string.gsub(l, '%.md$', '') | 436 | local n = string.gsub(l, '%.md$', '') |
| 436 | if nil == Files[n] then toFile(n) end | 437 | if nil == Files[n] then toFile(n) end |
| 437 | end | 438 | end |
| @@ -492,7 +493,7 @@ for name, sub in pairs(Subs) do | |||
| 492 | print("EMPTY " .. name) | 493 | print("EMPTY " .. name) |
| 493 | h = io.open(name .. '/index.md', 'w') | 494 | h = io.open(name .. '/index.md', 'w') |
| 494 | if nil ~= h then | 495 | if nil ~= h then |
| 495 | h:write('This directory has no files.') | 496 | h:write('This folder has no files.') |
| 496 | h:close() | 497 | h:close() |
| 497 | else | 498 | else |
| 498 | print("Can't open " .. name .. '/index.md for writing.') | 499 | print("Can't open " .. name .. '/index.md for writing.') |
| @@ -504,7 +505,7 @@ end | |||
| 504 | --------------------------------------------------------------------------------- | 505 | --------------------------------------------------------------------------------- |
| 505 | -- These functions assume the above file and sub scan has completed. | 506 | -- These functions assume the above file and sub scan has completed. |
| 506 | 507 | ||
| 507 | -- Which page in this directory should we show? | 508 | -- Which page in this folder should we show? |
| 508 | -- NOTE - only looking for the .md files we scanned for before, any stray HTML, html, HTM, and htm files will get ignored. | 509 | -- NOTE - only looking for the .md files we scanned for before, any stray HTML, html, HTM, and htm files will get ignored. |
| 509 | local whichPage = function(f) | 510 | local whichPage = function(f) |
| 510 | local fl = '' | 511 | local fl = '' |
| @@ -547,7 +548,7 @@ local whichWiki = function(metadata) | |||
| 547 | end | 548 | end |
| 548 | 549 | ||
| 549 | 550 | ||
| 550 | -- Calculate a link from the source directory to the destination directory. | 551 | -- Calculate a link from the source folder to the destination folder. |
| 551 | local linkFrom = function(source, dest) | 552 | local linkFrom = function(source, dest) |
| 552 | -- Evil hacks! | 553 | -- Evil hacks! |
| 553 | if 'Profiles' == dest then dest = 'PmWiki/Profiles' end | 554 | if 'Profiles' == dest then dest = 'PmWiki/Profiles' end |
