From ba35bf54660e9deb8d4a6c6359ecc3094db54df0 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sun, 10 May 2020 01:36:58 +0000 Subject: [PATCH] Transform hard-coded theme into Jinja template --- content/keyboard-review.md | 53 +++++++++++++++++++- pelicanconf.py | 23 +++++---- themes/theme/templates/article.html | 20 ++++++++ themes/theme/templates/base.html | 38 +++----------- themes/theme/templates/index.html | 16 ++++++ themes/theme/{static => templates}/style.css | 31 ++++++++++-- 6 files changed, 135 insertions(+), 46 deletions(-) create mode 100644 themes/theme/templates/article.html create mode 100644 themes/theme/templates/index.html rename themes/theme/{static => templates}/style.css (70%) diff --git a/content/keyboard-review.md b/content/keyboard-review.md index 26c1f02..ec99f0d 100644 --- a/content/keyboard-review.md +++ b/content/keyboard-review.md @@ -1,5 +1,56 @@ Title: My First Review Date: 2010-12-03 10:20 +Modified: 2020-05-09 5:12 Category: Review +Summary: test -Following is a review of my favorite mechanical keyboard. +[TOC] + +Following is a review of my favorite xyz. + +asdfasdfasdfasdf + +## header + +test test + +``` +this is a code block + + + +``` + +### smaller header + +hello world + +#### Tiny header + +paragraph + +##### mini header + +paragraph + +### how to install + +update packages: + +``` +sudo apt update +``` + +install packages: + +``` +sudo apt install qot +``` + +clone the repo: + +``` +git clone https://example.com +``` + +all done! diff --git a/pelicanconf.py b/pelicanconf.py index 71187be..340230a 100644 --- a/pelicanconf.py +++ b/pelicanconf.py @@ -19,18 +19,21 @@ TRANSLATION_FEED_ATOM = None AUTHOR_FEED_ATOM = None AUTHOR_FEED_RSS = None -# Blogroll -LINKS = (('Pelican', 'http://getpelican.com/'), - ('Python.org', 'http://python.org/'), - ('Jinja2', 'http://jinja.pocoo.org/'), - ('You can modify those links in your config file', '#'),) - -# Social widget -SOCIAL = (('You can add links in your config file', '#'), - ('Another social link', '#'),) - DEFAULT_PAGINATION = False +MARKDOWN = { + 'extension_configs': { + 'markdown.extensions.codehilite': {'css_class': 'highlight'}, + 'markdown.extensions.extra': {}, + 'markdown.extensions.meta': {}, + 'markdown.extensions.toc': { + 'toc_depth': '2-3', + 'anchorlink': True, + }, + }, + 'output_format': 'html5', +} + # Uncomment following line if you want document-relative URLs when developing #RELATIVE_URLS = True diff --git a/themes/theme/templates/article.html b/themes/theme/templates/article.html new file mode 100644 index 0000000..26e29cf --- /dev/null +++ b/themes/theme/templates/article.html @@ -0,0 +1,20 @@ +{% extends "base.html" %} + +{% block content %} +
+

{{ article.title }}

+ +
+ {{ article.summary }} +
+
+
+
+ {{ article.content }} +
+{% endblock %} diff --git a/themes/theme/templates/base.html b/themes/theme/templates/base.html index 7d084ba..6e23f39 100644 --- a/themes/theme/templates/base.html +++ b/themes/theme/templates/base.html @@ -4,10 +4,13 @@ - Tanner Collin + - + + Tanner Collin @@ -35,35 +38,8 @@
  • Contact
  • -
    -

    My Title

    -

    May 7th, 2020

    -
    -
    -
    -
    -
      -
    1. Section One
    2. -
    3. Section Two
    4. -
        -
      1. Subsection One
      2. -
      3. Subsection Two
      4. -
      -
    5. Section Three
    6. -
    -
    -

    - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a semper lacus. Sed vulputate ligula eget odio mollis, sed dictum dui euismod. Vivamus quis gravida diam. Sed elementum dolor non augue egestas scelerisque. Donec odio diam, feugiat sit amet accumsan eget, lobortis vel mi. Mauris a ipsum ut urna vestibulum bibendum. Nunc ut placerat ex. Morbi eleifend risus in neque suscipit aliquet. Praesent sed dolor vel tellus sagittis viverra. Vestibulum et tincidunt sem. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus vel laoreet nibh, pulvinar porta risus. -

    - -

    - Nunc euismod nulla ac felis pellentesque auctor. Phasellus mi lacus, cursus id justo nec, finibus dictum velit. Pellentesque quis nisl sollicitudin, viverra mi vel, eleifend lectus. Morbi sollicitudin ultricies elementum. Sed ut feugiat neque, vel scelerisque dolor. Quisque quis luctus lectus, quis venenatis nisi. Proin massa tortor, luctus sed pharetra sit amet, interdum eget lacus. Integer vel arcu pretium ipsum venenatis porttitor a a dui. Nullam interdum vehicula efficitur. Nullam non consequat sem. Nunc finibus enim neque, a tristique massa aliquet rhoncus. -

    - -

    - Nulla sapien odio, blandit ut pellentesque a, tincidunt id libero. Curabitur vitae lorem ullamcorper, vestibulum quam sed, pharetra ex. Pellentesque fermentum elit in facilisis bibendum. Duis porta ante felis, non molestie ipsum porta at. Interdum et malesuada fames ac ante ipsum primis in faucibus. Suspendisse ultrices erat ut dolor fermentum aliquet. Quisque condimentum sed arcu eget faucibus. Pellentesque eget nisl sit amet tortor blandit feugiat convallis in dolor. Sed ornare tristique nulla, in hendrerit neque condimentum id. Aenean sollicitudin, eros ut porttitor porta, risus sem auctor tortor, sed fringilla est odio ac odio. Nulla tempus odio magna, nec fringilla erat faucibus ac. -

    -
    + {% block content %} + {% endblock %} diff --git a/themes/theme/templates/index.html b/themes/theme/templates/index.html new file mode 100644 index 0000000..62303bb --- /dev/null +++ b/themes/theme/templates/index.html @@ -0,0 +1,16 @@ +{% extends "base.html" %} + +{% block content %} +{% for article in articles_page.object_list %} +

    {{ article.title }}

    +

    + {{ article.locale_date }} + {% if article.modified %} + — updated {{ article.locale_modified }} + {% endif %} +

    +
    + {{ article.summary }} +
    +{% endfor %} +{% endblock %} diff --git a/themes/theme/static/style.css b/themes/theme/templates/style.css similarity index 70% rename from themes/theme/static/style.css rename to themes/theme/templates/style.css index 13cdb40..3c8d376 100644 --- a/themes/theme/static/style.css +++ b/themes/theme/templates/style.css @@ -1,5 +1,4 @@ body { - text-rendering: optimizeLegibility; font: 1.2rem/1.0 Lato,sans-serif; background-color: rgb(245, 245, 245); } @@ -10,9 +9,15 @@ a { outline: none; } +pre { + font-size: 1rem; + background-color: #eee; + padding: 1rem; +} + .container { max-width: 56rem; - margin: 1rem auto 0 auto; + margin: 2rem auto 0 auto; } .sidebar { @@ -37,7 +42,7 @@ a { display: block; } .sidebar a:hover { - background-color: #eeeeee; + background-color: #eee; } .topbar { @@ -55,10 +60,28 @@ a { .toc { float: right; + background-color: #eee; + padding: 0.75rem; + padding-top: 0; +} + +.toc ul { + padding-left: 1.2rem; + margin: 0; } .toc li { - margin-top: 0.5rem; + margin-top: 0.75rem; +} + +.content p.metadata { + color: #555; + font: 1rem/1.0 Apparatus SIL,serif; + font-style: italic; +} + +.content div.summary p { + font-style: italic; } .content {