From 6ec6ed4c15ad3c37fbe1076aa33d26e9c21050a9 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Fri, 30 Jul 2021 23:37:15 -0400 Subject: [PATCH] styles and templates --- build/stylesheets/root.css | 71 +++++++++++++++++++++++++++++ modules/md-header | 2 +- modules/readingtime | 4 +- pinopress | 8 ++-- templates/archiveitem.template.html | 2 +- templates/head.template.html | 2 + templates/rollingitem.template.html | 2 + 7 files changed, 84 insertions(+), 7 deletions(-) create mode 100644 build/stylesheets/root.css diff --git a/build/stylesheets/root.css b/build/stylesheets/root.css new file mode 100644 index 0000000..67f9a26 --- /dev/null +++ b/build/stylesheets/root.css @@ -0,0 +1,71 @@ + +:root { + + /* color scheme - one dark */ + /* --black-normal: #282C34; */ + /* --black-bright: #454C59; */ + /* --red-normal: #E06C75; */ + /* --red-bright: #FF7A85; */ + /* --green-normal: #98C379; */ + /* --green-bright: #B5E890; */ + /* --yellow-normal: #E5C07B; */ + /* --yellow-bright: #FFD68A; */ + /* --blue-normal: #61AFEF; */ + /* --blue-bright: #69BBFF; */ + /* --magenta-normal: #C678DD; */ + /* --magenta-bright: #E48AFF; */ + /* --cyan-normal: #56B6C2; */ + /* --cyan-bright: #66D9E8; */ + /* --white-normal: #ABB2BF; */ + /* --white-bright: #CFD7E6; */ + + /* color scheme - gruvbox */ + --black-normal: #282828; + --black-bright: #3c3836; + --red-normal: #cc241d; + --red-bright: #fb4934; + --green-normal: #98971a; + --green-bright: #b8bb26; + --yellow-normal: #d79921; + --yellow-bright: #fabd2f; + --blue-normal: #458588; + --blue-bright: #83a598; + --magenta-normal: #b16286; + --magenta-bright: #d3869b; + --cyan-normal: #689d6a; + --cyan-bright: #8ec07c; + --white-normal: #a89984; + --white-bright: #ebdbb2; + + --bg-dark: var(--black-normal); + --bg-light: var(--black-bright); + --text-dark: var(--white-normal); + --text-light: var(--white-bright); + + color: var(--text-dark); + background-color: var(--bg-dark); + font-family: 'Courier New', monospace; + +} + +body { + height: 100%; + margin: 0; + padding: 2rem; +} + +h1, h2, h3, h4, h5, h6 { + color: var(--text-light); +} + +a { + color: var(--text-light); + transition: color 0.2s; +} +a:hover { + color: var(--text-dark); +} + +strong { + color: var(--text-light); +} diff --git a/modules/md-header b/modules/md-header index e671ea8..3e1b3e4 100755 --- a/modules/md-header +++ b/modules/md-header @@ -17,4 +17,4 @@ export DESCRIPTION=`getprop "$1" description` export USERLOCAL1=`getprop "$1" userlocal1` export USERLOCAL2=`getprop "$1" userlocal2` # this only works when this script is called from pinopress script, as it inherits the required env variables. careful with this one, it's a bit hacky -export ARTICLE_URL="$SITEURL/$ARTICLE_PATH/$(echo $(basename "$1") | sed -e 's/\(.*\)\.html/\1\.md/')" +export ARTICLE_URL="$SITEURL/$ARTICLE_PATH/$(echo $(basename "$1") | sed -e 's/\(.*\)\.md/\1\.html/')" diff --git a/modules/readingtime b/modules/readingtime index 7983314..b3ef98f 100755 --- a/modules/readingtime +++ b/modules/readingtime @@ -7,8 +7,8 @@ ## READING_TIME in minutes ## config vars -wordsPerMinute=250 +wordsPerMinute=200 # first clean special symbols and lines with whitespace wordcount=`sed -e 's/[^A-Za-z0-9 ]//g' -e '/^\s*$/d' "$1" | wc -w` -export READING_TIME=$(expr $(expr $wordcount + $wordsPerMinute) / $wordsPerMinute) +export READING_TIME=$(expr $(expr $wordcount / $wordsPerMinute) + 1) diff --git a/pinopress b/pinopress index c12c485..b47d785 100755 --- a/pinopress +++ b/pinopress @@ -8,6 +8,8 @@ SITEURL := https://blog.danieliu.xyz USERGLOBAL1 := USERGLOBAL2 := +include config.mk + .PHONY: help build clean # internal variables @@ -69,11 +71,11 @@ $(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 "$^" >> "$@" - . ./$(MODULE_DIR)/readingtime "$^" + ./$(MODULE_DIR)/md "$<" >> "$@" + . ./$(MODULE_DIR)/md-header "$<" + . ./$(MODULE_DIR)/readingtime "$<" # module pipeline ends here cat $(TEMPLATE_DIR)/foot.template.html >> "$@" envsubst < "$@" | sponge "$@" diff --git a/templates/archiveitem.template.html b/templates/archiveitem.template.html index 867a94d..fe695ab 100644 --- a/templates/archiveitem.template.html +++ b/templates/archiveitem.template.html @@ -1 +1 @@ -
  • $ARTICLE_TITLE
  • +
  • $ARTICLE_TITLE
  • diff --git a/templates/head.template.html b/templates/head.template.html index a4fc487..ee53597 100644 --- a/templates/head.template.html +++ b/templates/head.template.html @@ -5,5 +5,7 @@ + + diff --git a/templates/rollingitem.template.html b/templates/rollingitem.template.html index 52803ec..589db20 100644 --- a/templates/rollingitem.template.html +++ b/templates/rollingitem.template.html @@ -1,3 +1,5 @@

    $ARTICLE_TITLE

    +

    Published $PUBLISHED_DATE

    +

    $DESCRIPTION

    -- 2.20.1