From: Daniel Liu Date: Thu, 29 Jul 2021 03:43:01 +0000 (-0400) Subject: slightly shady paragraphs X-Git-Url: https://git.danieliu.xyz/?a=commitdiff_plain;h=394bc43d24de087865fa4eed1920411c1a6d7ebd;p=pinopress.git slightly shady paragraphs --- diff --git a/README.md b/README.md index 4328dcb..b4e5b41 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # pinopress **pinopress** is a modular makefile based static blog generator. that means you run the build script once and every page is generated beforehand. +**pinopress** also focuses on extensibility, you can hook your own shell scripts into the build process to easily add any new features. built in features include markdown generated blog articles, and a rss feed. diff --git a/modules/md b/modules/md index 3ce8979..7831638 100755 --- a/modules/md +++ b/modules/md @@ -13,6 +13,9 @@ } } +# html style comments (this will also work inside code blocks - unintended) +//d + # special html characters s/\&/\&\;/g s//\>\;/g # if it is the first one, add READING to hold space s/.*/READING/ x - # write opening tag - s/.*// + # write opening tag (also concat with next line) + N + s/.*\n(.*)/
\1/
         b
     }
     # if its the second ```, we are done
@@ -36,7 +40,8 @@ s/>/\>\;/g
     s/.*//
     x
     # then write closing tag
-    s/.*/<\\code>/
+    s/.*/<\/code><\/pre>/
+    b
 }
 
 # if we aren't reading ```, but hold space has READING in it
@@ -50,9 +55,6 @@ x
 x
 
 
-# html style comments
-//d
-
 # horizontal rule
 s/^\s*-{3,}\s*$//
 
@@ -70,7 +72,7 @@ s/(^|[^\\~])~{2}([^~]+)~{2}([^~]|$)/\1\2<\/del>\3/g
 s/!\[(.*)\]\((.*)\)/\1/g
 
 # links
-s/\[(.*)\]\((.*)\)/\2<\/a>/g
+s/\[(.*)\]\((.*)\)/\1<\/a>/g
 s/\[(.*)\]/\1<\/a>/g
 
 # headers
@@ -79,11 +81,19 @@ s/^#{5} (.*)/
\1<\/h5>/ s/^#{4} (.*)/

\1<\/h4>/ s/^#{3} (.*)/

\1<\/h3>/ s/^#{2} (.*)/

\1<\/h2>/ -s/^#} (.*)/

\1<\/h1>/ +s/^# (.*)/

\1<\/h1>/ -# paragraphs - -# /./{H;$!d} ; x ; s/^/\n

/ ; s/$/\n<\/p>/ +# lists +# paragraphs (blocks of text separated by one or more blank lines) +/./ { + H + $!d +} +x +/(^$|^\s+$)/ !{ + s/^/\n

/ + s/$/\n<\/p>/ +} diff --git a/modules/md-test b/modules/md-test index 8f52d8f..3f20b0c 100644 --- a/modules/md-test +++ b/modules/md-test @@ -56,6 +56,13 @@ write code here ``` +``` +this is +a code +block +write +code here +``` ``` another code diff --git a/pinopress b/pinopress index 3469586..3623b2f 100755 --- a/pinopress +++ b/pinopress @@ -69,6 +69,7 @@ $(BUILD_DIR)/$(ARTICLE_PATH)/%.html: $(SRC_DIR)/%.md echo "parsing $<" $(export_common) $(call export_article,"$<") + . ./$(MODULE_DIR)/md-header "$<" cat $(TEMPLATE_DIR)/head.template.html > "$@" # module pipeline starts here ./$(MODULE_DIR)/md "$^" >> "$@"