diff options
| Commit | 9f0ec9166069b01506aac1e509e8fc16049c222f (patch) | |
|---|---|---|
| Author | 2023-05-07 14:40:25 +0300 | |
| Committer | 2023-05-07 14:40:25 +0300 | |
| Files | 2a2600abc651009bbd01a464367dc49f40fb0299 /awk-edits | |
| syndamia.com-9f0ec9166069b01506aac1e509e8fc16049c222f.tar syndamia.com-9f0ec9166069b01506aac1e509e8fc16049c222f.tar.gz syndamia.com-9f0ec9166069b01506aac1e509e8fc16049c222f.zip | ||
| Parent | a1b13aa9cfdbf31f18fef8ccf7731d4529c0e308 (diff) | |
[README] Improved READMEs
1 files changed, 23 insertions, 11 deletions
| -rw-r--r-- | awk-edits/README.md | 34 |
diff --git a/awk-edits/README.md b/awk-edits/README.md index 5ff6792..fd1b713 100644 --- a/awk-edits/README.md +++ b/awk-edits/README.md @@ -1,20 +1,29 @@ -All `.awk` files in this folder are ran by `generate.sh` and `generate-dev.sh`, after ssg and lowdown have created all HTML pages. These files are meant to work on the resultant HTML. +These AWK scripts are part of the 3rd "stage" in `generate.sh`, they edit the generated (by ssg and lowdown) HTML pages. +This allows for custom Markdown syntax and special formatting, for more info, read about [SS-Law](https://syndamia.gitlab.io/ss-law). -For improved efficiency, rather than running every script seperately, they are meant to be concatinated into one script (`generate.sh` and `generate-dev.sh` combine them in `/tmp/syndamiadotcom-awk`), which is ran for each HTML file. -This forces us to work with the following constraints: +Without the `devs` argument, `generate.sh` concatenates all of them into one big file, where the order is dependant on the first character of the filename: at the top are those starting with "#", then those with capital letter and finally those with a lowercase letter (however there is no order between files with the same type of starting character). -- NO awk script should print the current line (print should only be used to add new lines) - The script that starts with '\_' contains the print of the current line, all scripts that start with a capital letter are ran before it and all with small letter - after. - + If we print the current line in every script, the concatenated will print the current line multiple times -- Variable names between scripts must be unique -- `exit` mustn't be used! - Instead, use a variable and then add a check to every relevant rule. +For this reason: + +- Files, starting with "#" are "libraries", just AWK scripts that contain only functions +- Files, starting with a capital letter, are (their code) executed before the line printing (more on that in a bit) +- Files, starting with a lower case letter, are (their code) executed after the line printing + +This is why the following constraints have to be considered: + +- If every script printed `$0`, then every line would be duplicated multiple times. + That is why you **mustn't** print the current line in your own script, `generate.sh` passes the appropriate AWK code. + If you don't want the line to be printed, do `$0 = 0`. +- Variable names between scripts must be unique, because when combined, unexpected behaviour might occur. +- `exit` **mustn't** be used! + Instead, use a variable and then add a check in the "pattern" part for every rule where you would want to exit. ## ftags -ftags are strings/words in the Markdown source files, that start with "&&" and continue with any (valid) sequence of characters. The name initially stood for "file tags", since I got the idea while making the file lists functionality. Now I like to think of them as "format tags", since they are used for so much more. +ftags are strings/words in the Markdown source files, that start with "&&" and continue with any (valid) sequence of characters. +AWK scripts replace ftags with corresponding HTML. -On the "backend", they just get replaced with specific HTML. List of scripts that handle ftags: +List of scripts that handle ftags: |Script|ftags| |---|---| @@ -23,3 +32,6 @@ On the "backend", they just get replaced with specific HTML. List of scripts tha |`Presentation.awk`|`&&presentation`, `&&slide`, `&&/slide`, `&&clide`, `&&/clide`, `&&table`, `&&ftable`, `&&tarow`, `&&/table`, `&&linebN` *(N is one of 1, 2, ..., 9)*, `&&fontSIZE` *(SIZE is one of `18`, `20`, `22`, `25`, `27`, `35`)*, `&&/font`, `&¢ered`, `&&/centered`, `&&fright`, `&&/fright`, `&&cont`, `&&/cont`| Information regarding their usage can be found at the top of their respective script file. + +The name initially stood for "file tags", since I got the idea while making the file lists functionality. +Now I like to think of them as "format tags", since they are used for so much more. |