diff options
| author | Paul Buetow <paul@buetow.org> | 2022-07-02 18:06:13 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2022-07-02 18:06:13 +0300 |
| commit | 30f00fa694280a7eaa23c20affba22bd14b91739 (patch) | |
| tree | e740fee1f38945578b1c841662134c9e2fb2aadd | |
| parent | 4568e15116c06897986090f1b73a419caf129002 (diff) | |
refactor the HTML extras sub-directory
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | extras/README.md | 1 | ||||
| -rw-r--r-- | extras/html/consola-mono/ConsolaMono-Bold.pdf (renamed from htmlextras/consola-mono/ConsolaMono-Bold.pdf) | bin | 60278 -> 60278 bytes | |||
| -rw-r--r-- | extras/html/consola-mono/ConsolaMono-Bold.ttf (renamed from htmlextras/consola-mono/ConsolaMono-Bold.ttf) | bin | 345656 -> 345656 bytes | |||
| -rw-r--r-- | extras/html/consola-mono/ConsolaMono-Book.pdf (renamed from htmlextras/consola-mono/ConsolaMono-Book.pdf) | bin | 58696 -> 58696 bytes | |||
| -rw-r--r-- | extras/html/consola-mono/ConsolaMono-Book.ttf (renamed from htmlextras/consola-mono/ConsolaMono-Book.ttf) | bin | 356060 -> 356060 bytes | |||
| -rw-r--r-- | extras/html/consola-mono/FONTLOG.txt (renamed from htmlextras/consola-mono/FONTLOG.txt) | 0 | ||||
| -rw-r--r-- | extras/html/consola-mono/SIL - Open Font License.txt (renamed from htmlextras/consola-mono/SIL - Open Font License.txt) | 0 | ||||
| -rw-r--r-- | extras/html/footer.html.part (renamed from htmlextras/footer.html.part) | 0 | ||||
| -rw-r--r-- | extras/html/hack/Hack-Bold.ttf (renamed from htmlextras/hack/Hack-Bold.ttf) | bin | 388500 -> 388500 bytes | |||
| -rw-r--r-- | extras/html/hack/Hack-BoldOblique.ttf (renamed from htmlextras/hack/Hack-BoldOblique.ttf) | bin | 386916 -> 386916 bytes | |||
| -rw-r--r-- | extras/html/hack/Hack-Regular.ttf (renamed from htmlextras/hack/Hack-Regular.ttf) | bin | 367144 -> 367144 bytes | |||
| -rw-r--r-- | extras/html/hack/Hack-RegularOblique.ttf (renamed from htmlextras/hack/Hack-RegularOblique.ttf) | bin | 379312 -> 379312 bytes | |||
| -rw-r--r-- | extras/html/header.html.part (renamed from htmlextras/header.html.part) | 0 | ||||
| -rw-r--r-- | extras/html/khand/._logan_kruger read me.html (renamed from htmlextras/khand/._logan_kruger read me.html) | bin | 82 -> 82 bytes | |||
| -rw-r--r-- | extras/html/khand/._logan_kruger read me.rtf (renamed from htmlextras/khand/._logan_kruger read me.rtf) | bin | 82 -> 82 bytes | |||
| -rw-r--r-- | extras/html/khand/khand.ttf (renamed from htmlextras/khand/khand.ttf) | bin | 38344 -> 38344 bytes | |||
| -rw-r--r-- | extras/html/khand/logan_kruger read me.html (renamed from htmlextras/khand/logan_kruger read me.html) | 0 | ||||
| -rw-r--r-- | extras/html/khand/logan_kruger read me.rtf (renamed from htmlextras/khand/logan_kruger read me.rtf) | 0 | ||||
| -rw-r--r-- | extras/html/roboto-slab/LICENSE.txt (renamed from htmlextras/roboto-slab/LICENSE.txt) | 0 | ||||
| -rwxr-xr-x | extras/html/roboto-slab/RobotoSlab-Bold.ttf (renamed from htmlextras/roboto-slab/RobotoSlab-Bold.ttf) | bin | 122788 -> 122788 bytes | |||
| -rwxr-xr-x | extras/html/roboto-slab/RobotoSlab-Light.ttf (renamed from htmlextras/roboto-slab/RobotoSlab-Light.ttf) | bin | 121376 -> 121376 bytes | |||
| -rwxr-xr-x | extras/html/roboto-slab/RobotoSlab-Regular.ttf (renamed from htmlextras/roboto-slab/RobotoSlab-Regular.ttf) | bin | 121060 -> 121060 bytes | |||
| -rwxr-xr-x | extras/html/roboto-slab/RobotoSlab-Thin.ttf (renamed from htmlextras/roboto-slab/RobotoSlab-Thin.ttf) | bin | 120708 -> 120708 bytes | |||
| -rw-r--r-- | extras/html/style-gemfeed-override.css (renamed from htmlextras/style-gemfeed-override.css) | 0 | ||||
| -rw-r--r-- | extras/html/style-notes-override.css (renamed from htmlextras/style-notes-override.css) | 0 | ||||
| -rw-r--r-- | extras/html/style.css (renamed from htmlextras/style.css) | 0 | ||||
| -rw-r--r-- | extras/html/zai-aeg-mignon-typewriter-1924/Licence.txt (renamed from htmlextras/zai-aeg-mignon-typewriter-1924/Licence.txt) | 0 | ||||
| -rw-r--r-- | extras/html/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.png (renamed from htmlextras/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.png) | bin | 313573 -> 313573 bytes | |||
| -rw-r--r-- | extras/html/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.ttf (renamed from htmlextras/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.ttf) | bin | 151464 -> 151464 bytes | |||
| -rwxr-xr-x | gemtexter | 4 | ||||
| -rw-r--r-- | gemtexter.conf | 16 | ||||
| -rw-r--r-- | lib/generate.source.sh | 64 | ||||
| -rw-r--r-- | lib/html.source.sh | 21 |
34 files changed, 64 insertions, 46 deletions
@@ -14,7 +14,7 @@ Have a look at the `content-*` branches of the [foo.zone Git](https://codeberg.o ## External Licenses -Gemtexter uses some external TrueType fonts for the HTML output. For license information please look into all [font sub-directories of the HTML extras folder](./htmlextras). But to summarize, all fonts are free for personal use. +Gemtexter uses some external TrueType fonts for the HTML output. For license information please look into all [font sub-directories of the HTML extras folder](./extras/html). But to summarize, all fonts are free for personal use. # Getting started @@ -65,7 +65,7 @@ Whereas you only want to edit the content in the `gemtext` folder directly. The ### Special HTML configuration -You will find the `./htmlextras/header.html.part` and `./htmlextras/footer.html.part` files, they are minimal template files for the HTML generation. There's also the `./htmlextras/style.css` for HTML. +You will find the `./extras/html/header.html.part` and `./extras/html/footer.html.part` files, they are minimal template files for the HTML generation. There's also the `./extras/html/style.css` for HTML. ### Special HTML configuration diff --git a/extras/README.md b/extras/README.md new file mode 100644 index 0000000..4fab66e --- /dev/null +++ b/extras/README.md @@ -0,0 +1 @@ +By output format extra content to be added. diff --git a/htmlextras/consola-mono/ConsolaMono-Bold.pdf b/extras/html/consola-mono/ConsolaMono-Bold.pdf Binary files differindex 2ba9408..2ba9408 100644 --- a/htmlextras/consola-mono/ConsolaMono-Bold.pdf +++ b/extras/html/consola-mono/ConsolaMono-Bold.pdf diff --git a/htmlextras/consola-mono/ConsolaMono-Bold.ttf b/extras/html/consola-mono/ConsolaMono-Bold.ttf Binary files differindex 7e289b3..7e289b3 100644 --- a/htmlextras/consola-mono/ConsolaMono-Bold.ttf +++ b/extras/html/consola-mono/ConsolaMono-Bold.ttf diff --git a/htmlextras/consola-mono/ConsolaMono-Book.pdf b/extras/html/consola-mono/ConsolaMono-Book.pdf Binary files differindex 8bdc6cd..8bdc6cd 100644 --- a/htmlextras/consola-mono/ConsolaMono-Book.pdf +++ b/extras/html/consola-mono/ConsolaMono-Book.pdf diff --git a/htmlextras/consola-mono/ConsolaMono-Book.ttf b/extras/html/consola-mono/ConsolaMono-Book.ttf Binary files differindex 78ca9da..78ca9da 100644 --- a/htmlextras/consola-mono/ConsolaMono-Book.ttf +++ b/extras/html/consola-mono/ConsolaMono-Book.ttf diff --git a/htmlextras/consola-mono/FONTLOG.txt b/extras/html/consola-mono/FONTLOG.txt index e6c398e..e6c398e 100644 --- a/htmlextras/consola-mono/FONTLOG.txt +++ b/extras/html/consola-mono/FONTLOG.txt diff --git a/htmlextras/consola-mono/SIL - Open Font License.txt b/extras/html/consola-mono/SIL - Open Font License.txt index 0ed6458..0ed6458 100644 --- a/htmlextras/consola-mono/SIL - Open Font License.txt +++ b/extras/html/consola-mono/SIL - Open Font License.txt diff --git a/htmlextras/footer.html.part b/extras/html/footer.html.part index 997364c..997364c 100644 --- a/htmlextras/footer.html.part +++ b/extras/html/footer.html.part diff --git a/htmlextras/hack/Hack-Bold.ttf b/extras/html/hack/Hack-Bold.ttf Binary files differindex 8e4fdc8..8e4fdc8 100644 --- a/htmlextras/hack/Hack-Bold.ttf +++ b/extras/html/hack/Hack-Bold.ttf diff --git a/htmlextras/hack/Hack-BoldOblique.ttf b/extras/html/hack/Hack-BoldOblique.ttf Binary files differindex dbc7cb6..dbc7cb6 100644 --- a/htmlextras/hack/Hack-BoldOblique.ttf +++ b/extras/html/hack/Hack-BoldOblique.ttf diff --git a/htmlextras/hack/Hack-Regular.ttf b/extras/html/hack/Hack-Regular.ttf Binary files differindex 7c8e65b..7c8e65b 100644 --- a/htmlextras/hack/Hack-Regular.ttf +++ b/extras/html/hack/Hack-Regular.ttf diff --git a/htmlextras/hack/Hack-RegularOblique.ttf b/extras/html/hack/Hack-RegularOblique.ttf Binary files differindex f492589..f492589 100644 --- a/htmlextras/hack/Hack-RegularOblique.ttf +++ b/extras/html/hack/Hack-RegularOblique.ttf diff --git a/htmlextras/header.html.part b/extras/html/header.html.part index 03ac281..03ac281 100644 --- a/htmlextras/header.html.part +++ b/extras/html/header.html.part diff --git a/htmlextras/khand/._logan_kruger read me.html b/extras/html/khand/._logan_kruger read me.html Binary files differindex ed1f83f..ed1f83f 100644 --- a/htmlextras/khand/._logan_kruger read me.html +++ b/extras/html/khand/._logan_kruger read me.html diff --git a/htmlextras/khand/._logan_kruger read me.rtf b/extras/html/khand/._logan_kruger read me.rtf Binary files differindex ed1f83f..ed1f83f 100644 --- a/htmlextras/khand/._logan_kruger read me.rtf +++ b/extras/html/khand/._logan_kruger read me.rtf diff --git a/htmlextras/khand/khand.ttf b/extras/html/khand/khand.ttf Binary files differindex 25e688b..25e688b 100644 --- a/htmlextras/khand/khand.ttf +++ b/extras/html/khand/khand.ttf diff --git a/htmlextras/khand/logan_kruger read me.html b/extras/html/khand/logan_kruger read me.html index 7eda652..7eda652 100644 --- a/htmlextras/khand/logan_kruger read me.html +++ b/extras/html/khand/logan_kruger read me.html diff --git a/htmlextras/khand/logan_kruger read me.rtf b/extras/html/khand/logan_kruger read me.rtf index fddbc43..fddbc43 100644 --- a/htmlextras/khand/logan_kruger read me.rtf +++ b/extras/html/khand/logan_kruger read me.rtf diff --git a/htmlextras/roboto-slab/LICENSE.txt b/extras/html/roboto-slab/LICENSE.txt index d645695..d645695 100644 --- a/htmlextras/roboto-slab/LICENSE.txt +++ b/extras/html/roboto-slab/LICENSE.txt diff --git a/htmlextras/roboto-slab/RobotoSlab-Bold.ttf b/extras/html/roboto-slab/RobotoSlab-Bold.ttf Binary files differindex ac66b33..ac66b33 100755 --- a/htmlextras/roboto-slab/RobotoSlab-Bold.ttf +++ b/extras/html/roboto-slab/RobotoSlab-Bold.ttf diff --git a/htmlextras/roboto-slab/RobotoSlab-Light.ttf b/extras/html/roboto-slab/RobotoSlab-Light.ttf Binary files differindex 24164ec..24164ec 100755 --- a/htmlextras/roboto-slab/RobotoSlab-Light.ttf +++ b/extras/html/roboto-slab/RobotoSlab-Light.ttf diff --git a/htmlextras/roboto-slab/RobotoSlab-Regular.ttf b/extras/html/roboto-slab/RobotoSlab-Regular.ttf Binary files differindex ec2d4ae..ec2d4ae 100755 --- a/htmlextras/roboto-slab/RobotoSlab-Regular.ttf +++ b/extras/html/roboto-slab/RobotoSlab-Regular.ttf diff --git a/htmlextras/roboto-slab/RobotoSlab-Thin.ttf b/extras/html/roboto-slab/RobotoSlab-Thin.ttf Binary files differindex 657b2ed..657b2ed 100755 --- a/htmlextras/roboto-slab/RobotoSlab-Thin.ttf +++ b/extras/html/roboto-slab/RobotoSlab-Thin.ttf diff --git a/htmlextras/style-gemfeed-override.css b/extras/html/style-gemfeed-override.css index e69de29..e69de29 100644 --- a/htmlextras/style-gemfeed-override.css +++ b/extras/html/style-gemfeed-override.css diff --git a/htmlextras/style-notes-override.css b/extras/html/style-notes-override.css index b5953b4..b5953b4 100644 --- a/htmlextras/style-notes-override.css +++ b/extras/html/style-notes-override.css diff --git a/htmlextras/style.css b/extras/html/style.css index ea6184f..ea6184f 100644 --- a/htmlextras/style.css +++ b/extras/html/style.css diff --git a/htmlextras/zai-aeg-mignon-typewriter-1924/Licence.txt b/extras/html/zai-aeg-mignon-typewriter-1924/Licence.txt index ec28cc5..ec28cc5 100644 --- a/htmlextras/zai-aeg-mignon-typewriter-1924/Licence.txt +++ b/extras/html/zai-aeg-mignon-typewriter-1924/Licence.txt diff --git a/htmlextras/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.png b/extras/html/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.png Binary files differindex e727c38..e727c38 100644 --- a/htmlextras/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.png +++ b/extras/html/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.png diff --git a/htmlextras/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.ttf b/extras/html/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.ttf Binary files differindex 375978c..375978c 100644 --- a/htmlextras/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.ttf +++ b/extras/html/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.ttf @@ -82,6 +82,10 @@ main () { html::test md::test ;; + --develop) + # Switch only used for development purposes + generate::fromgmi html md + ;; --feed) html::test md::test diff --git a/gemtexter.conf b/gemtexter.conf index b32a5d7..004c4eb 100644 --- a/gemtexter.conf +++ b/gemtexter.conf @@ -1,14 +1,14 @@ declare -xr DOMAIN=foo.zone declare -xr SUBTITLE='To be in the .zone!' -declare -xr AUTHOR='Paul Buetow' +declare -xr AUTHOR='Paul C. Buetow' declare -xr EMAIL='comments@mx.buetow.org' declare -xr IMAGE_PATTERN='\.(jpg|png|gif)$' declare -xr ATOM_MAX_ENTRIES=42 declare -xr CONTENT_BASE_DIR=../foo.zone-content -declare -xr HTML_HEADER=./htmlextras/header.html.part -declare -xr HTML_FOOTER=./htmlextras/footer.html.part -declare -xr HTML_CSS_STYLE=./htmlextras/style.css -declare -xr HTML_WEBFONT_TEXT=./htmlextras/consola-mono/ConsolaMono-Book.ttf -declare -xr HTML_WEBFONT_CODE=./htmlextras/consola-mono/ConsolaMono-Book.ttf -declare -xr HTML_WEBFONT_HANDNOTES=./htmlextras/khand/khand.ttf -declare -xr HTML_WEBFONT_TYPEWRITER=./htmlextras/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.ttf +declare -xr HTML_HEADER=./extras/html/header.html.part +declare -xr HTML_FOOTER=./extras/html/footer.html.part +declare -xr HTML_CSS_STYLE=./extras/html/style.css +declare -xr HTML_WEBFONT_TEXT=./extras/html/roboto-slab/RobotoSlab-Regular.ttf +declare -xr HTML_WEBFONT_CODE=./extras/html/hack/Hack-Regular.ttf +declare -xr HTML_WEBFONT_HANDNOTES=./extras/html/khand/khand.ttf +declare -xr HTML_WEBFONT_TYPEWRITER=./extras/html/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.ttf diff --git a/lib/generate.source.sh b/lib/generate.source.sh index 2e1c6ef..b2dafbc 100644 --- a/lib/generate.source.sh +++ b/lib/generate.source.sh @@ -71,13 +71,19 @@ generate::convert_gmi_atom_to_html_atom () { } # Internal helper function for generate::fromgmi -generate::_fromgmi () { +generate::_to_output_format () { local -r src="$1"; shift local -r format="$1"; shift + local dest=${src/gemtext/$format} dest=${dest/.gmi/.$format} local dest_dir=$(dirname "$dest") + local title=$($SED -n '/^# / { s/# //; p; q; }' "$src" | tr '"' "'") + if [[ -z "$title" ]]; then + title="$SUBTITLE" + fi + if [[ ! -d "$dest_dir" ]]; then mkdir -p "$dest_dir" fi @@ -87,16 +93,7 @@ generate::_fromgmi () { html::fromgmi < "$src" >> "$dest.tmp" cat "$HTML_FOOTER" >> "$dest.tmp" - elif [[ "$format" == md ]]; then - md::fromgmi < "$src" >> "$dest.tmp" - fi - - local title=$($SED -n '/^# / { s/# //; p; q; }' "$src" | tr '"' "'") - if [[ -z "$title" ]]; then - title=$SUBTITLE - fi - - if [[ "$format" == html ]]; then + # For HTML, we can override the style sheet per directory. local stylesheet="$(basename "$HTML_CSS_STYLE")" local stylesheet_override="${stylesheet/.css/-override.css}" if [[ "$CONTENT_BASE_DIR/html" != "$(dirname "$dest")" ]]; then @@ -106,7 +103,15 @@ generate::_fromgmi () { s|%%DOMAIN%%|$DOMAIN|g; s|%%STYLESHEET%%|$stylesheet|g; s|%%STYLESHEET_OVERRIDE%%|$stylesheet_override|g;" "$dest.tmp" + + elif [[ "$format" == md ]]; then + md::fromgmi < "$src" >> "$dest.tmp" + + else + log ERROR "Unknown output format '$format'" + exit 2 fi + mv "$dest.tmp" "$dest" } @@ -117,37 +122,18 @@ generate::fromgmi () { log INFO "Generating $* from Gemtext" + # Add content while read -r src; do num_gmi_files=$(( num_gmi_files + 1 )) log INFO "Generating output formats from $src" for format in "$@"; do - generate::_fromgmi "$src" "$format" & + generate::_to_output_format "$src" "$format" & done done < <(find "$CONTENT_BASE_DIR/gemtext" -type f -name \*.gmi) - wait + wait log INFO "Converted $num_gmi_files Gemtext files" - # Add HTML extras (will be cleaned up further below) - cp $HTML_CSS_STYLE $CONTENT_BASE_DIR/gemtext/style.css - for section in . gemfeed notes; do - if [[ ! -d "$CONTENT_BASE_DIR/gemtext/$section" ]]; then - continue - fi - - local override_source="./htmlextras/style-${section}-override.css" - local override_dest="$CONTENT_BASE_DIR/gemtext/$section/style-override.css" - if [ ! -f "$override_source" ]; then - touch "$override_dest" # Empty override - continue - fi - cp "$override_source" "$override_dest" - done - cp "$HTML_WEBFONT_TEXT" $CONTENT_BASE_DIR/gemtext/text.ttf - cp "$HTML_WEBFONT_CODE" $CONTENT_BASE_DIR/gemtext/code.ttf - cp "$HTML_WEBFONT_HANDNOTES" $CONTENT_BASE_DIR/gemtext/handnotes.ttf - cp "$HTML_WEBFONT_TYPEWRITER" $CONTENT_BASE_DIR/gemtext/typewriter.ttf - # Add non-.gmi files to html dir. log VERBOSE "Adding other docs to $*" @@ -156,7 +142,7 @@ generate::fromgmi () { for format in "$@"; do generate::fromgmi_add_docs "$src" "$format" & done - done < <(find "$CONTENT_BASE_DIR/gemtext" -type f | $GREP -E -v '(\.git.*|\.gmi|atom.xml|\.tmp|htmlextras)$') + done < <(find "$CONTENT_BASE_DIR/gemtext" -type f | $GREP -E -v '(\.git.*|\.gmi|atom.xml|\.tmp)$') wait log INFO "Added $num_doc_files other documents to each of $*" @@ -176,8 +162,14 @@ generate::fromgmi () { done wait - # Cleanup HTML extras - rm $CONTENT_BASE_DIR/gemtext/{style.css,*.ttf} + # Add extra content + for format in "$@"; do + if [[ "$format" == html ]]; then + log INFO "Adding HTML extras" + html::add_extras & + fi + done + wait for format in "$@"; do log INFO "$format can be found in $CONTENT_BASE_DIR/$format now" diff --git a/lib/html.source.sh b/lib/html.source.sh index d55067d..125b174 100644 --- a/lib/html.source.sh +++ b/lib/html.source.sh @@ -69,6 +69,27 @@ html::process_inline () { html::process_inline_code } +html::add_extras () { + local -r html_base_dir="$CONTENT_BASE_DIR/html" + cp "$HTML_CSS_STYLE" "$html_base_dir/style.css" + + find "$html_base_dir" -mindepth 1 -maxdepth 1 -type d | $GREP -E -v '(\.git)' | + while read section_dir; do + local override_source="./extras/html/style-$(basename $section_dir)-override.css" + local override_dest="$section_dir/style-override.css" + if [ ! -f "$override_source" ]; then + touch "$override_dest" # Empty override + else + cp "$override_source" "$override_dest" + fi + done + + cp "$HTML_WEBFONT_TEXT" "$html_base_dir/text.ttf" + cp "$HTML_WEBFONT_CODE" "$html_base_dir/code.ttf" + cp "$HTML_WEBFONT_HANDNOTES" "$html_base_dir/handnotes.ttf" + cp "$HTML_WEBFONT_TYPEWRITER" "$html_base_dir/typewriter.ttf" +} + # Convert Gemtext to HTML html::fromgmi () { local is_list=no |
