Updated mkpage and README.md.

Signed-off-by: Aoi Koizumi <novaburst@kalli.st>
This commit is contained in:
Aoi Koizumi 2022-02-02 20:00:03 -03:00
parent 21f64d8f8f
commit 29a14cced9
2 changed files with 13 additions and 12 deletions

View File

@ -37,8 +37,10 @@ The content filename is the basename of the shellscript with the type of
markup file appended to it (.html or .md), for example the file markup file appended to it (.html or .md), for example the file
pages/html-example.html. pages/html-example.html.
If `mkpage` is used the filename is an UUID and a .md file with the same name. If `mkpage` is used the filename is a value from `openssl rand -hex 3` and a .md file with the same name.
Example: 082ea44f-8633-4dc9-9ff2-f25ee6618013.sh + 082ea44f-8633-4dc9-9ff2-f25ee6618013.md => output/082ea44f-8633-4dc9-9ff2-f25ee6618013.html Example: ddc7ac.sh + ddc7ac.md => output/ddc7ac.html
(either LibreSSL or regular OpenSSL should work)
Markdown is supported. By default "smu"[0] is set as a Markdown processor, Markdown is supported. By default "smu"[0] is set as a Markdown processor,
to change this set $markdown to your favorite Markdown-to-HTML converter in to change this set $markdown to your favorite Markdown-to-HTML converter in

19
mkpage Normal file → Executable file
View File

@ -2,10 +2,9 @@
# Metadata generator for static-site-scripts # Metadata generator for static-site-scripts
# It can also generate either the markdown pages or the html pages # It can also generate either the markdown pages or the html pages
UUID_GEN_TOOL="uuidgen"
VERSION=$(git rev-parse --short HEAD) VERSION=$(git rev-parse --short HEAD)
page_id="$(which $UUID_GEN_TOOL)" page_id="$(openssl rand -hex 3)"
gen_html() { gen_html() {
touch pages/${page_id}.html touch pages/${page_id}.html
@ -15,14 +14,14 @@ gen_markdown() {
} }
gen_metadata() { gen_metadata() {
cat << EOF > pages/${page_id}.sh cat << EOF > pages/${page_id}.sh
#!/bin/sh #!/bin/sh
title="$2" title="$2"
description="$3" description="$3"
timecreated="$(date +%Y-%m-%d)" timecreated="$(date +%Y-%m-%d)"
timeupdated="$(date +%Y-%m-%d)" timeupdated="$(date +%Y-%m-%d)"
author="$4" author="$4"
id="${page_id}" id="${page_id}"
url="${page_id}.html" url="${page_id}.html"
EOF EOF
} }
show_help() { show_help() {