diff --git a/assets/css/main.less b/assets/css/main.less index 90e4a8e..01a871d 100644 --- a/assets/css/main.less +++ b/assets/css/main.less @@ -67,12 +67,16 @@ html{ background-color: @gb-dm-bg0; + scrollbar-color: @gb-dm-fg3 transparent; + scrollbar-width: thin; } body{ background-color: @gb-dm-bg0; color: @gb-dm-fg0; margin: 0; + scrollbar-color: @gb-dm-fg3 transparent; + scrollbar-width: thin; } .container{ @@ -102,10 +106,28 @@ main{ } } -pre{ - overflow: auto; +h2{ + text-decoration: underline; + &:not(:first-child){ + margin-top: 2em; + } +} +h3{ + color: @gb-dm-fg3; } +p{ + line-height: 1.3em; +} + +li{ + margin: 0.5em 0; +} + +//pre{ +// overflow: auto; +//} + article{ background-color: @gb-dm-bg1; margin: 1em; @@ -178,10 +200,16 @@ a:active, a:hover{ // margin-bottom: 0; //} -p code{ +p code, li code{ display: inline-block; background-color: @gb-dm-bg2; - padding: .2em; + padding: 0 0.3em; + border-radius: 1em; + box-shadow: 0px 0px 1px 0px @gb-dm-dark-red; + transition: box-shadow .2s ease; + &:hover{ + box-shadow: 0px 0px 1px 0px @gb-dm-dark-green; + } } @@ -198,11 +226,29 @@ pre > code.sourceCode { white-space: pre; position: relative; } pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } pre > code.sourceCode > span:empty { height: 1.2em; } code.sourceCode > span { color: inherit; text-decoration: inherit; } -div.sourceCode { margin: 1em 0; } -pre.sourceCode { margin: 0; } -@media screen { -div.sourceCode { overflow: auto; } +div.sourceCode, article > pre { + margin: 1em 0; + padding: 0; + background-color: @gb-dm-bg0-hard; + border-radius: 1em; + box-shadow: 0px 0px 1px 0px @gb-dm-dark-red; + transition: box-shadow .2s ease; + overflow: hidden; + &:hover{ + box-shadow: 0px 0px 1px 0px @gb-dm-dark-green; + } + pre.sourceCode{ + padding: 1em; + margin: 0; + overflow: auto; + scrollbar-width: thin; + } } +article>pre{ + padding: 1em; + overflow: auto; +} +pre.sourceCode { margin: 0; } @media print { pre > code.sourceCode { white-space: pre-wrap; } pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; } @@ -240,7 +286,7 @@ code span.cn { color: #880000; } /* Constant */ code span.co { color: #60a0b0; font-style: italic; } /* Comment */ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ code span.do { color: #ba2121; font-style: italic; } /* Documentation */ -code span.dt { color: #902000; } /* DataType */ +code span.dt { color: @gb-dm-dark-red; } /* DataType */ code span.dv { color: #40a070; } /* DecVal */ code span.er { color: #ff0000; font-weight: bold; } /* Error */ code span.ex { color: @gb-dm-dark-blue; } /* Extension */ diff --git a/build.sh b/build.sh index 653d713..637e62c 100755 --- a/build.sh +++ b/build.sh @@ -20,12 +20,15 @@ blog(){ makeIntro(){ local file="$1" local output="tmp/intros/$file" + local rssoutput="tmp/rss/$file" # We delete tmp each time the build script runs, so if the file exists, we have already generated one this time [ -f "$output" ] && return 1 mkdir -p "${output%/*}" + mkdir -p "${rssoutput%/*}" local info="$(sed -n '/---/,/---/p' "$file" | sed '/^$/,$d' | sed -n '1,/---/p' | sed '/^---$/d')" local slug=$(getBlogSlug "$file") local date="$(echo "$info" | yq -r .date)" + local rfc822="$(date --utc -d "$date" "+%a, %d %b %Y %H:%M:%S") UT" local tags="$(echo "$info" | yq -r 'if ( .tags | type ) == "array" then .tags else [ .tags ] end | join("\n")' | awk '{print "
  • " $0 "
  • "}' )" local title="$(echo "$info" | yq -r .title)" local description="$(echo "$info" | yq -r .description)" @@ -39,11 +42,23 @@ makeIntro(){

    $description

    Read More

    " > "$output" + echo " + + <![CDATA[$title]]> + https://jonathanh.co.uk/$slug + https://jonathanh.co.uk/$slug + $rfc822 + + " > "$rssoutput" } getIntro(){ local file="$1" local output="tmp/intros/$file" + + if [ "$2" = "rss" ]; then + local output="tmp/rss/$file" + fi makeIntro "$file" cat "$output" } @@ -137,6 +152,31 @@ card(){ content/card.curl > public_html/card } +rss(){ + echo "Generating RSS Feed" + lastUpdate="$(date --utc "+%a, %d %b %Y %H:%M:%S") UT" + + # First loop makes all the intros needed and stores them in tmp/intros + find content/blog/ -type f -name '*.md' | grep -v 'xxx' | sort -r | head -n 20 | while read file; do + makeIntro "$file" & + done + wait + + ( + echo " + + + <![CDATA[Jonathan Hodgson]]> + + https://jonathanh.co.uk + $lastUpdate" + find content/blog/ -type f -name '*.md' | grep -v 'xxx' | sort -r | head -n 20 | while read file; do + grep -Eq '^draft: true' "$file" || getIntro "$file" rss + done + echo ""; + ) > public_html/feed.rss +} + clean(){ rm -rf tmp > /dev/null 2> /dev/null @@ -156,5 +196,6 @@ case "$1" in blog) blog ;; tags) tags ;; card) card ;; - all) tags && blog && index && card ;; + rss) rss ;; + all) tags && blog && index && rss && card ;; esac diff --git a/templates/blog.html b/templates/blog.html index 8f3a597..792c6bc 100644 --- a/templates/blog.html +++ b/templates/blog.html @@ -16,7 +16,8 @@ Jonathan Hodgson's Blog $endif$ - + + @@ -67,7 +68,8 @@ $body$