diff options
author | Your Name <you@example.com> | 2025-01-08 07:39:16 +1100 |
---|---|---|
committer | Your Name <you@example.com> | 2025-01-08 07:39:16 +1100 |
commit | 960f00d0e57ad56c941809bc0fba2cbda0f051f2 (patch) | |
tree | 1c0427fbf7224ed6c20b372711fc67868a823071 | |
parent | 8233414683d15b55fec1e1cc2e9227acc51ede72 (diff) |
Generate title for indexes
-rw-r--r-- | README.md | 11 | ||||
-rwxr-xr-x | ds-static | 7 |
2 files changed, 18 insertions, 0 deletions
@@ -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 @@ -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]] |