mirror of
https://github.com/alvierahman90/gronk.git
synced 2024-11-22 15:29:52 +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
|
[[ "$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"
|
for configpath in "$HOME/.notes2web.conf" "$HOME/.config/notes2web/config" ".notes2web.conf"
|
||||||
do
|
do
|
||||||
[[ -f "$configpath" ]] && source "$configpath"
|
[[ -f "$configpath" ]] && source "$configpath"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
export name
|
||||||
|
export article_template
|
||||||
|
export listitem_template
|
||||||
|
export index_template
|
||||||
|
export stylesheet
|
||||||
|
|
||||||
|
|
||||||
function _renderarticle {
|
function _renderarticle {
|
||||||
echo "rendering $1"
|
echo "rendering $1"
|
||||||
@ -15,7 +28,7 @@ function _renderarticle {
|
|||||||
--toc\
|
--toc\
|
||||||
--standalone\
|
--standalone\
|
||||||
-t html\
|
-t html\
|
||||||
--template /opt/notes2web/templates/article.html\
|
--template "$article_template"\
|
||||||
-o "$(dirname "$1")/index.html"\
|
-o "$(dirname "$1")/index.html"\
|
||||||
"$1"\
|
"$1"\
|
||||||
--mathjax
|
--mathjax
|
||||||
@ -34,7 +47,7 @@ function _addarticletoindex {
|
|||||||
pandoc\
|
pandoc\
|
||||||
-t html\
|
-t html\
|
||||||
-V "filepath=$(dirname "$1")"\
|
-V "filepath=$(dirname "$1")"\
|
||||||
--template /opt/notes2web/templates/listitem.html\
|
--template "$listitem_template"\
|
||||||
"$1"\
|
"$1"\
|
||||||
>> index.md
|
>> index.md
|
||||||
}
|
}
|
||||||
@ -70,12 +83,12 @@ find -name '.2web' -exec bash -c "_adddirtoindex '{}'" \;
|
|||||||
|
|
||||||
|
|
||||||
echo "copying styles.css to current directory"
|
echo "copying styles.css to current directory"
|
||||||
cp /opt/notes2web/styles.css .
|
cp "$stylesheet" ./styles.css
|
||||||
|
|
||||||
|
|
||||||
echo "rendering index.md"
|
echo "rendering index.md"
|
||||||
pandoc\
|
pandoc\
|
||||||
-t html\
|
-t html\
|
||||||
--template /opt/notes2web/templates/index.html\
|
--template "$index_template"\
|
||||||
-o index.html\
|
-o index.html\
|
||||||
"index.md"
|
"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
|
`notes2web` looks for a config file called `.notes2web.conf` in your current directory and your home
|
||||||
directory.
|
directory.
|
||||||
Right now the only config available is `name`:
|
Default config values:
|
||||||
|
|
||||||
```bash
|
```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'.
|
If the name is not set, the title is set to 'notes'.
|
||||||
|
Loading…
Reference in New Issue
Block a user