From 41ea1757508169957d0ff91ccd94ffea5cc676be Mon Sep 17 00:00:00 2001 From: Mohit Agarwal Date: Fri, 14 Mar 2025 18:37:19 +0000 Subject: Initial commit. --- 2024-06-22-sample.md | 15 +++++ feed.sh | 111 ++++++++++++++++++++++++++++++++++ feed.xml | 15 +++++ images/portrait.jpg | Bin 0 -> 92337 bytes index.html | 16 +++++ make | 125 ++++++++++++++++++++++++++++++++++++++ static/document.css | 145 +++++++++++++++++++++++++++++++++++++++++++++ static/style.css | 12 ++++ unmono/document.css | 145 +++++++++++++++++++++++++++++++++++++++++++++ unmono/feed.xml | 15 +++++ unmono/images/portrait.jpg | Bin 0 -> 92337 bytes unmono/style.css | 12 ++++ 12 files changed, 611 insertions(+) create mode 100644 2024-06-22-sample.md create mode 100755 feed.sh create mode 100644 feed.xml create mode 100644 images/portrait.jpg create mode 100644 index.html create mode 100755 make create mode 100644 static/document.css create mode 100644 static/style.css create mode 100644 unmono/document.css create mode 100644 unmono/feed.xml create mode 100644 unmono/images/portrait.jpg create mode 100644 unmono/style.css diff --git a/2024-06-22-sample.md b/2024-06-22-sample.md new file mode 100644 index 0000000..1edf203 --- /dev/null +++ b/2024-06-22-sample.md @@ -0,0 +1,15 @@ +--- +author: Author Name +--- +# My first post + +This is my very first blog post! + +## This is a section header + +### This is a subsection a header + +This is a paragraph of text. The quick brown fox jumps over the lazy +dog. Here is some more text. + +![Alt text for an image](./images/portrait.jpg "Image on my first post") diff --git a/feed.sh b/feed.sh new file mode 100755 index 0000000..44df5fb --- /dev/null +++ b/feed.sh @@ -0,0 +1,111 @@ +#!/bin/bash + +# taken from https://github.com/maxhebditch/rss-roller/ +# modified by Mohit Agarwal + + +# Configuration +title="Unorthodox Monologues" +link="https://mohit.uk/blogs/unmono" +description="Abby's Blog" +rsslink="$link/feed.xml" +feedname="./feed.xml" +postDir="./unmono/" + + +echo "./feed.sh------------------------------------------------" +echo " Feed builder RSS/ATOM" +echo " Written by Mohit Agarwal" +echo " INTERNAL USE ONLY" +echo "---------------------------------------------------------" + +echo "" +echo "TITLE" $title +echo "LINK " $link +echo "RSS L" $rsslink +echo "RSS F" $feedname +echo "DESCR" $description +echo "POSTD" $postDir + + +header () { +echo """ + + +""" > ~/feedtop +echo """ + +$title +$link +$description + +""" >> ~/feedtop +} + +footer () { +echo """ + + +""" >> ~/feedbottom +} + +item () { + echo """ + $fullTitle + $linkadd + $guid + + $fullText + + + + $fullText + + + """ >> ~/feed + echo """ + $fullTitle + $linkadd + $guidadd + + """ >> ~/feed +} + +combine () { + header + footer + cat ~/feedtop ~/feed > ~/feedtb + cat ~/feedtb ~/feedbottom > $feedname + rm ~/feedtop ~/feed ~/feedtb ~/feedbottom +} + + + +if [[ ! -f $feedname ]]; then + touch $feedname +fi + +echo "" +echo "BUILDING FEED" +#Do the bad thing +if [[ -f $feedname ]]; then + rm $feedname +fi +touch $feedname +postArray=( $(ls -r "$postDir"/*.html | grep -v index.html) ) +numPosts=$(ls -r "$postDir"/*.html | grep -v index.html | wc -l) +echo "numPosts is $numPosts" +postNum=0 +guidadd=$linkadd +for posts in "${postArray[@]}"; do + let postNum+=1 + post=$posts + echo " adding post $postNum/$numPosts : $post" + fullTitle=$(grep -o '>.*' $post | sed 's/\(>\|<\/h1>\)//g') + postname=${post##*/} + linkadd="$link"/"$postname" + fullText=$(pandoc ../${post/%html/md} -t html) + item $post +done +combine +exit diff --git a/feed.xml b/feed.xml new file mode 100644 index 0000000..11d4d34 --- /dev/null +++ b/feed.xml @@ -0,0 +1,15 @@ + + + + + + +Unorthodox Monologues +https://mohit.uk/blogs/unmono +Abby's Blog + + + + + + diff --git a/images/portrait.jpg b/images/portrait.jpg new file mode 100644 index 0000000..5b1e0aa Binary files /dev/null and b/images/portrait.jpg differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..1e52c8b --- /dev/null +++ b/index.html @@ -0,0 +1,16 @@ + + + + + + Unorthodox Monolgues + + + +

Unorthodox Monolgues

+error while converting 2024-06-22-sample.md +error while converting 2024-06-22-sample.md +
+

My first post

+22 Jun 2024 - Author Name +
diff --git a/make b/make new file mode 100755 index 0000000..8125bd4 --- /dev/null +++ b/make @@ -0,0 +1,125 @@ +#!/usr/bin/env bash +TITLE="Unorthodox Monolgues" +AUTHOR="Abigail Kelley" +EMAIL="UNMONO@MOHIT.UK" + +OUTFILE="unmono" +LANG="en_GB" + +# Convert a markdown file to HTML and store it in the OUTFILE +md2html() { + local file=$1 + + echo "Building $file..." >&2 + + filename_html=$OUTFILE/${file/%.md/.html} + filename_pdf=$OUTFILE/${file/%.md/.pdf} + + local args=( + "--email-obfuscation=references" + "--from=markdown+emoji" + "--metadata=lang:$LANG" + "--shift-heading-level-by=-1" + "--toc-depth=4" + ) + + local args_html=( + "--css=static/style.css" + "--css=static/document.css" + "--include-before-body=header.html" + "--include-in-header=headerlinks.html" + "--table-of-contents" + ) + + local args_pdf=( + "--pdf-engine=xelatex" + ) + + # args+=("--citeproc") # Citations + # args+=("--mathjax") # Mathematical rendering + + # args+=("--include-after-body=$goatcounter") + # args+=("--include-in-header=$favicon") + + if [[ $file == ????-??-??-* ]]; then + args+=("--metadata=date:$(fmtdate ${file:0:10})") + fi + + if [[ $file == 'index.md' ]]; then + args+=("--metadata=pagetitle:$TITLE") + fi + + if [[ $file -nt $filename_html ]]; then + pandoc "${args[@]}" "${args_html[@]}" -t html \ + --output=$OUTFILE/${file/%.md/.html} "$file" || echo "error while converting $file"; + pandoc "${args[@]}" "${args_pdf[@]}" -t pdf \ + --output=$OUTFILE/${file/%.md/.pdf} "$file" || echo "error while converting $file"; + fi +} + +extracttitle() { + local file=$1 + sed -n '/^# /{s///p;q}' "$file" +} + +extractauthor() { + grep "author" $f | sed 1q | cut -d":" -f 2 +} + +fmtdate() { + date --date="$1" "+%d %b %Y" +} + +# Build all pages +build() { + + echo "./make --------------------------------------------------" + echo " Blog builder" + echo " Written by Mohit Agarwal" + echo " FOR INTERNAL USE ONLY" + echo "---------------------------------------------------------" + + echo "" + echo "TITLE $TITLE" + + + # Build index file and convert posts + echo "" + echo "Building index.html and converting posts" + { + echo '' + echo '' + echo '' + echo '' + echo '' + echo " $TITLE " + echo '' + echo '' + echo '' + echo "

$TITLE

" + local f + for f in ????-??-??-*.md; do + echo '' + echo "$(fmtdate ${f:0:10}) - $(extractauthor "$f")" + echo "

$(extracttitle "$f")

" + echo '
' + md2html "$f" + done | tac + } > index.html + + ./feed.sh + + echo "" + echo "COPYING FILES" + cp -v index.html $OUTFILE/ + cp -vr static $OUTFILE/ + cp -vr images $OUTFILE/ + cp -vr feed.xml $OUTFILE/ + + echo "" + echo "BLOG PUBLISHED" + echo "---------------------------------------------------------" + echo "---------------------------------------------------------" +} + +build diff --git a/static/document.css b/static/document.css new file mode 100644 index 0000000..ae9562f --- /dev/null +++ b/static/document.css @@ -0,0 +1,145 @@ +html { + line-height: 1.6; + font-family: serif; + color: #1a1a1a; background-color: #eeeeee; +} +body { + margin: 0 auto; + max-width: 60ch; + + padding-left: 50px; padding-right: 50px; + padding-top: 10px; padding-bottom: 50px; + + hyphens: auto; + word-wrap: break-word; + text-rendering: optimizeLegibility; + font-kerning: normal; +} +p { margin: 1em 0; } +@media (max-width: 600px) { + body { padding: 1em; } + p { text-align: left; } +} +@media print { + body { + background-color: transparent; + color: black; + font-size: 12pt; + max-width: 80ch; + } + p, h2, h3 { + orphans: 3; + widows: 3; + } + h2, h3, h4 { + page-break-after: avoid; + } +} +a { + color: hotpink; +} +a:visited { + color: purple; +} +img { + max-width: 100%; +} +h1, h2, h3, h4, h5, h6 { + margin-top: 1.4em; +} +h5, h6 { + font-size: 1em; + font-style: italic; +} +h6 { + font-weight: normal; +} +h1 { + font-weight: 400; +} +h2, h3 { + font-weight: 300; +} +ol, ul { + padding-left: 1.7em; + margin-top: 1em; +} +li > ol, li > ul { + margin-top: 0; +} +blockquote { + margin: 1em 0 1em 1.7em; + padding-left: 1em; + border-left: 2px solid #e6e6e6; + color: #606060; +} +code { + font-family: monospace; + font-size: 85%; + margin: 0; +} +pre { + margin: 1em 0; + overflow: auto; +} +pre code { + padding: 0; + overflow: visible; +} +.sourceCode { + background-color: transparent; + overflow: visible; +} +hr { + background-color: #1a1a1a; + border: none; + height: 1px; + margin: 1em 0; +} +table { + margin: 1em 0; + width: 100%; + overflow-x: auto; + font-variant-numeric: lining-nums tabular-nums; +} +table caption { + margin-bottom: 0.75em; +} +tbody { + margin-top: 0.5em; + border-top: 1px solid #1a1a1a; + border-bottom: 1px solid #1a1a1a; +} +th { + border-top: 1px solid #1a1a1a; + padding: 0.25em 0.5em 0.25em 0.5em; +} +td { + padding: 0.125em 0.5em 0.25em 0.5em; +} +header { + text-align: left; + border-bottom: medium black solid; +} + +#TOC nav { border-bottom: medium black solid; } +#TOC li { list-style: none; } +#TOC a:not(:hover) { text-decoration: none; } + +code{white-space: pre-wrap;} +span.smallcaps{font-variant: small-caps;} +span.underline{text-decoration: underline;} +div.column{display: inline-block; vertical-align: top; width: 50%;} +div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} +ul.task-list{list-style: none;} +.display.math{display: block; text-align: center; margin: 0.5rem auto;} +.footnote-ref ~ .footnote-ref :before { + content: ', ' +} + +@media (prefers-color-scheme: dark){ + body {color:white;background:black} + html {color:white;background:black} + a:link, a:visited { color: #aab9c1; } + a:hover, a:active { color: hotpink; } /* hotpink on hover */ +} diff --git a/static/style.css b/static/style.css new file mode 100644 index 0000000..3531391 --- /dev/null +++ b/static/style.css @@ -0,0 +1,12 @@ +body { + max-width: 80ch; +} +.article { + border: thin solid black; + padding-right: 5ch; + padding-left: 5ch; + margin-bottom: 1ch; +} +.article .title { + margin-top: 0.35em; +} diff --git a/unmono/document.css b/unmono/document.css new file mode 100644 index 0000000..ae9562f --- /dev/null +++ b/unmono/document.css @@ -0,0 +1,145 @@ +html { + line-height: 1.6; + font-family: serif; + color: #1a1a1a; background-color: #eeeeee; +} +body { + margin: 0 auto; + max-width: 60ch; + + padding-left: 50px; padding-right: 50px; + padding-top: 10px; padding-bottom: 50px; + + hyphens: auto; + word-wrap: break-word; + text-rendering: optimizeLegibility; + font-kerning: normal; +} +p { margin: 1em 0; } +@media (max-width: 600px) { + body { padding: 1em; } + p { text-align: left; } +} +@media print { + body { + background-color: transparent; + color: black; + font-size: 12pt; + max-width: 80ch; + } + p, h2, h3 { + orphans: 3; + widows: 3; + } + h2, h3, h4 { + page-break-after: avoid; + } +} +a { + color: hotpink; +} +a:visited { + color: purple; +} +img { + max-width: 100%; +} +h1, h2, h3, h4, h5, h6 { + margin-top: 1.4em; +} +h5, h6 { + font-size: 1em; + font-style: italic; +} +h6 { + font-weight: normal; +} +h1 { + font-weight: 400; +} +h2, h3 { + font-weight: 300; +} +ol, ul { + padding-left: 1.7em; + margin-top: 1em; +} +li > ol, li > ul { + margin-top: 0; +} +blockquote { + margin: 1em 0 1em 1.7em; + padding-left: 1em; + border-left: 2px solid #e6e6e6; + color: #606060; +} +code { + font-family: monospace; + font-size: 85%; + margin: 0; +} +pre { + margin: 1em 0; + overflow: auto; +} +pre code { + padding: 0; + overflow: visible; +} +.sourceCode { + background-color: transparent; + overflow: visible; +} +hr { + background-color: #1a1a1a; + border: none; + height: 1px; + margin: 1em 0; +} +table { + margin: 1em 0; + width: 100%; + overflow-x: auto; + font-variant-numeric: lining-nums tabular-nums; +} +table caption { + margin-bottom: 0.75em; +} +tbody { + margin-top: 0.5em; + border-top: 1px solid #1a1a1a; + border-bottom: 1px solid #1a1a1a; +} +th { + border-top: 1px solid #1a1a1a; + padding: 0.25em 0.5em 0.25em 0.5em; +} +td { + padding: 0.125em 0.5em 0.25em 0.5em; +} +header { + text-align: left; + border-bottom: medium black solid; +} + +#TOC nav { border-bottom: medium black solid; } +#TOC li { list-style: none; } +#TOC a:not(:hover) { text-decoration: none; } + +code{white-space: pre-wrap;} +span.smallcaps{font-variant: small-caps;} +span.underline{text-decoration: underline;} +div.column{display: inline-block; vertical-align: top; width: 50%;} +div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} +ul.task-list{list-style: none;} +.display.math{display: block; text-align: center; margin: 0.5rem auto;} +.footnote-ref ~ .footnote-ref :before { + content: ', ' +} + +@media (prefers-color-scheme: dark){ + body {color:white;background:black} + html {color:white;background:black} + a:link, a:visited { color: #aab9c1; } + a:hover, a:active { color: hotpink; } /* hotpink on hover */ +} diff --git a/unmono/feed.xml b/unmono/feed.xml new file mode 100644 index 0000000..11d4d34 --- /dev/null +++ b/unmono/feed.xml @@ -0,0 +1,15 @@ + + + + + + +Unorthodox Monologues +https://mohit.uk/blogs/unmono +Abby's Blog + + + + + + diff --git a/unmono/images/portrait.jpg b/unmono/images/portrait.jpg new file mode 100644 index 0000000..5b1e0aa Binary files /dev/null and b/unmono/images/portrait.jpg differ diff --git a/unmono/style.css b/unmono/style.css new file mode 100644 index 0000000..3531391 --- /dev/null +++ b/unmono/style.css @@ -0,0 +1,12 @@ +body { + max-width: 80ch; +} +.article { + border: thin solid black; + padding-right: 5ch; + padding-left: 5ch; + margin-bottom: 1ch; +} +.article .title { + margin-top: 0.35em; +} -- cgit v1.2.3