mirror of
https://github.com/alvierahman90/gronk.git
synced 2024-11-22 07:19:53 +00:00
add config options for article template, listitem template, index template, stylesheet
This commit is contained in:
parent
dd134e2cba
commit
8dbab1b9f2
21
notes2web
21
notes2web
@ -3,11 +3,24 @@
|
||||
[[ "$1" == "--help" ]] && echo "USAGE: $0 [NOTES_DIRECTORY_1 [NOTES_DIRECTORY_2 [...]]]" && exit 0
|
||||
|
||||
|
||||
# set default config values, load user config, export config variables
|
||||
name=""
|
||||
article_template="/opt/notes2web/templates/article.html"
|
||||
listitem_template="/opt/notes2web/templates/listitem.html"
|
||||
index_template="/opt/notes2web/templates/index.html"
|
||||
stylesheet="/opt/notes2web/styles.css"
|
||||
|
||||
for configpath in "$HOME/.notes2web.conf" "$HOME/.config/notes2web/config" ".notes2web.conf"
|
||||
do
|
||||
[[ -f "$configpath" ]] && source "$configpath"
|
||||
done
|
||||
|
||||
export name
|
||||
export article_template
|
||||
export listitem_template
|
||||
export index_template
|
||||
export stylesheet
|
||||
|
||||
|
||||
function _renderarticle {
|
||||
echo "rendering $1"
|
||||
@ -15,7 +28,7 @@ function _renderarticle {
|
||||
--toc\
|
||||
--standalone\
|
||||
-t html\
|
||||
--template /opt/notes2web/templates/article.html\
|
||||
--template "$article_template"\
|
||||
-o "$(dirname "$1")/index.html"\
|
||||
"$1"\
|
||||
--mathjax
|
||||
@ -34,7 +47,7 @@ function _addarticletoindex {
|
||||
pandoc\
|
||||
-t html\
|
||||
-V "filepath=$(dirname "$1")"\
|
||||
--template /opt/notes2web/templates/listitem.html\
|
||||
--template "$listitem_template"\
|
||||
"$1"\
|
||||
>> index.md
|
||||
}
|
||||
@ -70,12 +83,12 @@ find -name '.2web' -exec bash -c "_adddirtoindex '{}'" \;
|
||||
|
||||
|
||||
echo "copying styles.css to current directory"
|
||||
cp /opt/notes2web/styles.css .
|
||||
cp "$stylesheet" ./styles.css
|
||||
|
||||
|
||||
echo "rendering index.md"
|
||||
pandoc\
|
||||
-t html\
|
||||
--template /opt/notes2web/templates/index.html\
|
||||
--template "$index_template"\
|
||||
-o index.html\
|
||||
"index.md"
|
||||
|
@ -31,10 +31,14 @@ Then you just have to point a webserver at your notes directory.
|
||||
|
||||
`notes2web` looks for a config file called `.notes2web.conf` in your current directory and your home
|
||||
directory.
|
||||
Right now the only config available is `name`:
|
||||
Default config values:
|
||||
|
||||
```bash
|
||||
name="alv"
|
||||
name=""
|
||||
article_template="/opt/notes2web/templates/article.html"
|
||||
listitem_template="/opt/notes2web/templates/listitem.html"
|
||||
index_template="/opt/notes2web/templates/index.html"
|
||||
stylesheet="/opt/notes2web/styles.css"
|
||||
```
|
||||
|
||||
If the name is not set, the title is set to 'notes'.
|
||||
|
Loading…
Reference in New Issue
Block a user