From 9dea0379b1c3018b58726c1b4ba6dadcd6b90d7c Mon Sep 17 00:00:00 2001 From: rra Date: Fri, 4 May 2018 12:22:51 +0200 Subject: [PATCH] adding theme --- develop_server.sh | 103 ++++++++++++++++++++ theme/simple/templates/archives.html | 11 +++ theme/simple/templates/article.html | 44 +++++++++ theme/simple/templates/author.html | 7 ++ theme/simple/templates/authors.html | 13 +++ theme/simple/templates/base.html | 63 ++++++++++++ theme/simple/templates/categories.html | 8 ++ theme/simple/templates/category.html | 5 + theme/simple/templates/gosquared.html | 14 +++ theme/simple/templates/index.html | 28 ++++++ theme/simple/templates/page.html | 15 +++ theme/simple/templates/pagination.html | 11 +++ theme/simple/templates/period_archives.html | 11 +++ theme/simple/templates/tag.html | 0 theme/simple/templates/tags.html | 10 ++ theme/simple/templates/translations.html | 9 ++ 16 files changed, 352 insertions(+) create mode 100755 develop_server.sh create mode 100644 theme/simple/templates/archives.html create mode 100644 theme/simple/templates/article.html create mode 100644 theme/simple/templates/author.html create mode 100644 theme/simple/templates/authors.html create mode 100644 theme/simple/templates/base.html create mode 100644 theme/simple/templates/categories.html create mode 100644 theme/simple/templates/category.html create mode 100644 theme/simple/templates/gosquared.html create mode 100644 theme/simple/templates/index.html create mode 100644 theme/simple/templates/page.html create mode 100644 theme/simple/templates/pagination.html create mode 100644 theme/simple/templates/period_archives.html create mode 100644 theme/simple/templates/tag.html create mode 100644 theme/simple/templates/tags.html create mode 100644 theme/simple/templates/translations.html diff --git a/develop_server.sh b/develop_server.sh new file mode 100755 index 0000000..2661df3 --- /dev/null +++ b/develop_server.sh @@ -0,0 +1,103 @@ +#!/usr/bin/env bash +## +# This section should match your Makefile +## +PY=${PY:-python} +PELICAN=${PELICAN:-pelican} +PELICANOPTS= + +BASEDIR=$(pwd) +INPUTDIR=$BASEDIR/content +OUTPUTDIR=$BASEDIR/output +CONFFILE=$BASEDIR/pelicanconf.py + +### +# Don't change stuff below here unless you are sure +### + +SRV_PID=$BASEDIR/srv.pid +PELICAN_PID=$BASEDIR/pelican.pid + +function usage(){ + echo "usage: $0 (stop) (start) (restart) [port]" + echo "This starts Pelican in debug and reload mode and then launches" + echo "an HTTP server to help site development. It doesn't read" + echo "your Pelican settings, so if you edit any paths in your Makefile" + echo "you will need to edit your settings as well." + exit 3 +} + +function alive() { + kill -0 $1 >/dev/null 2>&1 +} + +function shut_down(){ + PID=$(cat $SRV_PID) + if [[ $? -eq 0 ]]; then + if alive $PID; then + echo "Stopping HTTP server" + kill $PID + else + echo "Stale PID, deleting" + fi + rm $SRV_PID + else + echo "HTTP server PIDFile not found" + fi + + PID=$(cat $PELICAN_PID) + if [[ $? -eq 0 ]]; then + if alive $PID; then + echo "Killing Pelican" + kill $PID + else + echo "Stale PID, deleting" + fi + rm $PELICAN_PID + else + echo "Pelican PIDFile not found" + fi +} + +function start_up(){ + local port=$1 + echo "Starting up Pelican and HTTP server" + shift + $PELICAN --debug --autoreload -r $INPUTDIR -o $OUTPUTDIR -s $CONFFILE $PELICANOPTS & + pelican_pid=$! + echo $pelican_pid > $PELICAN_PID + mkdir -p $OUTPUTDIR && cd $OUTPUTDIR + $PY -m pelican.server $port & + srv_pid=$! + echo $srv_pid > $SRV_PID + cd $BASEDIR + sleep 1 + if ! alive $pelican_pid ; then + echo "Pelican didn't start. Is the Pelican package installed?" + return 1 + elif ! alive $srv_pid ; then + echo "The HTTP server didn't start. Is there another service using port" $port "?" + return 1 + fi + echo 'Pelican and HTTP server processes now running in background.' +} + +### +# MAIN +### +[[ ($# -eq 0) || ($# -gt 2) ]] && usage +port='' +[[ $# -eq 2 ]] && port=$2 + +if [[ $1 == "stop" ]]; then + shut_down +elif [[ $1 == "restart" ]]; then + shut_down + start_up $port +elif [[ $1 == "start" ]]; then + if ! start_up $port; then + shut_down + fi +else + usage +fi diff --git a/theme/simple/templates/archives.html b/theme/simple/templates/archives.html new file mode 100644 index 0000000..050f268 --- /dev/null +++ b/theme/simple/templates/archives.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} +{% block content %} +

Archives for {{ SITENAME }}

+ +
+{% for article in dates %} +
{{ article.locale_date }}
+
{{ article.title }}
+{% endfor %} +
+{% endblock %} diff --git a/theme/simple/templates/article.html b/theme/simple/templates/article.html new file mode 100644 index 0000000..fb01b33 --- /dev/null +++ b/theme/simple/templates/article.html @@ -0,0 +1,44 @@ +{% extends "base.html" %} +{% block head %} + {{ super() }} + {% if article.description %} + + {% endif %} + + {% for tag in article.tags %} + + {% endfor %} + +{% endblock %} + +{% block content %} +
+
+

+ {{ article.title }}

+ {% import 'translations.html' as translations with context %} + {{ translations.translations_for(article) }} +
+
+ + {% if article.modified %} + + {% endif %} + {% if article.authors %} +
+ By {% for author in article.authors %} + {{ author }} + {% endfor %} +
+ {% endif %} +
+
+ {{ article.content }} +
+
+{% endblock %} diff --git a/theme/simple/templates/author.html b/theme/simple/templates/author.html new file mode 100644 index 0000000..e9f7870 --- /dev/null +++ b/theme/simple/templates/author.html @@ -0,0 +1,7 @@ +{% extends "index.html" %} + +{% block title %}{{ SITENAME }} - Articles by {{ author }}{% endblock %} +{% block content_title %} +

Articles by {{ author }}

+{% endblock %} + diff --git a/theme/simple/templates/authors.html b/theme/simple/templates/authors.html new file mode 100644 index 0000000..4914904 --- /dev/null +++ b/theme/simple/templates/authors.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} + +{% block title %}{{ SITENAME }} - Authors{% endblock %} + +{% block content %} +

Authors on {{ SITENAME }}

+ + +{% endblock %} diff --git a/theme/simple/templates/base.html b/theme/simple/templates/base.html new file mode 100644 index 0000000..e063995 --- /dev/null +++ b/theme/simple/templates/base.html @@ -0,0 +1,63 @@ + + + + {% block head %} + {% block title %}{{ SITENAME }}{% endblock title %} + + {% if FEED_ALL_ATOM %} + + {% endif %} + {% if FEED_ALL_RSS %} + + {% endif %} + {% if FEED_ATOM %} + + {% endif %} + {% if FEED_RSS %} + + {% endif %} + {% if CATEGORY_FEED_ATOM and category %} + + {% endif %} + {% if CATEGORY_FEED_RSS and category %} + + {% endif %} + {% if TAG_FEED_ATOM and tag %} + + {% endif %} + {% if TAG_FEED_RSS and tag %} + + {% endif %} + {% endblock head %} + + + + + + {% block content %} + {% endblock %} + + + diff --git a/theme/simple/templates/categories.html b/theme/simple/templates/categories.html new file mode 100644 index 0000000..e29be0c --- /dev/null +++ b/theme/simple/templates/categories.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} +{% block content %} + +{% endblock %} diff --git a/theme/simple/templates/category.html b/theme/simple/templates/category.html new file mode 100644 index 0000000..4e6fd24 --- /dev/null +++ b/theme/simple/templates/category.html @@ -0,0 +1,5 @@ +{% extends "index.html" %} +{% block content_title %} +

Articles in the {{ category }} category

+{% endblock %} + diff --git a/theme/simple/templates/gosquared.html b/theme/simple/templates/gosquared.html new file mode 100644 index 0000000..49ccbbe --- /dev/null +++ b/theme/simple/templates/gosquared.html @@ -0,0 +1,14 @@ +{% if GOSQUARED_SITENAME %} + +{% endif %} diff --git a/theme/simple/templates/index.html b/theme/simple/templates/index.html new file mode 100644 index 0000000..ab4bc34 --- /dev/null +++ b/theme/simple/templates/index.html @@ -0,0 +1,28 @@ +{% extends "base.html" %} +{% block content %} +
+{% block content_title %} +

All articles

+{% endblock %} + +
    +{% for article in articles_page.object_list %} +
  1. +

    {{ article.title }}

    +
    + +
    By + {% for author in article.authors %} + {{ author }} + {% endfor %} +
    +
    +
    {{ article.summary }}
    +
  2. +{% endfor %} +
+{% if articles_page.has_other_pages() %} + {% include 'pagination.html' %} +{% endif %} +
+{% endblock content %} diff --git a/theme/simple/templates/page.html b/theme/simple/templates/page.html new file mode 100644 index 0000000..5ceb779 --- /dev/null +++ b/theme/simple/templates/page.html @@ -0,0 +1,15 @@ +{% extends "base.html" %} +{% block title %}{{ page.title }}{%endblock%} +{% block content %} +

{{ page.title }}

+ {% import 'translations.html' as translations with context %} + {{ translations.translations_for(page) }} + + {{ page.content }} + + {% if page.modified %} +

+ Last updated: {{ page.locale_modified }} +

+ {% endif %} +{% endblock %} diff --git a/theme/simple/templates/pagination.html b/theme/simple/templates/pagination.html new file mode 100644 index 0000000..4219a5c --- /dev/null +++ b/theme/simple/templates/pagination.html @@ -0,0 +1,11 @@ +{% if DEFAULT_PAGINATION %} +

+ {% if articles_page.has_previous() %} + « + {% endif %} + Page {{ articles_page.number }} / {{ articles_paginator.num_pages }} + {% if articles_page.has_next() %} + » + {% endif %} +

+{% endif %} diff --git a/theme/simple/templates/period_archives.html b/theme/simple/templates/period_archives.html new file mode 100644 index 0000000..d930dbb --- /dev/null +++ b/theme/simple/templates/period_archives.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} +{% block content %} +

Archives for {{ period | reverse | join(' ') }}

+ +
+{% for article in dates %} +
{{ article.locale_date }}
+
{{ article.title }}
+{% endfor %} +
+{% endblock %} diff --git a/theme/simple/templates/tag.html b/theme/simple/templates/tag.html new file mode 100644 index 0000000..e69de29 diff --git a/theme/simple/templates/tags.html b/theme/simple/templates/tags.html new file mode 100644 index 0000000..b5d1482 --- /dev/null +++ b/theme/simple/templates/tags.html @@ -0,0 +1,10 @@ +{% extends "base.html" %} + +{% block title %}{{ SITENAME }} - Tags{% endblock %} + +{% block content %} +

Tags for {{ SITENAME }}

+ {%- for tag, articles in tags|sort %} +
  • {{ tag }} ({{ articles|count }})
  • + {% endfor %} +{% endblock %} diff --git a/theme/simple/templates/translations.html b/theme/simple/templates/translations.html new file mode 100644 index 0000000..db8c372 --- /dev/null +++ b/theme/simple/templates/translations.html @@ -0,0 +1,9 @@ +{% macro translations_for(article) %} +{% if article.translations %} +Translations: +{% for translation in article.translations %} +{{ translation.lang }} +{% endfor %} +{% endif %} +{% endmacro %} +