Summary Files Commits Branches @commit @diff @stats
path: root / generate-hooks / create-file-lists.awk
diff options
context:
space:
mode:
Commitc0b46180d7fb80e02ede355e25b1335df8a39347 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-09-29 15:07:07 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-09-29 17:40:10 +0300
Filesd3006c5e167a08d92504916032241aa9ff050fa6 /generate-hooks/create-file-lists.awk
syndamia.com-c0b46180d7fb80e02ede355e25b1335df8a39347.tar
syndamia.com-c0b46180d7fb80e02ede355e25b1335df8a39347.tar.gz
syndamia.com-c0b46180d7fb80e02ede355e25b1335df8a39347.zip
Parente16a00653ea1d7fcd588cfafe540f98c905839dd (diff)
[hooks] Updated and reformatted documentation for everything in hooks, including README
1 files changed, 79 insertions, 41 deletions
-rw-r--r--generate-hooks/create-file-lists.awk120
diff --git a/generate-hooks/create-file-lists.awk b/generate-hooks/create-file-lists.awk
index 113bca6..7d18bdd 100644
--- a/generate-hooks/create-file-lists.awk
+++ b/generate-hooks/create-file-lists.awk
@@ -1,55 +1,93 @@
-# This is a really rudementary way to make making file lists less HTML-y
-# I made it so:
-# 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 either this:
-# <details><summary>Folder Info</summary> <table> <tr>File Data</tr> </table> </details>
-# or this:
-# <table> <tr>File Data</tr> </table>
-# structure, the difference being that in the first, all of the files are in a folder.
+#
+# == About ==
+#
+# Each file list is a "details" element, that contains a table, each row being a different file
+# or alternatively, just the table on it's own.
+#
+# -- Result HTML --
+#
+# <details>
+# <summary>Folder Info</summary>
+# <table>
+# <tr>File Data</tr>
+# </table>
+# </details>
+# or
+# <table>
+# <tr>File Data</tr>
+# </table>
-# In Markdown you type in something like (without the "# " in front):
#
-# &&fos
-# Description
-# &&file0
-# <td>Data 1</td>
-# <td>Data 1.1</td>
-# <td>Data 1.2</td>
+# == ftags ==
+#
+# &&folder The text right afterwards is the title of the folder. All files
+# are hidden inside the collapsed details tag (click to show).
+# The file table is indented. You cannot have a folder inside a folder.
+# It can be omitted, and the files table will be shown as-is.
+#
+# &&file Everything that follows this tag is the data for a file. You should
+# use &&fd to specify columns of information! Depending on the context,
+# it might be replaced with the start of a table, closing the summary
+# and starting table, or closing and opening a table row.
+#
+# &&/files This tag must exist at the bottom of a file list, no matter if it was
+# started with or without a &&folder.
+#
+# &&fd Defines a column of information for a file (row). Practically, it is
+# replaced with <td>, and </td> is added to the end of the line.
+# If you don't use it, make sure to have the leading and trailing td tags!
+#
+# &&ft-TYPE Depending on TYPE, it inserts an image tag that contains the file "icon"
+# for the corresponding type.
+# Available values for TYPE: photo, text, zip, movie, markdown
+#
+# -- Placement/Flow --
+#
+# All ftags, except &&fd, can be placed on their own line (empty line above and below)
+# or before/after another ftag.
+# Folder title must be inside the same paragraph as the ftag itself. This means that,
+# after
+# every &&folder ftag, the text can continue directly next to it and/or on new lines,
+# without there being any empty lines (you can add those with <br> or two spaces at
+# line end).
+#
+# -- Example Usage --
+#
+# (I like to indent a bit &&fd ftags, for readability's sake, but you don't have to)
+#
# &&file
-# <td>Data 2</td>
-# <td>Data 2.1</td>
-# <td>Data 2.2</td>
-# &&fod
+# &&ft-text
+# &&fd Notes
+# &&fd 10 KB
+# &&/files
#
-# or
+# &&folder Math
+# &&file
+# &&ft-text
+# &&fd Homework 1
+# &&file
+# &&ft-text
+# &&fd Homework 2
+# &&/files
+#
+# &&folder Art Project<br>
+# Status: 70% complete<br>
+# Note: Reserach Van Gogh paintings
#
-# &&nos
-# <td>Data 1</td>
-# <td>Data 1.1</td>
-# <td>Data 1.2</td>
# &&file
-# <td>Data 2</td>
-# <td>Data 2.1</td>
-# <td>Data 2.2</td>
-# &&nod
-
+# &&fd Painting 1
+# &&fd 100% Complete
+#
+# &&file
+# &&fd Painting 2
+# &&fd 40% Complete
#
-# And the lines starting with && (I'll call them ftags) get replaced by some HTML. The <td></td> around each file Data is mandatory.
-# &&file0 must only be used on before the very first file data, when files are in a folder. 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 fairly intuitive abbreviations:
-# &&nos no folder start (start file list, without making a folder)
-# &&fos folder start
-# &&file0 file start of first file in folder (must only be used when items are in a folder!)
-# &&file file start
-# &&nod no folder end (end file list, without having made a folder)
-# &&fod folder end
+# &&/files
BEGIN {
fileStarted = 0
noFolder = 1
- searchEndP = 0
+ searchEndP = 0 # Used to remove trailing </p> in file row
# Special formatting
nam[1] = "folder"