From 960f00d0e57ad56c941809bc0fba2cbda0f051f2 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 8 Jan 2025 07:39:16 +1100 Subject: Generate title for indexes --- README.md | 11 +++++++++++ ds-static | 7 +++++++ 2 files changed, 18 insertions(+) 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 ``. 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 ] { + dict append variables \ + [string totitle \ + [string map [list "-" " " "_" " "] [file tail [pwd]]]] + } + ## Replace variables. set content [string map $variables [string map $::replacement $content]] -- cgit v1.2.3