updated readme

This commit is contained in:
matthias@arch 2022-12-16 05:17:28 +01:00
parent b89699022e
commit 88be8de773

View File

@ -37,15 +37,16 @@ refer to the article [on my website](https://quintern.xyz/en/software/buwuma.htm
- If a command-comment takes up a whole line, the whole line including the newline character is replaced. - If a command-comment takes up a whole line, the whole line including the newline character is replaced.
---
## Commands ## Commands
### include ### include
Include the content of a file at the position of the command. Include the content of a file at the position of the command.
**Synopsis**: **Synopsis**:
`<!-- #include path/to-a-text-file.html -->` `<!-- #include path/to-a-text-file.html -->`
**Argument**: **Argument**:
A absolute or relative path to a text file A absolute or relative path to a text file
**Return Value**: **Return Value**:
The content of the file or `<!-- Could not include '{args}' -->` empty string if the file can not be opened. The content of the file or `<!-- Could not include '{args}' -->` empty string if the file can not be opened.
@ -53,13 +54,17 @@ The content of the file or `<!-- Could not include '{args}' -->` empty string if
### set ### set
Set the value of a variable Set the value of a variable
**Synopsis**: **Synopsis**:
Set the value of `varname` to `this is the value`: Set the value of `varname` to `this is the value`:
`<!-- #set varname this is the value -->` `<!-- #set varname this is the value -->`
Set the value of `varname` depending on the value of `othervar`: Set the value of `varname` depending on the value of `othervar`:
`<!-- #set varname othervar?{*:fallback,key1:val1,key2:val2...}>` `<!-- #set varname othervar?{*:fallback,key1:val1,key2:val2...}>`
**Argument**: **Argument**:
The first word is the name of the variable, the rest is the value or a dictionary. The first word is the name of the variable, the rest is the value or a dictionary.
**Return Value**: **Return Value**:
Empty string Empty string
You can make the value of `varname` dependant on the value of another variable `othervar` by using a dictionary-like syntax described above. You can make the value of `varname` dependant on the value of another variable `othervar` by using a dictionary-like syntax described above.
@ -74,10 +79,13 @@ Same as `set`, but it sets the variable's value only if it has no value yet.
### comment ### comment
Comment the arguemnts. Comment the arguemnts.
**Synopsis**: **Synopsis**:
`<!-- #comment This will stay as comment in the html -->` `<!-- #comment This will stay as comment in the html -->`
**Argument**: **Argument**:
Any string Any string
**Return Value**: **Return Value**:
The argument in comment tags The argument in comment tags
This can be useful in multiline comments that contain other commands: In that case, the comment tags will be removed and each command replaced with This can be useful in multiline comments that contain other commands: In that case, the comment tags will be removed and each command replaced with
@ -85,10 +93,13 @@ its return value, so if you want to just have commented text in there you can us
### uncomment ### uncomment
Uncomment the comment. Uncomment the comment.
**Synopsis**: **Synopsis**:
`<!-- #uncomment This will not be commented -->` `<!-- #uncomment This will not be commented -->`
**Argument**: **Argument**:
Any string Any string
**Return Value**: **Return Value**:
The argument The argument
This can be useful when you want to look at the unprocessed html without variables or when your syntax highlighting gets confused by a variable. This can be useful when you want to look at the unprocessed html without variables or when your syntax highlighting gets confused by a variable.
@ -98,37 +109,47 @@ This can be useful when you want to look at the unprocessed html without variabl
### sidenav ### sidenav
Manage the generation of a content menu which contains links to all headings in your html that have an id. The menu is called sidenav here. Manage the generation of a content menu which contains links to all headings in your html that have an id. The menu is called sidenav here.
An entry is a html heading with a id: `<h1 id=myheading>This heading will be linked in the sidenav</h1>` An entry is a html heading with a id: `<h1 id=myheading>This heading will be linked in the sidenav</h1>`
**Synopsis**: **Synopsis**:
`<!-- #sidenav sidenav-command arguments -->` `<!-- #sidenav sidenav-command arguments -->`
sidenav-command must be one of the following: sidenav-command must be one of the following:
#### `include` #### `include`
Include the generated sidenav at this position. Include the generated sidenav at this position.
**Argument**: **Argument**:
Ignored Ignored
**Return Value**: **Return Value**:
The generated sidenav The generated sidenav
#### `section` #### `section`
Group all following entries in named section. Group all following entries in named section.
**Argument**: **Argument**:
The name of the section The name of the section
**Return Value** **Return Value**
Empty string Empty string
#### `name` #### `name`
Use a custom name instead of the heading itself for the link to the next heading. Use a custom name instead of the heading itself for the link to the next heading.
**Argument**: **Argument**:
The link-name of the next heading The link-name of the next heading
**Return Value**: **Return Value**:
Empty string Empty string
#### `custom` #### `custom`
Include a custom link in the sidenav. Include a custom link in the sidenav.
**Synopsis**: **Synopsis**:
`<!-- #sidenav custom href="my-link" name="Go to my link!" -->` `<!-- #sidenav custom href="my-link" name="Go to my link!" -->`
**Argument**: **Argument**:
Must be `href="..." name="..."`. Either single `'` or double `"` quotes are required. Must be `href="..." name="..."`. Either single `'` or double `"` quotes are required.
**Return Value**: **Return Value**:
Empty string Empty string
@ -136,5 +157,5 @@ Empty string
## Pitfalls ## Pitfalls
- The `#include` command must not be in the last line of the file - The `#include` command must not be in the last line of the file
- The maps in `set` have **at least 2** options - The maps in `set` must have **at least 2** options
- If you want to use variables in markdown, you have to escape the `#` with a backslash, so `#$(var)` becomes `\#$(var)` - If you want to use variables in markdown, you have to escape the `#` with a backslash, so `#$(var)` becomes `\#$(var)`