mkpage has been rewritten
This commit is contained in:
parent
c567cf6f34
commit
ba50b03bcd
13
CHANGELOG
13
CHANGELOG
|
@ -1,5 +1,8 @@
|
||||||
[2021.07.28]
|
2021-08-17 Nova <novaburst@tilde.team>
|
||||||
- Added the ability of loading a config.cfg file like 'saait' does
|
* mkpage has been rewritten, now it supports both HTML and Markdown
|
||||||
- Renamed generate.sh to gensite
|
|
||||||
- Renamed create.sh to mkpage
|
2021-07-28 Nova <novaburst@tilde.team>
|
||||||
- Implemented UUIDs as filenames and added two more fields on the generated pages (inspired from Logarion)
|
* Added the ability of loading a config.cfg file like 'saait' does
|
||||||
|
* Renamed generate.sh to gensite
|
||||||
|
* Renamed create.sh to mkpage
|
||||||
|
* Implemented UUIDs as filenames and added two more fields on the generated pages (inspired from Logarion)
|
||||||
|
|
|
@ -13,7 +13,7 @@ As well featuring the `gensite` script and the ability to source configuration f
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
|
||||||
- `mkpage <title> <description> <author>`
|
- `mkpage <switch> <title> <description> <author>`
|
||||||
- `gensite`
|
- `gensite`
|
||||||
|
|
||||||
Features
|
Features
|
||||||
|
|
64
mkpage
64
mkpage
|
@ -1,29 +1,51 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Metadata generator for static-site-scripts
|
# Metadata generator for static-site-scripts
|
||||||
# It also creates the associated markdown pages
|
# It can also generate either the markdown pages or the html pages
|
||||||
|
|
||||||
# Program's arguments
|
VERSION=$(git rev-parse --short HEAD)
|
||||||
# $1 = Title
|
|
||||||
# $2 = Description
|
|
||||||
# $3 = Author
|
|
||||||
|
|
||||||
page_id="$(uuidgen)"
|
page_id="$(uuidgen)"
|
||||||
|
|
||||||
cat << EOF > pages/${page_id}.sh
|
gen_html() {
|
||||||
#!/bin/sh
|
touch pages/${page_id}.html
|
||||||
title="$1"
|
}
|
||||||
description="$2"
|
gen_markdown() {
|
||||||
timecreated="$(date +%Y-%m-%d)"
|
touch pages/${page_id}.md
|
||||||
timeupdated="$(date +%Y-%m-%d)"
|
}
|
||||||
author="$3"
|
gen_metadata() {
|
||||||
id="${page_id}"
|
cat << EOF > pages/${page_id}.sh
|
||||||
url="${page_id}.html"
|
#!/bin/sh
|
||||||
#tags="$6"
|
title="$2"
|
||||||
#keywords="$7"
|
description="$3"
|
||||||
#categories="$8"
|
timecreated="$(date +%Y-%m-%d)"
|
||||||
#timestamp="${timecreated}"
|
timeupdated="$(date +%Y-%m-%d)"
|
||||||
#author=""
|
author="$4"
|
||||||
#content="custom stuff"
|
id="${page_id}"
|
||||||
|
url="${page_id}.html"
|
||||||
EOF
|
EOF
|
||||||
|
}
|
||||||
|
show_help() {
|
||||||
|
printf "\t${0}\n"
|
||||||
|
printf "\tpart of static-site-scripts , version ${VERSION}\n"
|
||||||
|
printf "\n"
|
||||||
|
printf "\t-htm <title> <description> <author> \tGenerate metadata + html file\n"
|
||||||
|
printf "\t-md <title> <description> <author> \tGenerate metadata + markdown file\n"
|
||||||
|
printf "\t--help\tShow this help page\n"
|
||||||
|
}
|
||||||
|
|
||||||
touch pages/${page_id}.md
|
case "$1" in
|
||||||
|
-htm)
|
||||||
|
gen_metadata "$2" "$3" "$4"
|
||||||
|
gen_html
|
||||||
|
;;
|
||||||
|
-md)
|
||||||
|
gen_metadata "$2" "$3" "$4"
|
||||||
|
gen_markdown
|
||||||
|
;;
|
||||||
|
--help)
|
||||||
|
show_help
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
show_help
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
Loading…
Reference in New Issue