summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Zangl <laktak@cdak.net>2023-12-26 16:16:52 +0100
committerGitHub <noreply@github.com>2023-12-26 16:16:52 +0100
commit488294588e5e9310295d9de8e2080c9cd625cd3f (patch)
tree600418883d579122aa505da826dab51c09428b38
parent27cbf9403cf3bb6667a7909f3eef25c78d8c0282 (diff)
generate doc with pandoc in docker (#1555)
-rwxr-xr-xgen/doc-with-docker.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/gen/doc-with-docker.sh b/gen/doc-with-docker.sh
new file mode 100755
index 0000000..7a7bed7
--- /dev/null
+++ b/gen/doc-with-docker.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Generates `lf.1` and `doc.txt` from the `doc.md` file.
+#
+# This script is used to generate a man page and a plain text conversion of the
+# markdown documentation using pandoc (https://pandoc.org/). GitHub Flavored
+# Markdown (GFM) (https://github.github.com/gfm/) is used for the markdown
+# input format. The markdown file is automatically rendered in the GitHub
+# repository (https://github.com/gokcehan/lf/blob/master/doc.md). The man page
+# file `lf.1` is meant to be used for installations on Unix systems. The plain
+# text file `doc.txt` is embedded in the binary to be displayed on request with
+# the `-doc` command line flag. Thus the same documentation is used for online
+# and terminal display.
+
+[ -z $version ] && version=$(git describe --tags)
+[ -z $date ] && date=$(date +%F)
+
+PANDOC_IMAGE=pandoc/minimal:2.11
+
+docker run --rm -v "$PWD:/data" --user "$(id -u):$(id -g)" $PANDOC_IMAGE \
+ --standalone \
+ --from gfm --to man \
+ --metadata=title:"LF" \
+ --metadata=section:"1" \
+ --metadata=date:"$date" \
+ --metadata=footer:"$version" \
+ --metadata=header:"DOCUMENTATION" \
+ doc.md -o lf.1
+
+docker run --rm -v "$PWD:/data" --user "$(id -u):$(id -g)" $PANDOC_IMAGE \
+ --standalone \
+ --from gfm --to plain \
+ doc.md -o doc.txt