diff options
author | dvs1 | 2025-03-16 13:33:44 +1000 |
---|---|---|
committer | dvs1 | 2025-03-16 13:33:44 +1000 |
commit | 2eaee0eba05a703234563417d674bc2e4a7b4e96 (patch) | |
tree | a6eec24d5181148921307d5d35f5cd277aa4dd8c | |
parent | Don't hide the left menu, now that it contains headings. (diff) | |
download | notYetAnotherWiki-2eaee0eba05a703234563417d674bc2e4a7b4e96.zip notYetAnotherWiki-2eaee0eba05a703234563417d674bc2e4a7b4e96.tar.gz notYetAnotherWiki-2eaee0eba05a703234563417d674bc2e4a7b4e96.tar.bz2 notYetAnotherWiki-2eaee0eba05a703234563417d674bc2e4a7b4e96.tar.xz |
Deal with complex directory trees.
Just do the simple thing, drop a file in it so it's not empty.
-rw-r--r-- | TODO.md | 8 | ||||
-rwxr-xr-x | notYetAnotherWiki.lua | 13 |
2 files changed, 13 insertions, 8 deletions
@@ -17,14 +17,6 @@ Fix up linky conversion. DONE, mostly. | |||
17 | - . Loop through the manually placed symlinks, adjusting "real URL" as we go. | 17 | - . Loop through the manually placed symlinks, adjusting "real URL" as we go. |
18 | - + What to do about mulitple symlinks pointing to the same page? Compare timestamps, most recent wins. | 18 | - + What to do about mulitple symlinks pointing to the same page? Compare timestamps, most recent wins. |
19 | 19 | ||
20 | Deal with complex directory trees. | ||
21 | |||
22 | - /testing/even should display as even/deeper on the testing page, coz even/ has no files, but even/deeper does. | ||
23 | - On the other hand, I could just create an empty page with the sub directories shown as usual. | ||
24 | - Scanning /usr/share/doc on my super desktop with looots of software installed will be fun. | ||
25 | - On the gripping hand, this is where we want empty directories to vanish. | ||
26 | - SOOOOOOO don't show empty directories, but show their subs that have content, even if that sub is deep, but as per usual stop once we find a sub on that branch. EEEEW branches. | ||
27 | |||
28 | 20 | ||
29 | ## Some ideas | 21 | ## Some ideas |
30 | 22 | ||
diff --git a/notYetAnotherWiki.lua b/notYetAnotherWiki.lua index e84e9b0..53e3682 100755 --- a/notYetAnotherWiki.lua +++ b/notYetAnotherWiki.lua | |||
@@ -430,6 +430,19 @@ for name, file in pairs(Files) do | |||
430 | end | 430 | end |
431 | end | 431 | end |
432 | 432 | ||
433 | -- Find empty subs. | ||
434 | for name, sub in pairs(Subs) do | ||
435 | if 0 == #sub.files then | ||
436 | print("EMPTY " .. name) | ||
437 | h = io.open(name .. '/index.md', 'w') | ||
438 | if nil ~= h then | ||
439 | h:write('This directory has no files.') | ||
440 | h:close() | ||
441 | else | ||
442 | print("Can't open " .. name .. '/index.md for writing.') | ||
443 | end | ||
444 | end | ||
445 | end | ||
433 | 446 | ||
434 | 447 | ||
435 | --------------------------------------------------------------------------------- | 448 | --------------------------------------------------------------------------------- |