From 12c2e63f83348fd57f50de4f43846889c03344c0 Mon Sep 17 00:00:00 2001
From: Alvie Rahman page generated by notes2web$(basename "$dir") notes
" >> index.md
find "$dir" -name '*.md' -exec bash -c "_addarticletoindex '{}'" \;
+ find "$dir" -not -path '**/.git/**' -not -name '*.md' -type f -exec bash -c "_addtextarticletoindex '{}'" \;
+}
+
+
+function _addtextarticletoindex {
+ [[ "$(file -b "$1")" == "ASCII text" ]] || exit
+ pandoc\
+ -t html\
+ -V "filepath=${1}.html"\
+ -V "title=$1"\
+ --template "$listitem_template"\
+ "$1"\
+ >> index.md
}
@@ -46,7 +73,7 @@ function _addarticletoindex {
echo "adding $1 to list of notes"
pandoc\
-t html\
- -V "filepath=$(dirname "$1")"\
+ -V "filepath=${1}.html"\
--template "$listitem_template"\
"$1"\
>> index.md
@@ -54,14 +81,17 @@ function _addarticletoindex {
export -f _renderarticle
+export -f _rendertextarticle
export -f _adddirtoindex
export -f _addarticletoindex
+export -f _addtextarticletoindex
#render each markdown file in every folder passed in args
-for file in "$@"
+for dir in "$@"
do
- find "$file" -name '*.md' -exec bash -c "_renderarticle '{}'" \;
+ find "$dir" -name '*.md' -exec bash -c "_renderarticle '{}'" \;
+ find "$dir" -not -path '**/.git/**' -not -name '*.md' -type f -exec bash -c "_rendertextarticle '{}'" \;
done
diff --git a/readme.md b/readme.md
index a2f3d31..2bfd634 100644
--- a/readme.md
+++ b/readme.md
@@ -36,6 +36,8 @@ Default config values:
```bash
name=""
article_template="/opt/notes2web/templates/article.html"
+textarticlehead_template="/opt/notes2web/templates/textarticlehead.html"
+textarticlefoot_template="/opt/notes2web/templates/textarticlefoot.html"
listitem_template="/opt/notes2web/templates/listitem.html"
index_template="/opt/notes2web/templates/index.html"
stylesheet="/opt/notes2web/styles.css"
diff --git a/templates/textarticlefoot.html b/templates/textarticlefoot.html
new file mode 100644
index 0000000..ae90cda
--- /dev/null
+++ b/templates/textarticlefoot.html
@@ -0,0 +1,3 @@
+
+
This file was not rendered by notes2head because it is a plaintext file, not a markdown + file. + Below is an unformatted representation of the file: +
+diff --git a/templates/textarticlehead.html b/templates/textarticlehead.html new file mode 100644 index 0000000..4396f82 --- /dev/null +++ b/templates/textarticlehead.html @@ -0,0 +1,15 @@ +
+ + + + +
+ + +