diff --git a/README.md b/README.md index 7b8741b..d9042f2 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,4 @@ or you can optionally add a text at the end of the HTML page title as the second argument ```./genlog.sh /path/to/your/choosen/folder "Your custom title"``` -you can also put your own `header.html` or `footer.html` in the `html/substitutes` folder -so they will be used instead of the default ones and you can freely personalize them - this project uses the [HotChocolateLicence](https://codeberg.org/OniriCorpe/HotChocolateLicence) diff --git a/genlog.sh b/genlog.sh index 8ff7783..8ca7d24 100755 --- a/genlog.sh +++ b/genlog.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash -: ' -LICENCE +:' LICENCE THE "HOT CHOCOLATE LICENSE ☕" (HCL revision 1312.2): OniriCorpe wrote this file. As long as you retain this @@ -11,8 +10,7 @@ disabled comrades, etc), you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a hot chocolate or any other non-alcoholic drink that suits me in return. -OniriCorpe 🏴 -' +OniriCorpe 🏴' # some useful things @@ -36,23 +34,9 @@ else fi -# if header or footer file exists in the substitutes folder, use it instead of the default ones -if [ -f html/substitutes/header.html ]; then - header_template="html/substitutes/header.html" -else - header_template="html/header.html" -fi - -if [ -f html/substitutes/footer.html ]; then - footer_template="html/substitutes/footer.html" -else - footer_template="html/footer.html" -fi - - # get the current date for the footer (UTC and ISO 8601 with hours and minutes) date=$(date -u --iso-8601=minutes) -sed "s/GEN_DATE/${date}/" "$footer_template" > "$tempdir/footer.html" +sed "s/GEN_DATE/${date}/" html/footer.html > "$tempdir/footer.html" # finding recursively all ".gmi" files on the working path @@ -62,29 +46,15 @@ do # deleting the '#' of the first line and save it as title title="$(sed -n '1{s/# //p}' "$gmi_file") $2" # escaping eventual '&' (otherwise causing a bug where it is replaced by '<\!-- TITLE -->') - # shellcheck disable=SC2001 title=$(echo "$title" | sed "s#\\\g") # in the header.html, replacing the "<\-- TITLE -->" by the previously # saved title, and save the modified file in our temporary directory - sed "s#<\!-- TITLE -->#${title}#" "$header_template" > "$tempdir/header.html" + sed "s#<\!-- TITLE -->#${title}#" html/header.html > "$tempdir/header.html" - # converting .gmi files in .html + # convertig .gmi files in .html /usr/local/bin/gmnitohtml < "$gmi_file" > "$tempdir/body.html" - cp "$tempdir/body.html" "$tempdir/work-body.html" - - # trick to support h4 titles - while IFS= read -r line; do - if echo $ "$line" | grep -q "