Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commitedc91c4ac865585360cef43e6fb384065371b016 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-07-16 15:57:50 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-07-16 15:57:50 +0300
Filesaa84ee5bee7e7f3d2f1f6ffd6b03a0e2db964cb2
syndamia.com-edc91c4ac865585360cef43e6fb384065371b016.tar
syndamia.com-edc91c4ac865585360cef43e6fb384065371b016.tar.gz
syndamia.com-edc91c4ac865585360cef43e6fb384065371b016.zip
Parentc49d9cc8d184aed20a0766de94eb4c663c2253df (diff)
Files lists now don't need to be inside of a folder
2 files changed, 28 insertions, 3 deletions
-rwxr-xr-xgenerate-hooks/make-file-lists.sh26
-rw-r--r--src/styles.css5
diff --git a/generate-hooks/make-file-lists.sh b/generate-hooks/make-file-lists.sh
index 3952728..58a5aa2 100755
--- a/generate-hooks/make-file-lists.sh
+++ b/generate-hooks/make-file-lists.sh
@@ -5,8 +5,11 @@
# 1) You don't have to write quite as much HTML
# 2) The Data columns for each file get to be formatted as Markdown (<td> is not recognized as a block-level element, so the stuff inside get formatted https://kristaps.bsd.lv/lowdown/lowdown.5.html#HTML_Blocks)
-# Very roughly, each file list has the same structure:
+# Very roughly, each file list has either this:
# <details><summary>Folder Info</summary> <table> <tr>File Data</tr> </table> </details>
+# or this:
+# <table> <tr>File Data</tr> </table>
+# structure.
# In Markdown you type in something like (without the "# " in front):
#
@@ -22,12 +25,27 @@
# <td>Data 2.2</td>
# &&fod
#
+# or
+#
+# &&nos
+# <td>Data 1</td>
+# <td>Data 1.1</td>
+# <td>Data 1.2</td>
+# &&fs
+# <td>Data 2</td>
+# <td>Data 2.1</td>
+# <td>Data 2.2</td>
+# &&nod
+
+#
# And the lines starting with && (I'll call them ftags) get replaced by some HTML. The <td></td> around each file Data is mandatory.
# &&fs0 must only be used on before the very first file data. There must be no empty lines, lines mustn't start with spaces, there mustn't be anything around ftags and ftags have to be on their own lines.
# The commands have intuitive abbreviations:
+# &&nos no folder start
# &&fos folder start
-# &&fs0 file start of first file
+# &&fs0 file start of first file in folder
# &&fs file start
+# &&nod no folder end
# &&fod folder end
if [ -z "$1" ]; then
@@ -36,12 +54,16 @@ if [ -z "$1" ]; then
fi
for file in $(find "$1" -type f -name "*.html"); do
+ # Replaces "&&nos" with "<table class="file-list"><tr>"
+ sed -i 's/&#38;&#38;nos$/<table class="file-list"><tr>/g' "$file"
# Replaces "&&fos" with "<details class="file-wrapper"><summary>"
sed -i 's/^<p>&#38;&#38;fos$/<details class="file-wrapper"><summary>/g' "$file"
# Replaces "&&fs0" with "</summary><table class="file-list"><tr>"
sed -i 's/^&#38;&#38;fs0$/<\/summary><table class="file-list"><tr>/g' "$file"
# Replaces "&&fs" with "</tr><tr>"
sed -i 's/^&#38;&#38;fs$/<\/tr><tr>/g' "$file"
+ # Replaces "&&nod" with "</tr></table>"
+ sed -i 's/^&#38;&#38;nod<\/p>$/<\/tr><\/table>/g' "$file"
# Replaces "&&fod" with "</tr></table></details>"
sed -i 's/^&#38;&#38;fod<\/p>$/<\/tr><\/table><\/details>/g' "$file"
done
diff --git a/src/styles.css b/src/styles.css
index b6857ca..c02a31e 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -473,10 +473,13 @@ dd code {
cursor: pointer;
}
+.file-wrapper > .file-list {
+ margin-left: 1.5em;
+}
+
.file-list {
table-layout: auto;
border-collapse: collapse;
- margin-left: 1.5em;
width: auto;
}