diff options
| -rw-r--r-- | 2024-06-22-sample.md | 15 | ||||
| -rwxr-xr-x | feed.sh | 111 | ||||
| -rw-r--r-- | feed.xml | 15 | ||||
| -rw-r--r-- | images/portrait.jpg | bin | 0 -> 92337 bytes | |||
| -rw-r--r-- | index.html | 16 | ||||
| -rwxr-xr-x | make | 125 | ||||
| -rw-r--r-- | static/document.css | 145 | ||||
| -rw-r--r-- | static/style.css | 12 | ||||
| -rw-r--r-- | unmono/document.css | 145 | ||||
| -rw-r--r-- | unmono/feed.xml | 15 | ||||
| -rw-r--r-- | unmono/images/portrait.jpg | bin | 0 -> 92337 bytes | |||
| -rw-r--r-- | unmono/style.css | 12 |
12 files changed, 611 insertions, 0 deletions
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. + + @@ -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 """<?xml version='1.0' encoding='UTF-8' ?> +<rss version='2.0' xmlns:atom='http://www.w3.org/2005/Atom'> +<!-- Made using rss-roller https://github.com/maxhebditch/rss-roller --> +""" > ~/feedtop +echo """ +<channel> +<title>$title</title> +<link>$link</link> +<description>$description</description> +<atom:link href='$rsslink' rel='self' type='application/rss+xml' /> +""" >> ~/feedtop +} + +footer () { +echo """ +</channel> +</rss> +""" >> ~/feedbottom +} + +item () { + echo """<item> + <title>$fullTitle</title> + <link>$linkadd</link> + <guid>$guid</guid> + <content> + $fullText + </content> + + <description> + $fullText + </description> + </item> + """ >> ~/feed + echo """<item> + <title>$fullTitle</title> + <link>$linkadd</link> + <guid isPermaLink='false'>$guidadd</guid> + </item> + """ >> ~/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 '>.*</h1>' $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 @@ +<?xml version='1.0' encoding='UTF-8' ?> +<rss version='2.0' xmlns:atom='http://www.w3.org/2005/Atom'> +<!-- Made using rss-roller https://github.com/maxhebditch/rss-roller --> + + +<channel> +<title>Unorthodox Monologues</title> +<link>https://mohit.uk/blogs/unmono</link> +<description>Abby's Blog</description> +<atom:link href='https://mohit.uk/blogs/unmono/feed.xml' rel='self' type='application/rss+xml' /> + + +</channel> +</rss> + diff --git a/images/portrait.jpg b/images/portrait.jpg Binary files differnew file mode 100644 index 0000000..5b1e0aa --- /dev/null +++ b/images/portrait.jpg diff --git a/index.html b/index.html new file mode 100644 index 0000000..1e52c8b --- /dev/null +++ b/index.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en_GB" xml:lang="en_GB"> +<link rel="stylesheet" href="static/style.css"> +<link rel="stylesheet" href="static/document.css"> +<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" /> +<title> Unorthodox Monolgues </title> +<head> +</head> +<body> +<h1 style='text-align:center;'> Unorthodox Monolgues </h1> +error while converting 2024-06-22-sample.md +error while converting 2024-06-22-sample.md +<div class="article"> +<a href=2024-06-22-sample.html><h3 class='title'>My first post</h3></a> +22 Jun 2024 - Author Name +</div> @@ -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 '<!DOCTYPE html>' + echo '<html xmlns="http://www.w3.org/1999/xhtml" lang="en_GB" xml:lang="en_GB">' + echo '<link rel="stylesheet" href="static/style.css">' + echo '<link rel="stylesheet" href="static/document.css">' + echo '<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />' + echo "<title> $TITLE </title>" + echo '<head>' + echo '</head>' + echo '<body>' + echo "<h1 style='text-align:center;'> $TITLE </h1>" + local f + for f in ????-??-??-*.md; do + echo '</div>' + echo "$(fmtdate ${f:0:10}) - $(extractauthor "$f")" + echo "<a href=${f/%.md/.html}><h3 class='title'>$(extracttitle "$f")</h3></a>" + echo '<div class="article">' + 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 @@ +<?xml version='1.0' encoding='UTF-8' ?> +<rss version='2.0' xmlns:atom='http://www.w3.org/2005/Atom'> +<!-- Made using rss-roller https://github.com/maxhebditch/rss-roller --> + + +<channel> +<title>Unorthodox Monologues</title> +<link>https://mohit.uk/blogs/unmono</link> +<description>Abby's Blog</description> +<atom:link href='https://mohit.uk/blogs/unmono/feed.xml' rel='self' type='application/rss+xml' /> + + +</channel> +</rss> + diff --git a/unmono/images/portrait.jpg b/unmono/images/portrait.jpg Binary files differnew file mode 100644 index 0000000..5b1e0aa --- /dev/null +++ b/unmono/images/portrait.jpg 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; +} |
