diff options
| author | Paul Buetow <paul@buetow.org> | 2022-11-23 20:45:21 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2022-11-23 20:45:21 +0200 |
| commit | 5bbae36a59881e34fe111c0ee9f44f3907158301 (patch) | |
| tree | 85d2b8da1f33c327f57def0ba31a178872050a3d | |
| parent | 6682bd7c4c45283acdb161765dac58ec034899bd (diff) | |
| parent | 4c4f379ea616eeec320ec27776c739fadf70d2da (diff) | |
merge
| -rw-r--r-- | IDEA.md | 16 | ||||
| -rw-r--r-- | README.md | 25 | ||||
| -rw-r--r-- | extras/html/oxygen/OFL.txt | 92 | ||||
| -rw-r--r-- | extras/html/oxygen/Oxygen-Bold.ttf | bin | 0 -> 48812 bytes | |||
| -rw-r--r-- | extras/html/oxygen/Oxygen-Light.ttf | bin | 0 -> 43852 bytes | |||
| -rw-r--r-- | extras/html/oxygen/Oxygen-Regular.ttf | bin | 0 -> 48092 bytes | |||
| -rw-r--r-- | extras/html/style.css | 30 | ||||
| -rwxr-xr-x | gemtexter | 45 | ||||
| -rw-r--r-- | gemtexter-paul.buetow.org.conf | 15 | ||||
| -rw-r--r-- | gemtexter-snonux.land.conf | 3 | ||||
| -rw-r--r-- | gemtexter.conf | 2 | ||||
| -rw-r--r-- | lib/atomfeed.source.sh | 52 | ||||
| -rw-r--r-- | lib/gemfeed.source.sh | 9 | ||||
| -rw-r--r-- | lib/generate.source.sh | 22 | ||||
| -rw-r--r-- | lib/html.source.sh | 3 | ||||
| -rw-r--r-- | lib/notes.source.sh | 5 |
16 files changed, 269 insertions, 50 deletions
@@ -1,10 +1,8 @@ # IDEAs -## Parallel job processing queue +## Templating -Currently, in order to speed up, Gemtexter forks on certain functions and loops and joins (via `wait`) on the sub-processes. This however can be a problem once a user max process limit is reached. - -Use s.t. like `pgrep -c -P$$` to determine how many sub-processes are already active and wait for new forks until a lower limit is reached. +Templating of .gmi files (e.g. insert %%TOC%% to Gemtext files as well). Could also template common .gmi page headers and footers. Could also insert bash code here. ## Also generate a PDF book @@ -12,7 +10,13 @@ I could use pandoc for this (convert from Markdown to PDF). This works on Fedora ``` sudo dnf install pandoc wkhtmltopdf -pandoc FOO.md --pdf-engine=wkhtmltopdf --output FOO.pdf +pandoc **/*.md --pdf-engine=wkhtmltopdf --output foo.zone.pdf ``` -The Texlive PDF Engine doesn't work due to missing fonts on Fedora, and there aren't any packages providing the missing fonts. +There will be some more scripting required to get the page order and ToC correct. + +## More ideas + +* Automatic ToC generation. +* Sitemap generation. +* More output formats. Gopher? Groff? Plain text? PDF via Pandoc? .sh with interactive menus? @@ -26,9 +26,10 @@ These are the requirements of the `gemtexter` static site generator script: * ShellCheck installed * GNU Sed * GNU Date +* GNU Grep * Git -The script is tested on a recent Fedora Linux. For *BSD or macOS, you would need to install GNU Sed, GNU Date, and a newer version of Bash. +The script is tested on a recent Fedora Linux. For *BSD or macOS, you would need to install GNU Sed, GNU Date, GNU Grep and a newer version of Bash. ## Usage @@ -62,6 +63,7 @@ Whereas you only want to edit the content in the `gemtext` folder directly. The * `html`: The XHTML version of it. * `md`: The Markdown version of it. * `meta`: Some metadata of all Gemtext blog posts. It's used by `gemtexter` internally for Atom feed generation. +* `cache`: Some volatile cache data for speeding up Atom feed generation. ### Special HTML configuration @@ -77,7 +79,7 @@ You will find the `./extras/html/header.html.part` and `./extras/html/footer.htm ## Store all formats in Git -I personally have for each directory in `../foo.zone-content/` a separate Git repository configured. So whenever something changes I commit and push the content to Git. Gemtexter automatically detects whether a content directory is in Git or not (e.g. directories `../foo.zone-content/*/.git` exist). In this case you can use the `./gemtexter --git-add` command to add all files to Git and `./gemtexter --git-sync` to sync all content files with the remote repository (which is a Git pull followed by a push). A `./gemtexter --git` will do both, adding and syncing. Hou can set the `GIT_COMMIT_MESSAGE` environment variable for a custom commit message, e.g.: `GIT_COMMIT_MESSAGE='New blog post' ./gemtexter --git`. +I personally have for each directory in `../foo.zone-content/` a separate Git repository configured. So whenever something changes I commit and push the content to Git. Gemtexter automatically detects whether a content directory is in Git or not (e.g. directories `../foo.zone-content/*/.git` exist). In this case you can use the `./gemtexter --git-add` command to add all files to Git and `./gemtexter --git-sync` to sync all content files with the remote repository (which is a Git pull followed by a push). A `./gemtexter --git` will do both, adding and syncing. Hou can set the `GIT_COMMIT_MESSAGE` environment variable for a custom commit message, e.g.: `GIT_COMMIT_MESSAGE='New blog post' ./gemtexter --git`. There's really no need to keep the `cache` directory in Git. ## Publishing a blog post @@ -89,19 +91,26 @@ Once all of that is done, the `gemtexter` script will convert the new post (plus You can also have a look at `$BASE_CONTENT_DIR/meta/gemfeed`. There is a metafile for each blog post stored. These metafiles are required for the generation of the Atom feed. You can edit these metafiles manually and run `./gemtexter --generate` or `./gemtexter --feed` again if you want to change some of the Atom feed content. +## Drafting a blog post before publishing it + +If you don't want to publish your article yet (e.g. don't advertise it on the Gemfeed and Atom feed yet), you can draft your article in `./gemtext/gemfeed/DRAFT-article-title-dash-separated.gmi` and when invoke `./gemtexter --draft` to generate the outputs. Once you want to publish your draft just rename `DRAFT` with the publishing date `YYYY-MM-DD` and from there everything works normally. + ## Ready to be published After running `./gemtexter --generate`, you will have all static files ready to be published. But before you do that, you could preview the content with `firefox ../foo.zone-content/html/index.html` or `glow ../foo.zone-content/md/index.md` (you get the idea). Have also a look at the generated `atom.xml` files. They make sense (at least) for Gemtext and HTML. +If you use git, you can use `./gemtexter --publish`, which does a `--generate` followed by a `--git-add` and a `--git-sync`. + It is up to you to set up a Gemini server for the Gemtext, a Webserver for the HTML or a GitHub page for the Markdown format (or both). -# Future features +## Content filter -I might or might not implement those: +Once your capsule reaches a certain size it can become annoying to re-generate everything if you only want to preview one single content file. The following will add a filter to only generate the files matching a regular expression: + +``` +./gemtexter --generate '.*hello.*' +``` -* Templating of .gmi files (e.g. insert %%TOC%% to Gemtext files as well). Could also template common .gmi page headers and footers. Could also insert bash code here. -* Automatic ToC generation. -* Sitemap generation. -* More output formats. Gopher? Groff? Plain text? PDF via Pandoc? .sh with interactive menus? +This will help you to quickly review the results once in a while. Once you are happy you should always re-generate the whole capsule before publishing it! diff --git a/extras/html/oxygen/OFL.txt b/extras/html/oxygen/OFL.txt new file mode 100644 index 0000000..905e1d6 --- /dev/null +++ b/extras/html/oxygen/OFL.txt @@ -0,0 +1,92 @@ +Copyright (c) 2012, vernon adams (vern@newtypography.co.uk), with Reserved Font Names 'Oxygen'
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/extras/html/oxygen/Oxygen-Bold.ttf b/extras/html/oxygen/Oxygen-Bold.ttf Binary files differnew file mode 100644 index 0000000..835ab05 --- /dev/null +++ b/extras/html/oxygen/Oxygen-Bold.ttf diff --git a/extras/html/oxygen/Oxygen-Light.ttf b/extras/html/oxygen/Oxygen-Light.ttf Binary files differnew file mode 100644 index 0000000..08b9fec --- /dev/null +++ b/extras/html/oxygen/Oxygen-Light.ttf diff --git a/extras/html/oxygen/Oxygen-Regular.ttf b/extras/html/oxygen/Oxygen-Regular.ttf Binary files differnew file mode 100644 index 0000000..a66ddf1 --- /dev/null +++ b/extras/html/oxygen/Oxygen-Regular.ttf diff --git a/extras/html/style.css b/extras/html/style.css index ea6184f..eab41b7 100644 --- a/extras/html/style.css +++ b/extras/html/style.css @@ -22,20 +22,25 @@ line-height: 1.5em; margin: 0; padding: 0; - background-color: #f8f8f8; - color: #222; + background-color: #ffffef; + color: #000000; } body { - font-family: text, monospace; + font-family: monospace; width: 99%; - max-width: 800px; + max-width: 1024px; margin: 2em auto 0; padding: 0 20px; display: block; + border-style: solid; + border-width: 1px; + border-color: #232323; + margin-bottom: 50px; } h1, h2, h3 { + color: #000000; font-weight: bold; margin-top: 1em; margin-bottom: 0.75em; @@ -54,18 +59,18 @@ h3 { } a { - color: #248; + color: #39aa00; font-weight: 600; text-decoration: none; } a:hover { - background-color: #9CFF00; + background-color: #555555; text-decoration: underline; } a:visited { - color: #248; + color: #39aa00; } a.textlink:before { @@ -118,20 +123,21 @@ img { max-width: 100%; display: block; margin: auto; - border: 1px solid #9CFF00; + border: 1px solid #333333; } pre { - font-family: code, monospace; + color: #000000; + font-family: monospace; padding: 0; - overflow-x: scroll; + overflow-x: auto; scrollbar-width: none; - border-left: 2px solid #9CFF00; padding-left: 12px; } span.inlinecode { - font-family: code, monospace; + color: #000000; + font-family: monospace; filter: invert(1) grayscale(1); -webkit-filter: invert(1) grayscale(1); } @@ -4,8 +4,10 @@ # by Paul Buetow 2021, 2022 declare -r ARG="$1"; shift -declare -r VERSION=1.1 -declare -r VERSION_DESCR=prerelease +declare CONTENT_FILTER="$1"; shift + +declare -r VERSION=1.2.0 +declare -r VERSION_DESCR=develop declare DATE=date declare SED=sed declare GREP=grep @@ -43,12 +45,34 @@ $0's possible arguments: --generate Generates all known output formats (html, md, ...). --test Only runs some shellcheck and unit tests. --version Prints out the version of gemtexter - --help Prints this retty text. + --git-add Add all files to Git + --git-sync Sync all files with the remote origin + --git Both of above + --help Prints this pretty text. Example: $0 --generate HELPHERE } +# Make sure that there are the correct versions of the dependencies installed. +check_dependencies () { + # At least, Bash 5 is required + local -i required_version=5 + IFS=. read -ra version <<< "$BASH_VERSION" + if [ "${version[0]}" -lt $required_version ]; then + log ERROR "ERROR, \"bash\" must be at least at major version $required_version!" + exit 2 + fi + + # These must be the GNU versions of the commands + for tool in $DATE $SED $GREP; do + if ! $tool --version | grep -q GNU; then + log ERROR "ERROR, \"$tool\" command is not the GNU version, please install!" + exit 2 + fi + done +} + setup () { if [ ! -d "$CONTENT_BASE_DIR" ]; then cat <<END @@ -72,11 +96,10 @@ END } main () { - local -r arg="$1"; shift - + check_dependencies setup - case $arg in + case $ARG in --test) LOG_VERBOSE=yes assert::shellcheck @@ -84,14 +107,11 @@ main () { md::test ;; --feed) - html::test - md::test gemfeed::generate atomfeed::generate ;; --generate) - html::test - md::test + log INFO 'Generating feeds - this may will take a while' gemfeed::generate & atomfeed::generate & notes::generate & @@ -111,6 +131,9 @@ main () { --version) echo "This is gemtexter version $VERSION $VERSION_DESCR" ;; + --draft) + generate::draft html md + ;; --publish) $0 --generate $0 --git @@ -123,5 +146,5 @@ main () { return 0 } -main "$ARG" +main exit $? diff --git a/gemtexter-paul.buetow.org.conf b/gemtexter-paul.buetow.org.conf new file mode 100644 index 0000000..2f9c377 --- /dev/null +++ b/gemtexter-paul.buetow.org.conf @@ -0,0 +1,15 @@ +# Alternate config for my other domain +declare -xr DOMAIN=paul.buetow.org +declare -xr SUBTITLE="Paul Buetow's contact information" +declare -xr AUTHOR='Paul Buetow' +declare -xr EMAIL='paul@buetow.org' +declare -xr IMAGE_PATTERN='\.(jpg|png|gif)$' +declare -xr ATOM_MAX_ENTRIES=42 +declare -xr CONTENT_BASE_DIR=../paul.buetow.org-content +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/gemtexter-snonux.land.conf b/gemtexter-snonux.land.conf index 32060a7..7ff6084 100644 --- a/gemtexter-snonux.land.conf +++ b/gemtexter-snonux.land.conf @@ -1,6 +1,7 @@ +# Alternate config for my other domain declare -xr DOMAIN=snonux.land declare -xr SUBTITLE='Doublethink!' -declare -xr AUTHOR='Snonux' +declare -xr AUTHOR='snonux' declare -xr EMAIL='snonux@snonux.land' declare -xr IMAGE_PATTERN='\.(jpg|png|gif)$' declare -xr ATOM_MAX_ENTRIES=42 diff --git a/gemtexter.conf b/gemtexter.conf index 004c4eb..9c2d374 100644 --- a/gemtexter.conf +++ b/gemtexter.conf @@ -8,7 +8,7 @@ declare -xr CONTENT_BASE_DIR=../foo.zone-content 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_TEXT=./extras/html/oxygen/Oxygen-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/atomfeed.source.sh b/lib/atomfeed.source.sh index 716ef5c..65afa5a 100644 --- a/lib/atomfeed.source.sh +++ b/lib/atomfeed.source.sh @@ -32,27 +32,65 @@ META cat "$meta_file" } -# Retrieve the core content as XHTML of the blog post. -atomfeed::content () { +atomfeed::_from_cache () { local -r gmi_file_path="$1"; shift - log VERBOSE "Retrieving feed content from $gmi_file_path" + local -r cache_file_path="$1"; shift + + if [ ! -f "${cache_file_path}.info" ]; then + # No cache there. + return 1 + elif ! diff "${cache_file_path}.info" <(ls -l "$gmi_file_path"); then + # Need to refresh the cache. + return 1 + fi + + log VERBOSE "Retrieving feed content for $gmi_file_path from $cache_file_path" + cat "$cache_file_path" +} + +atomfeed::_make_cache () { + local -r gmi_file_path="$1"; shift + local -r cache_file_path="$1"; shift + + log VERBOSE "Making feed content cache from $gmi_file_path" + + local -r cache_file_dir="$(dirname "$cache_file_path")" + if [ ! -d "$cache_file_dir" ]; then + mkdir -p "$cache_file_dir" + fi # sed: Remove all before the first header # sed: Make HTML links absolute, Atom relative URLs feature seems a mess # across different Atom clients. html::fromgmi < <($SED '/Go back to the main site/d' "$gmi_file_path") | - $SED " - s|href=\"\./|href=\"https://$DOMAIN/gemfeed/|g; - s|src=\"\./|src=\"https://$DOMAIN/gemfeed/|g; - " + $SED "s|href=\"\./|href=\"https://$DOMAIN/gemfeed/|g; + s|src=\"\./|src=\"https://$DOMAIN/gemfeed/|g;" | + tee "$cache_file_path" + + ls -l "$gmi_file_path" > "${cache_file_path}.info" +} + +# Retrieve the core content as XHTML of the blog post. +atomfeed::content () { + local -r gmi_file_path="$1"; shift + local -r cache_file_path="${gmi_file_path/gemtext/cache}.atomcache" + + atomfeed::_from_cache "$gmi_file_path" "$cache_file_path" || + atomfeed::_make_cache "$gmi_file_path" "$cache_file_path" } # Generate an atom.xml feed file. atomfeed::generate () { local -r gemfeed_dir="$CONTENT_BASE_DIR/gemtext/gemfeed" + if [ ! -d "$gemfeed_dir" ]; then + return + fi + local -r atom_file="$gemfeed_dir/atom.xml" local -r now=$($DATE --iso-8601=seconds) + log INFO "Generating Atom feed to $atom_file" + log INFO 'This may takes a while with an empty cache....' assert::not_empty now "$now" diff --git a/lib/gemfeed.source.sh b/lib/gemfeed.source.sh index 1b2ee5c..6cb9a5a 100644 --- a/lib/gemfeed.source.sh +++ b/lib/gemfeed.source.sh @@ -3,9 +3,7 @@ gemfeed::get_posts () { local -r gemfeed_dir="$CONTENT_BASE_DIR/gemtext/gemfeed" local -r gmi_pattern='^[0-9]{4}-[0-9]{2}-[0-9]{2}-.*\.gmi$' - ls "$gemfeed_dir" | - $GREP -E "$gmi_pattern" | - sort -r + ls "$gemfeed_dir" | $GREP -f -v DRAFT- | $GREP -E "$gmi_pattern" | sort -r } # Add the links from gemfeed/index.gmi to the main index site. @@ -32,6 +30,11 @@ gemfeed::_get_word_count () { # Generate a index.gmi in the ./gemfeed subdir. gemfeed::generate () { local -r gemfeed_dir="$CONTENT_BASE_DIR/gemtext/gemfeed" + if [ ! -d "$gemfeed_dir" ]; then + log INFO "Capsule without Gemfeed" + return + fi + log INFO "Generating Gemfeed index for $gemfeed_dir" cat <<GEMFEED > "$gemfeed_dir/index.gmi.tmp" diff --git a/lib/generate.source.sh b/lib/generate.source.sh index b2dafbc..9a9e90b 100644 --- a/lib/generate.source.sh +++ b/lib/generate.source.sh @@ -63,6 +63,10 @@ generate::convert_gmi_atom_to_html_atom () { return fi + if [ ! -f "$CONTENT_BASE_DIR/gemtext/gemfeed/atom.xml" ]; then + return + fi + log INFO 'Converting Gemtext Atom feed to HTML Atom feed' $SED 's|.gmi|.html|g; s|gemini://|https://|g' \ @@ -124,6 +128,11 @@ generate::fromgmi () { # Add content while read -r src; do + # User can specify a content filter + if test ! -z "$CONTENT_FILTER" && ! $GREP -q "$CONTENT_FILTER" <<< "$src"; then + continue + fi + num_gmi_files=$(( num_gmi_files + 1 )) log INFO "Generating output formats from $src" for format in "$@"; do @@ -176,3 +185,16 @@ generate::fromgmi () { done log INFO "You may want to commit all changes to version control!" } + +# Only generate draft posts +generate::draft () { + if [ ! -z "$CONTENT_FILTER" ]; then + log ERROR "ERROR, you can't set a content filter manually in draft mode" + exit 2 + fi + CONTENT_FILTER=DRAFT- + generate::fromgmi $@ + + log INFO 'For HTML preview, open in your browser:' + find $CONTENT_BASE_DIR/html -name DRAFT-\*.html +} diff --git a/lib/html.source.sh b/lib/html.source.sh index c303d2e..03bbb45 100644 --- a/lib/html.source.sh +++ b/lib/html.source.sh @@ -98,7 +98,8 @@ html::fromgmi () { while IFS='' read -r line; do if [[ "$is_list" == yes ]]; then if [[ "$line" == '* '* ]]; then - echo "<li>$(html::encode "${line/\* /}")</li>" + echo "<li>$(html::encode "${line/\* /}")</li>" | + html::process_inline else is_list=no echo "</ul>" diff --git a/lib/notes.source.sh b/lib/notes.source.sh index b82631d..0f5251d 100644 --- a/lib/notes.source.sh +++ b/lib/notes.source.sh @@ -11,6 +11,11 @@ notes::_get_notes () { # Generate a index.gmi in the ./notes subdir. notes::generate () { local -r notes_dir="$CONTENT_BASE_DIR/gemtext/notes" + if [ ! -d "$notes_dir" ]; then + log INFO "Capsule without Notes section" + return + fi + log INFO "Generating Notes index for $notes_dir" cat <<NOTES > "$notes_dir/index.gmi.tmp" |
