mkpage has been rewritten
This commit is contained in:
parent
c567cf6f34
commit
ba50b03bcd
13
CHANGELOG
13
CHANGELOG
|
@ -1,5 +1,8 @@
|
|||
[2021.07.28]
|
||||
- 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)
|
||||
2021-08-17 Nova <novaburst@tilde.team>
|
||||
* mkpage has been rewritten, now it supports both HTML and Markdown
|
||||
|
||||
2021-07-28 Nova <novaburst@tilde.team>
|
||||
* 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
|
||||
-----
|
||||
|
||||
- `mkpage <title> <description> <author>`
|
||||
- `mkpage <switch> <title> <description> <author>`
|
||||
- `gensite`
|
||||
|
||||
Features
|
||||
|
|
64
mkpage
64
mkpage
|
@ -1,29 +1,51 @@
|
|||
#!/bin/sh
|
||||
# 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
|
||||
# $1 = Title
|
||||
# $2 = Description
|
||||
# $3 = Author
|
||||
VERSION=$(git rev-parse --short HEAD)
|
||||
|
||||
page_id="$(uuidgen)"
|
||||
|
||||
cat << EOF > pages/${page_id}.sh
|
||||
#!/bin/sh
|
||||
title="$1"
|
||||
description="$2"
|
||||
timecreated="$(date +%Y-%m-%d)"
|
||||
timeupdated="$(date +%Y-%m-%d)"
|
||||
author="$3"
|
||||
id="${page_id}"
|
||||
url="${page_id}.html"
|
||||
#tags="$6"
|
||||
#keywords="$7"
|
||||
#categories="$8"
|
||||
#timestamp="${timecreated}"
|
||||
#author=""
|
||||
#content="custom stuff"
|
||||
gen_html() {
|
||||
touch pages/${page_id}.html
|
||||
}
|
||||
gen_markdown() {
|
||||
touch pages/${page_id}.md
|
||||
}
|
||||
gen_metadata() {
|
||||
cat << EOF > pages/${page_id}.sh
|
||||
#!/bin/sh
|
||||
title="$2"
|
||||
description="$3"
|
||||
timecreated="$(date +%Y-%m-%d)"
|
||||
timeupdated="$(date +%Y-%m-%d)"
|
||||
author="$4"
|
||||
id="${page_id}"
|
||||
url="${page_id}.html"
|
||||
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