diff options
Diffstat (limited to '')
-rw-r--r-- | README | 6 | ||||
-rwxr-xr-x | SuckIt | 2 | ||||
-rwxr-xr-x | SuckItClean | 13 | ||||
-rw-r--r-- | TODO.md | 64 | ||||
-rw-r--r-- | about/index.md | 2 | ||||
-rw-r--r-- | default.template | 4 | ||||
-rwxr-xr-x | feed-icon-14x14.png | bin | 0 -> 689 bytes | |||
-rwxr-xr-x | feed-icon-28x28.png | bin | 0 -> 1737 bytes | |||
-rw-r--r-- | help.md | 43 | ||||
-rwxr-xr-x | notYetAnotherWiki.lua | 108 |
10 files changed, 191 insertions, 51 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 |
@@ -155,6 +155,8 @@ done | |||
155 | 155 | ||
156 | 156 | ||
157 | time notYetAnotherWiki.lua | 157 | time notYetAnotherWiki.lua |
158 | # No idea why yet, but needs a second run to sort out everything. Shouldn't take long anyway. | ||
159 | time notYetAnotherWiki.lua | ||
158 | 160 | ||
159 | popd | 161 | popd |
160 | } | 162 | } |
diff --git a/SuckItClean b/SuckItClean new file mode 100755 index 0000000..1b8a025 --- /dev/null +++ b/SuckItClean | |||
@@ -0,0 +1,13 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | TIMEFORMAT=" took %lR using %P%% CPU" | ||
4 | time { | ||
5 | pushd /opt/nyaw | ||
6 | |||
7 | rm -fr Foswiki/* | ||
8 | rm -fr PmWiki/* | ||
9 | rm -fr unsorted | ||
10 | rm -fr users/* | ||
11 | popd | ||
12 | ./SuckIt | ||
13 | } | ||
@@ -4,32 +4,51 @@ Make it perphekd! | |||
4 | 4 | ||
5 | ## Do these | 5 | ## Do these |
6 | 6 | ||
7 | Convert it to polygLua. | ||
8 | |||
9 | It's all a bit too fragile, fix what I can. Too many messes colliding. | ||
10 | |||
11 | Flock it. | ||
12 | |||
13 | Some sort of search system. | ||
14 | |||
15 | A member system, and edit / manage system for their pages. | ||
7 | 16 | ||
8 | Fix up linky conversion. DONE, mostly. | 17 | Fix up linky conversion. DONE, mostly. |
9 | 18 | ||
10 | - This is the "page moved" problem, but now it's "page copied" and "page linked", a generic solution might work. | ||
11 | - Rethink this, I might be going the wrong way. | ||
12 | - Need to deal with real file name versus title. Also symlink name not matching what it points to. | 19 | - Need to deal with real file name versus title. Also symlink name not matching what it points to. |
13 | - . Hmmm, might it be good policy to have a single canonical context for each page? The "real URL" .md.md thing? | ||
14 | - . Loop through the manually placed symlinks, adjusting "real URL" as we go. | ||
15 | - + What to do about mulitple symlinks pointing to the same page? Compare timestamps, most recent wins. | ||
16 | 20 | ||
17 | Add atom feed for single page. Alas cgit only seems to have ATOM feed on the whole repo, not individual files. | 21 | Use the default.template that comes with nYAW if none is availaable. |
22 | |||
23 | "collapsing headings" I guess that means click on a heading to hide / show the content under that heading. | ||
24 | |||
25 | - 🙈 | ||
26 | - Should do that for the main content and the menu TOC. | ||
27 | - Also allow editing just a section, a section being the bits between one heading and the next. | ||
28 | - + 📝 ✒️✏️🖊️🖋 🖌️🖍️ | ||
29 | - + When someone starts editing, create pagename_draft.md and .HTML, and update those when they want to see a preview. | ||
30 | - + Or pagename-heading_draft.md | ||
31 | - + Use that draft.md file as a lock on editing that file / section. | ||
32 | - + Have the hourly cron job remove any stale ones. | ||
33 | |||
34 | Add ATOM feed for single page. Alas cgit only seems to have ATOM feed on the whole repo, not individual files. | ||
18 | 35 | ||
19 | - However, once timestamps are sorted, I can use that code to generate (static?) RSS and ATOM feeds, and create page histories using diffs. | 36 | - However, once timestamps are sorted, I can use that code to generate RSS and ATOM feeds, and create page histories using diffs. |
20 | - Instead of an hourly cron job to update everything, see if I can hook | 37 | - Instead of an hourly cron job to update everything, see if I can hook |
21 | into Fos and Pm edit form's save function. So when they save in the | 38 | into Fos and Pm edit form's save function. So when they save in the |
22 | original wiki, the nyaw version gets updated, diffed, and RSSed. | 39 | original wiki, the nyaw version gets updated, diffed, and ATOMed / RSSed. |
40 | - + Actually a BFI method might do the trick, stick with doing a full scan | ||
41 | and only updating the stuff that needs it, likely that's only the page that just got saved. | ||
42 | - git commit can have an arbitrary author / committer, so I can use that to make sure the person that actually made the change gets author / committer. | ||
43 | - + There's also the email thing, but I don't want to spread email addresses around, not even sure we have them anyway. | ||
23 | - Should also see if gitea can handle that, and if they want wiki content saved to git. | 44 | - Should also see if gitea can handle that, and if they want wiki content saved to git. |
24 | 45 | ||
25 | It's all a bit too fragile, fix what I can. Too many messes colliding. | 46 | Syntax highlighting in code blocks. The highlight package looks promising, already had it installed on my desktop. |
26 | 47 | ||
27 | ## Some ideas | 48 | ## Some ideas |
28 | 49 | ||
29 | Mostly from something chomwitt deleted. | 50 | Mostly from something chomwitt wrote - |
30 | 51 | ||
31 | - "collapsing headings" I guess that means click on a heading to hide / show the content under that heading. | ||
32 | - + Should do that for the main content and the menu TOC. | ||
33 | - "validation", not sure exactly what that would validate. | 52 | - "validation", not sure exactly what that would validate. |
34 | - I'll just quote some of the rest - | 53 | - I'll just quote some of the rest - |
35 | 54 | ||
@@ -40,9 +59,8 @@ Mostly from something chomwitt deleted. | |||
40 | ** for example search-completion to other workflows names-tags. | 59 | ** for example search-completion to other workflows names-tags. |
41 | ~~~ | 60 | ~~~ |
42 | 61 | ||
43 | - Syntax highlighting in code blocks. | 62 | - Allow default.template files in sub folders. |
44 | - Might be useful to automatically convert anything looking like a URL into a linky. | 63 | - Might be useful to automatically convert anything looking like a URL into a linky. |
45 | - Allow default.template files in sub directories. | ||
46 | 64 | ||
47 | Automate symlinks. | 65 | Automate symlinks. |
48 | 66 | ||
@@ -51,16 +69,28 @@ Automate symlinks. | |||
51 | 69 | ||
52 | ## Try out | 70 | ## Try out |
53 | 71 | ||
72 | lua-lpeg-patterns might be useful | ||
73 | |||
74 | lua-luxio might be the wheel I'm reinventing? | ||
75 | |||
76 | lua-wsapi-fcgi | ||
77 | |||
54 | https://inclusive-components.design/tooltips-toggletips/ has some ideas about the "tooltip" HTML attribute, and what to do about it. A rabbit hole that ends in javascript, but might be useful up to that point. | 78 | https://inclusive-components.design/tooltips-toggletips/ has some ideas about the "tooltip" HTML attribute, and what to do about it. A rabbit hole that ends in javascript, but might be useful up to that point. |
55 | 79 | ||
56 | htmx | 80 | htmx |
57 | 81 | ||
58 | cgit has Lua | 82 | cgit has Lua |
59 | 83 | ||
84 | lua-gall for git stuff | ||
85 | |||
86 | lua-lace for access control | ||
87 | |||
88 | lua-unbound | ||
89 | |||
60 | 90 | ||
61 | ## User system | 91 | ## Member system |
62 | 92 | ||
63 | Reuse the user system from SledjChisl. | 93 | Reuse the member system from SledjChisl. |
64 | 94 | ||
65 | levels - | 95 | levels - |
66 | 96 | ||
@@ -102,6 +132,6 @@ site, including configuration and modules. Likely this is the person | |||
102 | that set the system up in the first place. | 132 | that set the system up in the first place. |
103 | 133 | ||
104 | Admin should have access to everything that shell level has, but there's always things need tweaking at some lower level. | 134 | Admin should have access to everything that shell level has, but there's always things need tweaking at some lower level. |
105 | Built in file browser might do the trick. Would be useful for content creators to to organise the content. Naturally should obey the permissions. | 135 | Built in file browser might do the trick. Would be useful for content creators to organise the content. Naturally should obey the permissions. |
106 | 136 | ||
107 | root level is whoever controls the server things are running on. They can do anything at all. | 137 | root level is whoever controls the server things are running on. They can do anything at all. |
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/default.template b/default.template index 75922ac..baefad1 100644 --- a/default.template +++ b/default.template | |||
@@ -87,14 +87,14 @@ | |||
87 | <a href="$home$"><img src="$logo$" alt="not (Yet) (Another / A) Wiki."/></a> | 87 | <a href="$home$"><img src="$logo$" alt="not (Yet) (Another / A) Wiki."/></a> |
88 | </nav></header></div> | 88 | </nav></header></div> |
89 | <div class="boxTools"><header><nav> | 89 | <div class="boxTools"><header><nav> |
90 | <b class="toolTip" title="🍔 hides / shows non content, reverse hamburger menu. | 90 | <a href="/help.HTML"><b class="toolTip" title="🍔 hides / shows non content, reverse hamburger menu. |
91 | 🕶 switches between dark and light themes. | 91 | 🕶 switches between dark and light themes. |
92 | 📚 shows the list of all pages. | 92 | 📚 shows the list of all pages. |
93 | 🔮 a folder of unsorted pages. | 93 | 🔮 a folder of unsorted pages. |
94 | 👥 shows the list of users. | 94 | 👥 shows the list of users. |
95 | 🪵 will be for logging in, when I have written that bit. | 95 | 🪵 will be for logging in, when I have written that bit. |
96 | 🔍 will be the search, when I have written that bit. | 96 | 🔍 will be the search, when I have written that bit. |
97 | 👣 is a trail of the steps to get here.">❓</b> | 97 | 👣 is a trail of the steps to get here.">❓</b></a> |
98 | <b class="toolTip"><label for="modeToggleMenu" class='modeBtn'>🍔</label></b> | 98 | <b class="toolTip"><label for="modeToggleMenu" class='modeBtn'>🍔</label></b> |
99 | <b class="toolTip"><label for="modeToggleBody" class='modeBtn'>🕶</label></b> | 99 | <b class="toolTip"><label for="modeToggleBody" class='modeBtn'>🕶</label></b> |
100 | <a href="/everything.HTML"><b class="toolTip">📚</b></a> | 100 | <a href="/everything.HTML"><b class="toolTip">📚</b></a> |
diff --git a/feed-icon-14x14.png b/feed-icon-14x14.png new file mode 100755 index 0000000..b3c949d --- /dev/null +++ b/feed-icon-14x14.png | |||
Binary files differ | |||
diff --git a/feed-icon-28x28.png b/feed-icon-28x28.png new file mode 100755 index 0000000..d64c669 --- /dev/null +++ b/feed-icon-28x28.png | |||
Binary files differ | |||
@@ -0,0 +1,43 @@ | |||
1 | # How to use this wiki | ||
2 | |||
3 | On the top left, is the logo, beside that is a toolbar of icons - | ||
4 | |||
5 | - ❓ hover over this for help. | ||
6 | - 🍔 hides or shows everything but the content and these icons, the reverse hamburger menu. | ||
7 | - 🕶 switches between dark and light themes. | ||
8 | - 📚 shows the list of all pages. | ||
9 | - 🔮 a folder of unsorted pages. | ||
10 | - 👥 shows the list of users. | ||
11 | - 🪵 will be for logging in, when I have written that bit. | ||
12 | - 🔍 will be the search, when I have written that bit. | ||
13 | |||
14 | 👣 is a trail of breadcrumbs, though I'm using a footsteps icon | ||
15 | for this. Showing the footsteps you have followed to get to the current | ||
16 | folder. | ||
17 | |||
18 | On the top right of the pages is links to the sub folders of the current | ||
19 | folder the current page is in. | ||
20 | |||
21 | Down the left side is links to the pages in the current folder. Most of | ||
22 | them will be symlinks to the converted pages from the Foswiki and PmWiki | ||
23 | sub folders. Some will be links ☝ to external sites. For the | ||
24 | current page, links to the headings are also shown, those headings have | ||
25 | their own icon 🔼to go back to the top. | ||
26 | |||
27 | The bit you are reading is the badly converted content of the current | ||
28 | page. At the bottom of each converted page is a link to the original, | ||
29 | and if you are logged into that other system, you might be able to edit | ||
30 | the page. Note that unconverted pages don't have these links to the | ||
31 | originals. | ||
32 | |||
33 | At the bottom is links to things like page history, web site source code, | ||
34 | and the software I'm writing to do all of this. Or should be some day. | ||
35 | |||
36 | |||
37 | |||
38 | # Under the hood | ||
39 | |||
40 | Internally this wiki is made of the root folder and it's sub folders | ||
41 | representing the structure of the wiki content. Each folder has it's own | ||
42 | pages. Symlinks are used to copy or move pages around, with special | ||
43 | folders for the original stuff from the other wikis. | ||
diff --git a/notYetAnotherWiki.lua b/notYetAnotherWiki.lua index c5814f3..f53691b 100755 --- a/notYetAnotherWiki.lua +++ b/notYetAnotherWiki.lua | |||
@@ -215,27 +215,51 @@ 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 | 222 | --GlobalMetaData.root = Folder | |
223 | -- Sort out realURL for symlinked .md.md files. | 223 | |
224 | for l in io.popen('find -L ' .. Directory .. ' -name unsorted -prune -o -name "*.md.md" -xtype l -printf "%P\n"'):lines() do | 224 | --[[ Sort out realURL for symlinked .md.md files. |
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. | ||
226 | realURL starts out being the path to the downloaded file and friends. | ||
227 | If we make a symlink during SuckIt, then that gets updated to point to the place the symlink is in. | ||
228 | below we compare timestamps and select the latest version if there's more than one symlink. | ||
229 | For the "page symlinked" problem, this should work if realURL is kept updated. | ||
230 | For the "page copied" problem, this should work if realURL is kept updated, same as symlinked really, coz that's just another copy. | ||
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. | ||
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. | ||
233 | A left over .md.md file should have a redirect .HTML page created for it. | ||
234 | ]] | ||
235 | for l in io.popen('find -L ' .. Folder .. ' -name unsorted -prune -o -name "*.md.md" -xtype l -printf "%P\n"'):lines() do | ||
225 | local metadata = readMdMd(string.sub(l, 1, -4), {}) | 236 | local metadata = readMdMd(string.sub(l, 1, -4), {}) |
226 | -- FIXME - if this already exists, compare the timestamps, most recent wins. | 237 | if nil == metadata.realURL then |
227 | metadata.realURL = string.sub(l, 1, -7) | 238 | metadata.realURL = string.sub(l, 1, -7) |
228 | local a, e = io.open(l, 'w') | 239 | else |
229 | if nil == a then print('Could not open ' .. l .. ' - ' .. e) else | 240 | if metadata.realURL ~= string.sub(l, 1, -7) then |
230 | for k, v in pairs(metadata) do | 241 | metadata.realURL = string.sub(l, 1, -7) |
231 | a:write(k .. '=' .. v .. '\n') | 242 | -- If this already exists, compare the timestamps, most recent wins. |
243 | local time0 = io.popen('ls -l --time-style=+%s "' .. metadata.realURL .. '.md.md" | cut -d \' \' -f 6'):read('l') | ||
244 | local time1 = io.popen('ls -l --time-style=+%s "' .. l .. '" | cut -d \' \' -f 6'):read('l') | ||
245 | if time0 > time1 then metadata = nil end | ||
246 | else metadata = nil end | ||
247 | end | ||
248 | |||
249 | if nil ~= metadata then | ||
250 | -- DUNNO if this writes to the original file, or overwrites the symlink. | ||
251 | local a, e = io.open(l, 'w') | ||
252 | if nil == a then print('Could not open ' .. l .. ' - ' .. e) else | ||
253 | for k, v in pairs(metadata) do | ||
254 | a:write(k .. '=' .. v .. '\n') | ||
255 | end | ||
256 | a:close() | ||
232 | end | 257 | end |
233 | a:close() | ||
234 | end | 258 | end |
235 | end | 259 | end |
236 | 260 | ||
237 | -- Clean up unsorted. | 261 | -- Clean up unsorted. |
238 | 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 | 262 | 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 |
239 | local tp = '_fos' | 263 | local tp = '_fos' |
240 | local metadata = readMdMd(l, {}) | 264 | local metadata = readMdMd(l, {}) |
241 | if nil ~= metadata then | 265 | if nil ~= metadata then |
@@ -245,16 +269,36 @@ for l in io.popen('find -L ' .. Directory .. ' -name unsorted -prune -o -name "* | |||
245 | local a, e = io.open(unsort .. tp .. '.md' , 'r') | 269 | local a, e = io.open(unsort .. tp .. '.md' , 'r') |
246 | if nil ~= a then | 270 | if nil ~= a then |
247 | a:close() | 271 | a:close() |
248 | os.execute('rm ' .. unsort .. tp .. '.*') | 272 | -- Keep the .md.md symlink, delete the rest. |
273 | os.execute('rm ' .. unsort .. tp .. '.HTML') | ||
274 | os.execute('rm ' .. unsort .. tp .. '.md') | ||
275 | a, e = io.open(unsort .. tp .. '.HTML', 'w') | ||
276 | if nil == a then print('Could not open ' .. unsort .. tp .. '.HTML' .. ' - ' .. e) else | ||
277 | local dst = string.sub(l, 1, -4) .. '.HTML' | ||
278 | local cnt = 1 | ||
279 | for j = 1, #metadata.ogFile do | ||
280 | if '/' == string.sub(metadata.ogFile, j, j) then cnt = cnt + 1 end | ||
281 | end | ||
282 | dst = string.rep('../', cnt) .. dst | ||
283 | a:write( | ||
284 | [=[<!DOCTYPE html> | ||
285 | <html> | ||
286 | <head><meta http-equiv="refresh" content="0; url=]=] .. dst .. '"' .. [=[/></head> | ||
287 | <body><p>Click this if you don't get redirected to the real page - <a href="]=] .. dst .. '"' .. [=[>Redirect</a></p></body> | ||
288 | </html> | ||
289 | ]=]) | ||
290 | a:close() | ||
291 | print('REDIRECT ' .. unsort .. tp .. '.HTML \t-> ' .. dst) | ||
292 | end | ||
293 | |||
249 | end | 294 | end |
250 | end | 295 | end |
251 | end | 296 | end |
252 | end | 297 | end |
253 | 298 | ||
254 | -- Look for copied pages from the other wikis. | 299 | -- Look for copied pages from the other wikis. |
255 | for l in io.popen('find -L ' .. Directory .. ' -name "*.HTM" -type f,l -printf "%P\n"'):lines() do | 300 | for l in io.popen('find -L ' .. Folder .. ' -name "*.HTM" -type f,l -printf "%P\n"'):lines() do |
256 | -- TODO - Only do this if .HTM is newer than .md, or .md doesn't exist. | 301 | -- Only do this if .HTM is newer than .md, or .md doesn't exist. |
257 | |||
258 | local htime = io.popen("date -ur " .. l .. " +%s"):read('l') | 302 | local htime = io.popen("date -ur " .. l .. " +%s"):read('l') |
259 | local mtime = io.popen("date -ur " .. string.sub(l, 1, -4) .. "md +%s 2>/dev/null"):read('l') | 303 | local mtime = io.popen("date -ur " .. string.sub(l, 1, -4) .. "md +%s 2>/dev/null"):read('l') |
260 | if (nil == mtime) or (htime > mtime) then | 304 | if (nil == mtime) or (htime > mtime) then |
@@ -404,14 +448,14 @@ writeString(l .. '_ORIGINAL1', body) | |||
404 | end | 448 | end |
405 | end | 449 | end |
406 | 450 | ||
407 | if '.' ~= Directory then | 451 | if '.' ~= Folder then |
408 | for l in io.popen('find -L . -name "*.md" -type f,l -printf "%P\n"'):lines() do | 452 | for l in io.popen('find -L . -name "*.md" -type f,l -printf "%P\n"'):lines() do |
409 | toFile(string.gsub(l, '%.md$', '')) | 453 | toFile(string.gsub(l, '%.md$', '')) |
410 | end | 454 | end |
411 | end | 455 | end |
412 | 456 | ||
413 | -- Can add in a distant directory to, for putting it's results in the current directory. | 457 | -- Can add in a distant folder to, for putting it's results in the current folder. |
414 | for l in io.popen('find -L ' .. Directory .. ' -name "*.md" -type f,l -printf "%P\n"'):lines() do | 458 | for l in io.popen('find -L ' .. Folder .. ' -name "*.md" -type f,l -printf "%P\n"'):lines() do |
415 | local n = string.gsub(l, '%.md$', '') | 459 | local n = string.gsub(l, '%.md$', '') |
416 | if nil == Files[n] then toFile(n) end | 460 | if nil == Files[n] then toFile(n) end |
417 | end | 461 | end |
@@ -472,7 +516,7 @@ for name, sub in pairs(Subs) do | |||
472 | print("EMPTY " .. name) | 516 | print("EMPTY " .. name) |
473 | h = io.open(name .. '/index.md', 'w') | 517 | h = io.open(name .. '/index.md', 'w') |
474 | if nil ~= h then | 518 | if nil ~= h then |
475 | h:write('This directory has no files.') | 519 | h:write('This folder has no files.') |
476 | h:close() | 520 | h:close() |
477 | else | 521 | else |
478 | print("Can't open " .. name .. '/index.md for writing.') | 522 | print("Can't open " .. name .. '/index.md for writing.') |
@@ -484,7 +528,7 @@ end | |||
484 | --------------------------------------------------------------------------------- | 528 | --------------------------------------------------------------------------------- |
485 | -- These functions assume the above file and sub scan has completed. | 529 | -- These functions assume the above file and sub scan has completed. |
486 | 530 | ||
487 | -- Which page in this directory should we show? | 531 | -- Which page in this folder should we show? |
488 | -- NOTE - only looking for the .md files we scanned for before, any stray HTML, html, HTM, and htm files will get ignored. | 532 | -- NOTE - only looking for the .md files we scanned for before, any stray HTML, html, HTM, and htm files will get ignored. |
489 | local whichPage = function(f) | 533 | local whichPage = function(f) |
490 | local fl = '' | 534 | local fl = '' |
@@ -527,7 +571,7 @@ local whichWiki = function(metadata) | |||
527 | end | 571 | end |
528 | 572 | ||
529 | 573 | ||
530 | -- Calculate a link from the source directory to the destination directory. | 574 | -- Calculate a link from the source folder to the destination folder. |
531 | local linkFrom = function(source, dest) | 575 | local linkFrom = function(source, dest) |
532 | -- Evil hacks! | 576 | -- Evil hacks! |
533 | if 'Profiles' == dest then dest = 'PmWiki/Profiles' end | 577 | if 'Profiles' == dest then dest = 'PmWiki/Profiles' end |
@@ -763,7 +807,7 @@ function Writer.header(s, level) | |||
763 | local text = Lunamark.util.rope_to_string(s) | 807 | local text = Lunamark.util.rope_to_string(s) |
764 | -- FIXME - Work around a bug in Lunamark? | 808 | -- FIXME - Work around a bug in Lunamark? |
765 | text = RE.gsub(text, "{[\\]}", "") | 809 | text = RE.gsub(text, "{[\\]}", "") |
766 | return '<h' .. level .. ' id="' .. RE.gsub(text, '{[ ]}', '_') .. '">' .. text .. ' <a style="font-size: 0.42em;" href="#top">👆</a></h' .. level .. '>' | 810 | return '<h' .. level .. ' id="' .. RE.gsub(text, '{[ ]}', '_') .. '">' .. text .. ' <a style="font-size: 0.42em;" href="#top">🔼</a></h' .. level .. '>' |
767 | end | 811 | end |
768 | local OgWriterLink = Writer.link -- So we can call the original from within mine, we are just changing the URL. | 812 | local OgWriterLink = Writer.link -- So we can call the original from within mine, we are just changing the URL. |
769 | function Writer.link(lab, url, tit) | 813 | function Writer.link(lab, url, tit) |
@@ -810,7 +854,7 @@ for name, file in pairs(Files) do | |||
810 | local pth = file.path | 854 | local pth = file.path |
811 | if '' ~= file.path then pth = file.path .. '/' end | 855 | if '' ~= file.path then pth = file.path .. '/' end |
812 | if 'true' ~= Subs[pth .. f].metadata.hidden then | 856 | if 'true' ~= Subs[pth .. f].metadata.hidden then |
813 | metadata.header = metadata.header .. '<a href="' .. f .. '/' .. whichPage(pth .. f) .. '">' .. f .. '</a> ' | 857 | metadata.header = metadata.header .. '<a href="' .. f .. '/' .. whichPage(pth .. f) .. '">' .. f .. '</a> 📂 ' |
814 | end | 858 | end |
815 | end | 859 | end |
816 | 860 | ||
@@ -847,7 +891,15 @@ for name, file in pairs(Files) do | |||
847 | end | 891 | end |
848 | else | 892 | else |
849 | if nil ~= url then metadata.menu = metadata.menu .. '<p><a href="' .. url .. '">' .. title .. ' ☝</a></p>' | 893 | if nil ~= url then metadata.menu = metadata.menu .. '<p><a href="' .. url .. '">' .. title .. ' ☝</a></p>' |
850 | else metadata.menu = metadata.menu .. '<p><a href="' .. f .. '.HTML">' .. title .. '</a></p>' | 894 | else |
895 | local pth = file.path | ||
896 | if '' ~= pth then pth = pth .. '/' end | ||
897 | -- Don't include any left over .md.md files, so don't do this if f.md doesn't exist. | ||
898 | local a, e = io.open(pth .. f .. '.md' , 'r') | ||
899 | if nil ~= a then | ||
900 | a:close() | ||
901 | metadata.menu = metadata.menu .. '<p><a href="' .. f .. '.HTML">' .. title .. '</a></p>' | ||
902 | end | ||
851 | end | 903 | end |
852 | end | 904 | end |
853 | end | 905 | end |
@@ -865,7 +917,7 @@ for name, file in pairs(Files) do | |||
865 | metadata.history = '' | 917 | metadata.history = '' |
866 | end | 918 | end |
867 | if nil ~= metadata.sourcecode then metadata.footer = '<a href="' .. metadata.sourcecode .. '">source code</a>' end | 919 | if nil ~= metadata.sourcecode then metadata.footer = '<a href="' .. metadata.sourcecode .. '">source code</a>' end |
868 | if nil ~= metadata.feedatom then metadata.footer = '<a href="' .. metadata.feedatom .. '">atom feed</a> ' .. metadata.footer end | 920 | if nil ~= metadata.feedatom then metadata.footer = '<a href="' .. metadata.feedatom .. '">atom feed<img src="feed-icon-14x14.png"></img></a> ' .. metadata.footer end |
869 | if metadata.footer ~= '' then metadata.footer = 'Web site ' .. metadata.footer end | 921 | if metadata.footer ~= '' then metadata.footer = 'Web site ' .. metadata.footer end |
870 | -- Add a link to the original page. | 922 | -- Add a link to the original page. |
871 | if nil ~= metadata.ogURL then | 923 | if nil ~= metadata.ogURL then |