summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYour Name <you@example.com>2025-01-08 07:39:16 +1100
committerYour Name <you@example.com>2025-01-08 07:39:16 +1100
commit960f00d0e57ad56c941809bc0fba2cbda0f051f2 (patch)
tree1c0427fbf7224ed6c20b372711fc67868a823071
parent8233414683d15b55fec1e1cc2e9227acc51ede72 (diff)
Generate title for indexes
-rw-r--r--README.md11
-rwxr-xr-xds-static7
2 files changed, 18 insertions, 0 deletions
diff --git a/README.md b/README.md
index 7ff4918..95cdfdc 100644
--- a/README.md
+++ b/README.md
@@ -91,3 +91,14 @@ Document Variables are of the form `<!-- key: value -->`. The case and whitespac
In either a Markdown or a HTML document, the user can include these for certain parameters they wish to configure, such as title, subtitle, author, or other document metadata.
Two pieces of metadata are automatically generated; *date* which is the last modified date, and *filename* which is the relative address.
+
+
+## Errors
+
+Some errors the user may come across and what they mean.
+
+ child process exited abnormally
+ while executing
+ "exec ls -t | grep -v ~$ | grep -v index.html"
+
+Likely you have no other files to process besides index.html
diff --git a/ds-static b/ds-static
index 59b8efb..1b10e8a 100755
--- a/ds-static
+++ b/ds-static
@@ -125,6 +125,13 @@ proc process-tags {base_template content variables} {
set content [string map $::templates $content]
}
+ ## Generate a title if it does not exist from the directory name.
+ if ![dict exists $variables <!--title-->] {
+ dict append variables <!--title--> \
+ [string totitle \
+ [string map [list "-" " " "_" " "] [file tail [pwd]]]]
+ }
+
## Replace variables.
set content [string map $variables [string map $::replacement $content]]