summaryrefslogtreecommitdiff
path: root/.local/bin/ssg
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2021-03-03 22:47:20 -0700
committerDavid Luevano Alvarado <david@luevano.xyz>2021-03-03 22:47:20 -0700
commit48ad841f56bb73da2734f571507ece7848615e61 (patch)
treea2eb2fb31cf232fe5479489324b57a6dd573451e /.local/bin/ssg
parent3aea44014574efbb1fc7a2696ee1ee74c40fa95f (diff)
DELETE i3GAPS BLOCKS that I forgot, slightly changes to blog management tools
Diffstat (limited to '.local/bin/ssg')
-rwxr-xr-x.local/bin/ssg24
1 files changed, 20 insertions, 4 deletions
diff --git a/.local/bin/ssg b/.local/bin/ssg
index 5339958..805fd83 100755
--- a/.local/bin/ssg
+++ b/.local/bin/ssg
@@ -101,6 +101,8 @@ main() {
test -n "$urls" &&
render_sitemap "$urls" "$base_url" "$date" > "$dst/sitemap.xml"
+ render_article_list "$urls" "$base_url" "$dst" "$src"
+
print_status 'url' 'urls' "$urls" >&2
echo >&2
}
@@ -189,9 +191,10 @@ render_md_files_lowdown() {
while read -r f
do
lowdown \
- -D html-skiphtml \
- -d metadata \
- -d autolink < "$1/$f" |
+ --html-no-skiphtml \
+ --html-no-escapehtml \
+ --html-no-owasp \
+ --html-no-head-ids < "$1/$f" |
render_html_file "$3" \
> "$2/${f%\.md}.html"
done
@@ -237,13 +240,26 @@ render_html_file() {
}'
}
-
list_pages() {
e="\\( -name '*.html' -o -name '*.md' \\)"
cd "$1" && eval "find . -type f ! -path '*/.*' ! -path '*/_*' $IGNORE $e" |
sed 's#^./##;s#.md$#.html#;s#/index.html$#/#'
}
+render_article_list() {
+ urls="$1"
+ base_url="$2"
+ items=""
+ for i in $1; do
+ if ! echo $i | grep "index"; then
+ url="$i"
+ page_title=$(head -n 1 "$4/${i%\.html}.md" | cut -c 3-)
+ item="<li><a href=https://blog.luevano.xyz/${url}>${page_title}</a></li>"
+ items=$items$item
+ fi
+ done
+ sed -i "s|<hr/>|<ul class="articles">${items}</ul>|g" "$3/index.html"
+}
render_sitemap() {
urls="$1"