summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill <bill@billserver.senders.io>2022-11-06 11:42:43 -0500
committerBill <bill@billserver.senders.io>2022-11-06 11:44:09 -0500
commit75fe6dd67e4affaa5d97d467fd2c30a163d90712 (patch)
treecf52f0e0b3cd8530a2bff9af2a9c18457267aea6
parent768f44a55bf757abe1bfc0829de301ade964354e (diff)
Add script for blog publishing
Since a blog is written to the index.html its fairly easy to provide just the date and the md file. There still requires the line writing to the Blog Index. Also suppress warning exit from tidy which outputs a 1 if warnings and a 2 if errors were present. This method allows tidy.sh to be scriptable making warnings only return a 0 as well (so I can still use set -e in the scripts)
-rw-r--r--mds/blog/converting-form-mds.md2
-rwxr-xr-xpublish-blog.sh44
-rw-r--r--tidy.conf1
-rwxr-xr-xtidy.sh6
-rw-r--r--www/blog/2022-11-06/index.html2
5 files changed, 53 insertions, 2 deletions
diff --git a/mds/blog/converting-form-mds.md b/mds/blog/converting-form-mds.md
index ee5e6a8..b1847bb 100644
--- a/mds/blog/converting-form-mds.md
+++ b/mds/blog/converting-form-mds.md
@@ -79,7 +79,7 @@ links interfering with the text.
<figure>
> Like Gopher (and unlike Markdown or HTML), Gemtext only lets you put links to other documents on a line of their own. You can't make a single word in the middle of a sentence into a link. This takes a little getting used to, but it means that links are extremely easy to find, and clients can style them differently (e.g. to make it clear which protocol they use, or to display the domain name to help users decide whether they want to follow them or not) without interfering with the readability of your actual textual content.
-<figcaption>--- <cite>[gemini.circumlunar.space -- A quite introduction to "gemtext" markup | Links](https://gemini.circumlunar.space/docs/gemtext.gmi)</cite></figcaption>
+<figcaption>--- <cite>[gemini.circumlunar.space -- A quick introduction to "gemtext" markup | Links](https://gemini.circumlunar.space/docs/gemtext.gmi)</cite></figcaption>
</figure>
I felt that this provided a lot of useful limitations that removed a huge barrier for me to actually write down ideas without feeling over burdened. I also lurked in the IRC - as well as [implemented my own gemini server](https://github.com/s3nd3r5/java-gemini-server).
diff --git a/publish-blog.sh b/publish-blog.sh
new file mode 100755
index 0000000..e36ee63
--- /dev/null
+++ b/publish-blog.sh
@@ -0,0 +1,44 @@
+set -ex
+
+if [ $# -gt 2 ]; then
+ echo "./publish-blog.sh [isodate] mds/blog/blog-file.md"
+ exit 1
+fi
+
+if [ $# -lt 1 ]; then
+ echo "./publish-blog.sh [isodate] mds/blog/blog-file.md"
+ exit 1
+fi
+
+# Setup Dates
+
+isodate=$(date -I)
+date=$(date +"%B %d, %Y")
+if [ $# -eq 2 ]; then
+ isodate=$1
+ date=$(date --date="${isodate}" +"%B %d, %Y")
+ in=$2
+else
+ in=$1
+fi
+
+# Get Page Title
+
+title=$(head -n1 $in | sed -E 's/^##[[:space:]]*(.+)[[:space:]]*$/\1/g')
+
+# File info
+path=www/blog/${isodate}
+out=${path}/index.html
+
+# Make path
+
+mkdir -p ${path}
+
+# Compile md
+
+./compile-md.sh blog "${title}" $in $out
+
+# Update date
+
+sed -E -i "s/BLOG_DATE/${date}/" $out
+
diff --git a/tidy.conf b/tidy.conf
index e24e370..f43552a 100644
--- a/tidy.conf
+++ b/tidy.conf
@@ -9,3 +9,4 @@ quote-ampersand: no
uppercase-tags: no
uppercase-attributes: no
new-pre-tags: code,
+show-warnings: no
diff --git a/tidy.sh b/tidy.sh
index 6fd975e..6efdb2d 100755
--- a/tidy.sh
+++ b/tidy.sh
@@ -2,6 +2,12 @@
if [ $# == 0 ]; then
find www/ -name '*.html' -type f -print -exec tidy -mq -config tidy.conf '{}' \;
+ if [ $? -lt 2 ]; then
+ exit 0
+ fi
else
tidy -mq -config tidy.conf $@
+ if [ $? -lt 2 ]; then
+ exit 0
+ fi
fi
diff --git a/www/blog/2022-11-06/index.html b/www/blog/2022-11-06/index.html
index 4a1983b..d58e1cb 100644
--- a/www/blog/2022-11-06/index.html
+++ b/www/blog/2022-11-06/index.html
@@ -146,7 +146,7 @@
target="_blank"
href=
"https://gemini.circumlunar.space/docs/gemtext.gmi">gemini.circumlunar.space
- – A quite introduction to “gemtext” markup | Links</a></cite>
+ – A quick introduction to “gemtext” markup | Links</a></cite>
</figcaption>
</figure>
<p>I felt that this provided a lot of useful limitations that removed a