summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2022-07-02 18:06:13 +0300
committerPaul Buetow <paul@buetow.org>2022-07-02 18:06:13 +0300
commit30f00fa694280a7eaa23c20affba22bd14b91739 (patch)
treee740fee1f38945578b1c841662134c9e2fb2aadd
parent4568e15116c06897986090f1b73a419caf129002 (diff)
refactor the HTML extras sub-directory
-rw-r--r--README.md4
-rw-r--r--extras/README.md1
-rw-r--r--extras/html/consola-mono/ConsolaMono-Bold.pdf (renamed from htmlextras/consola-mono/ConsolaMono-Bold.pdf)bin60278 -> 60278 bytes
-rw-r--r--extras/html/consola-mono/ConsolaMono-Bold.ttf (renamed from htmlextras/consola-mono/ConsolaMono-Bold.ttf)bin345656 -> 345656 bytes
-rw-r--r--extras/html/consola-mono/ConsolaMono-Book.pdf (renamed from htmlextras/consola-mono/ConsolaMono-Book.pdf)bin58696 -> 58696 bytes
-rw-r--r--extras/html/consola-mono/ConsolaMono-Book.ttf (renamed from htmlextras/consola-mono/ConsolaMono-Book.ttf)bin356060 -> 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)bin388500 -> 388500 bytes
-rw-r--r--extras/html/hack/Hack-BoldOblique.ttf (renamed from htmlextras/hack/Hack-BoldOblique.ttf)bin386916 -> 386916 bytes
-rw-r--r--extras/html/hack/Hack-Regular.ttf (renamed from htmlextras/hack/Hack-Regular.ttf)bin367144 -> 367144 bytes
-rw-r--r--extras/html/hack/Hack-RegularOblique.ttf (renamed from htmlextras/hack/Hack-RegularOblique.ttf)bin379312 -> 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)bin82 -> 82 bytes
-rw-r--r--extras/html/khand/._logan_kruger read me.rtf (renamed from htmlextras/khand/._logan_kruger read me.rtf)bin82 -> 82 bytes
-rw-r--r--extras/html/khand/khand.ttf (renamed from htmlextras/khand/khand.ttf)bin38344 -> 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-xextras/html/roboto-slab/RobotoSlab-Bold.ttf (renamed from htmlextras/roboto-slab/RobotoSlab-Bold.ttf)bin122788 -> 122788 bytes
-rwxr-xr-xextras/html/roboto-slab/RobotoSlab-Light.ttf (renamed from htmlextras/roboto-slab/RobotoSlab-Light.ttf)bin121376 -> 121376 bytes
-rwxr-xr-xextras/html/roboto-slab/RobotoSlab-Regular.ttf (renamed from htmlextras/roboto-slab/RobotoSlab-Regular.ttf)bin121060 -> 121060 bytes
-rwxr-xr-xextras/html/roboto-slab/RobotoSlab-Thin.ttf (renamed from htmlextras/roboto-slab/RobotoSlab-Thin.ttf)bin120708 -> 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)bin313573 -> 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)bin151464 -> 151464 bytes
-rwxr-xr-xgemtexter4
-rw-r--r--gemtexter.conf16
-rw-r--r--lib/generate.source.sh64
-rw-r--r--lib/html.source.sh21
34 files changed, 64 insertions, 46 deletions
diff --git a/README.md b/README.md
index f96d44b..87c8baf 100644
--- a/README.md
+++ b/README.md
@@ -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
index 2ba9408..2ba9408 100644
--- a/htmlextras/consola-mono/ConsolaMono-Bold.pdf
+++ b/extras/html/consola-mono/ConsolaMono-Bold.pdf
Binary files differ
diff --git a/htmlextras/consola-mono/ConsolaMono-Bold.ttf b/extras/html/consola-mono/ConsolaMono-Bold.ttf
index 7e289b3..7e289b3 100644
--- a/htmlextras/consola-mono/ConsolaMono-Bold.ttf
+++ b/extras/html/consola-mono/ConsolaMono-Bold.ttf
Binary files differ
diff --git a/htmlextras/consola-mono/ConsolaMono-Book.pdf b/extras/html/consola-mono/ConsolaMono-Book.pdf
index 8bdc6cd..8bdc6cd 100644
--- a/htmlextras/consola-mono/ConsolaMono-Book.pdf
+++ b/extras/html/consola-mono/ConsolaMono-Book.pdf
Binary files differ
diff --git a/htmlextras/consola-mono/ConsolaMono-Book.ttf b/extras/html/consola-mono/ConsolaMono-Book.ttf
index 78ca9da..78ca9da 100644
--- a/htmlextras/consola-mono/ConsolaMono-Book.ttf
+++ b/extras/html/consola-mono/ConsolaMono-Book.ttf
Binary files differ
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
index 8e4fdc8..8e4fdc8 100644
--- a/htmlextras/hack/Hack-Bold.ttf
+++ b/extras/html/hack/Hack-Bold.ttf
Binary files differ
diff --git a/htmlextras/hack/Hack-BoldOblique.ttf b/extras/html/hack/Hack-BoldOblique.ttf
index dbc7cb6..dbc7cb6 100644
--- a/htmlextras/hack/Hack-BoldOblique.ttf
+++ b/extras/html/hack/Hack-BoldOblique.ttf
Binary files differ
diff --git a/htmlextras/hack/Hack-Regular.ttf b/extras/html/hack/Hack-Regular.ttf
index 7c8e65b..7c8e65b 100644
--- a/htmlextras/hack/Hack-Regular.ttf
+++ b/extras/html/hack/Hack-Regular.ttf
Binary files differ
diff --git a/htmlextras/hack/Hack-RegularOblique.ttf b/extras/html/hack/Hack-RegularOblique.ttf
index f492589..f492589 100644
--- a/htmlextras/hack/Hack-RegularOblique.ttf
+++ b/extras/html/hack/Hack-RegularOblique.ttf
Binary files differ
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
index ed1f83f..ed1f83f 100644
--- a/htmlextras/khand/._logan_kruger read me.html
+++ b/extras/html/khand/._logan_kruger read me.html
Binary files differ
diff --git a/htmlextras/khand/._logan_kruger read me.rtf b/extras/html/khand/._logan_kruger read me.rtf
index ed1f83f..ed1f83f 100644
--- a/htmlextras/khand/._logan_kruger read me.rtf
+++ b/extras/html/khand/._logan_kruger read me.rtf
Binary files differ
diff --git a/htmlextras/khand/khand.ttf b/extras/html/khand/khand.ttf
index 25e688b..25e688b 100644
--- a/htmlextras/khand/khand.ttf
+++ b/extras/html/khand/khand.ttf
Binary files differ
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
index ac66b33..ac66b33 100755
--- a/htmlextras/roboto-slab/RobotoSlab-Bold.ttf
+++ b/extras/html/roboto-slab/RobotoSlab-Bold.ttf
Binary files differ
diff --git a/htmlextras/roboto-slab/RobotoSlab-Light.ttf b/extras/html/roboto-slab/RobotoSlab-Light.ttf
index 24164ec..24164ec 100755
--- a/htmlextras/roboto-slab/RobotoSlab-Light.ttf
+++ b/extras/html/roboto-slab/RobotoSlab-Light.ttf
Binary files differ
diff --git a/htmlextras/roboto-slab/RobotoSlab-Regular.ttf b/extras/html/roboto-slab/RobotoSlab-Regular.ttf
index ec2d4ae..ec2d4ae 100755
--- a/htmlextras/roboto-slab/RobotoSlab-Regular.ttf
+++ b/extras/html/roboto-slab/RobotoSlab-Regular.ttf
Binary files differ
diff --git a/htmlextras/roboto-slab/RobotoSlab-Thin.ttf b/extras/html/roboto-slab/RobotoSlab-Thin.ttf
index 657b2ed..657b2ed 100755
--- a/htmlextras/roboto-slab/RobotoSlab-Thin.ttf
+++ b/extras/html/roboto-slab/RobotoSlab-Thin.ttf
Binary files differ
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
index e727c38..e727c38 100644
--- a/htmlextras/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.png
+++ b/extras/html/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.png
Binary files differ
diff --git a/htmlextras/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.ttf b/extras/html/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.ttf
index 375978c..375978c 100644
--- a/htmlextras/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.ttf
+++ b/extras/html/zai-aeg-mignon-typewriter-1924/zai_AEGMignonTypewriter1924.ttf
Binary files differ
diff --git a/gemtexter b/gemtexter
index eadbb44..1bd5690 100755
--- a/gemtexter
+++ b/gemtexter
@@ -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