rra
7 years ago
16 changed files with 352 additions and 0 deletions
@ -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 |
@ -0,0 +1,11 @@ |
|||
{% extends "base.html" %} |
|||
{% block content %} |
|||
<h1>Archives for {{ SITENAME }}</h1> |
|||
|
|||
<dl> |
|||
{% for article in dates %} |
|||
<dt>{{ article.locale_date }}</dt> |
|||
<dd><a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }}</a></dd> |
|||
{% endfor %} |
|||
</dl> |
|||
{% endblock %} |
@ -0,0 +1,44 @@ |
|||
{% extends "base.html" %} |
|||
{% block head %} |
|||
{{ super() }} |
|||
{% if article.description %} |
|||
<meta name="description" content="{{article.description}}" /> |
|||
{% endif %} |
|||
|
|||
{% for tag in article.tags %} |
|||
<meta name="tags" content="{{tag}}" /> |
|||
{% endfor %} |
|||
|
|||
{% endblock %} |
|||
|
|||
{% block content %} |
|||
<section id="content" class="body"> |
|||
<header> |
|||
<h2 class="entry-title"> |
|||
<a href="{{ SITEURL }}/{{ article.url }}" rel="bookmark" |
|||
title="Permalink to {{ article.title|striptags }}">{{ article.title }}</a></h2> |
|||
{% import 'translations.html' as translations with context %} |
|||
{{ translations.translations_for(article) }} |
|||
</header> |
|||
<footer class="post-info"> |
|||
<time class="published" datetime="{{ article.date.isoformat() }}"> |
|||
{{ article.locale_date }} |
|||
</time> |
|||
{% if article.modified %} |
|||
<time class="modified" datetime="{{ article.modified.isoformat() }}"> |
|||
{{ article.locale_modified }} |
|||
</time> |
|||
{% endif %} |
|||
{% if article.authors %} |
|||
<address class="vcard author"> |
|||
By {% for author in article.authors %} |
|||
<a class="url fn" href="{{ SITEURL }}/{{ author.url }}">{{ author }}</a> |
|||
{% endfor %} |
|||
</address> |
|||
{% endif %} |
|||
</footer><!-- /.post-info --> |
|||
<div class="entry-content"> |
|||
{{ article.content }} |
|||
</div><!-- /.entry-content --> |
|||
</section> |
|||
{% endblock %} |
@ -0,0 +1,7 @@ |
|||
{% extends "index.html" %} |
|||
|
|||
{% block title %}{{ SITENAME }} - Articles by {{ author }}{% endblock %} |
|||
{% block content_title %} |
|||
<h2>Articles by {{ author }}</h2> |
|||
{% endblock %} |
|||
|
@ -0,0 +1,13 @@ |
|||
{% extends "base.html" %} |
|||
|
|||
{% block title %}{{ SITENAME }} - Authors{% endblock %} |
|||
|
|||
{% block content %} |
|||
<h1>Authors on {{ SITENAME }}</h1> |
|||
|
|||
<ul> |
|||
{%- for author, articles in authors|sort %} |
|||
<li><a href="{{ SITEURL }}/{{ author.url }}">{{ author }}</a> ({{ articles|count }})</li> |
|||
{% endfor %} |
|||
</ul> |
|||
{% endblock %} |
@ -0,0 +1,63 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="{{ DEFAULT_LANG }}"> |
|||
<head> |
|||
{% block head %} |
|||
<title>{% block title %}{{ SITENAME }}{% endblock title %}</title> |
|||
<meta charset="utf-8" /> |
|||
{% if FEED_ALL_ATOM %} |
|||
<link href="{{ FEED_DOMAIN }}/{% if FEED_ALL_ATOM_URL %}{{ FEED_ALL_ATOM_URL }}{% else %}{{ FEED_ALL_ATOM }}{% endif %}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Full Atom Feed" /> |
|||
{% endif %} |
|||
{% if FEED_ALL_RSS %} |
|||
<link href="{{ FEED_DOMAIN }}/{% if FEED_ALL_RSS_URL %}{{ FEED_ALL_RSS_URL }}{% else %}{{ FEED_ALL_RSS }}{% endif %}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} Full RSS Feed" /> |
|||
{% endif %} |
|||
{% if FEED_ATOM %} |
|||
<link href="{{ FEED_DOMAIN }}/{%if FEED_ATOM_URL %}{{ FEED_ATOM_URL }}{% else %}{{ FEED_ATOM }}{% endif %}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Atom Feed" /> |
|||
{% endif %} |
|||
{% if FEED_RSS %} |
|||
<link href="{{ FEED_DOMAIN }}/{% if FEED_RSS_URL %}{{ FEED_RSS_URL }}{% else %}{{ FEED_RSS }}{% endif %}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} RSS Feed" /> |
|||
{% endif %} |
|||
{% if CATEGORY_FEED_ATOM and category %} |
|||
<link href="{{ FEED_DOMAIN }}/{% if CATEGORY_FEED_ATOM_URL %}{{ CATEGORY_FEED_ATOM_URL|format(category.slug) }}{% else %}{{ CATEGORY_FEED_ATOM|format(category.slug) }}{% endif %}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Categories Atom Feed" /> |
|||
{% endif %} |
|||
{% if CATEGORY_FEED_RSS and category %} |
|||
<link href="{{ FEED_DOMAIN }}/{% if CATEGORY_FEED_RSS_URL %}{{ CATEGORY_FEED_RSS_URL|format(category.slug) }}{% else %}{{ CATEGORY_FEED_RSS|format(category.slug) }}{% endif %}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} Categories RSS Feed" /> |
|||
{% endif %} |
|||
{% if TAG_FEED_ATOM and tag %} |
|||
<link href="{{ FEED_DOMAIN }}/{% if TAG_FEED_ATOM_URL %}{{ TAG_FEED_ATOM_URL|format(tag.slug) }}{% else %}{{ TAG_FEED_ATOM|format(tag.slug) }}{% endif %}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Tags Atom Feed" /> |
|||
{% endif %} |
|||
{% if TAG_FEED_RSS and tag %} |
|||
<link href="{{ FEED_DOMAIN }}/{% if TAG_FEED_RSS_URL %}{{ TAG_FEED_RSS_URL|format(tag.slug) }}{% else %}{{ TAG_FEED_RSS|format(tag.slug) }}{% endif %}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} Tags RSS Feed" /> |
|||
{% endif %} |
|||
{% endblock head %} |
|||
</head> |
|||
|
|||
<body id="index" class="home"> |
|||
<header id="banner" class="body"> |
|||
<h1><a href="{{ SITEURL }}/">{{ SITENAME }} <strong>{{ SITESUBTITLE }}</strong></a></h1> |
|||
</header><!-- /#banner --> |
|||
<nav id="menu"><ul> |
|||
{% for title, link in MENUITEMS %} |
|||
<li><a href="{{ link }}">{{ title }}</a></li> |
|||
{% endfor %} |
|||
{% if DISPLAY_PAGES_ON_MENU %} |
|||
{% for p in pages %} |
|||
<li{% if p == page %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ p.url }}">{{ p.title }}</a></li> |
|||
{% endfor %} |
|||
{% else %} |
|||
{% if DISPLAY_CATEGORIES_ON_MENU %} |
|||
{% for cat, null in categories %} |
|||
<li{% if cat == category %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ cat.url }}">{{ cat }}</a></li> |
|||
{% endfor %} |
|||
{% endif %} |
|||
{% endif %} |
|||
</ul></nav><!-- /#menu --> |
|||
{% block content %} |
|||
{% endblock %} |
|||
<footer id="contentinfo" class="body"> |
|||
<address id="about" class="vcard body"> |
|||
Proudly powered by <a href="http://getpelican.com/">Pelican</a>, |
|||
which takes great advantage of <a href="http://python.org">Python</a>. |
|||
</address><!-- /#about --> |
|||
</footer><!-- /#contentinfo --> |
|||
</body> |
|||
</html> |
@ -0,0 +1,8 @@ |
|||
{% extends "base.html" %} |
|||
{% block content %} |
|||
<ul> |
|||
{% for category, articles in categories %} |
|||
<li><a href="{{ SITEURL }}/{{ category.url }}">{{ category }}</a></li> |
|||
{% endfor %} |
|||
</ul> |
|||
{% endblock %} |
@ -0,0 +1,5 @@ |
|||
{% extends "index.html" %} |
|||
{% block content_title %} |
|||
<h2>Articles in the {{ category }} category</h2> |
|||
{% endblock %} |
|||
|
@ -0,0 +1,14 @@ |
|||
{% if GOSQUARED_SITENAME %} |
|||
<script type="text/javascript"> |
|||
var GoSquared={}; |
|||
GoSquared.acct = "{{ GOSQUARED_SITENAME }}"; |
|||
(function(w){ |
|||
function gs(){ |
|||
w._gstc_lt=+(new Date); var d=document; |
|||
var g = d.createElement("script"); g.type = "text/javascript"; g.async = true; g.src = "https://d1l6p2sc9645hc.cloudfront.net/tracker.js"; |
|||
var s = d.getElementsByTagName("script")[0]; s.parentNode.insertBefore(g, s); |
|||
} |
|||
w.addEventListener?w.addEventListener("load",gs,false):w.attachEvent("onload",gs); |
|||
})(window); |
|||
</script> |
|||
{% endif %} |
@ -0,0 +1,28 @@ |
|||
{% extends "base.html" %} |
|||
{% block content %} |
|||
<section id="content"> |
|||
{% block content_title %} |
|||
<h2>All articles</h2> |
|||
{% endblock %} |
|||
|
|||
<ol id="post-list"> |
|||
{% for article in articles_page.object_list %} |
|||
<li><article class="hentry"> |
|||
<header> <h2 class="entry-title"><a href="{{ SITEURL }}/{{ article.url }}" rel="bookmark" title="Permalink to {{ article.title|striptags }}">{{ article.title }}</a></h2> </header> |
|||
<footer class="post-info"> |
|||
<time class="published" datetime="{{ article.date.isoformat() }}"> {{ article.locale_date }} </time> |
|||
<address class="vcard author">By |
|||
{% for author in article.authors %} |
|||
<a class="url fn" href="{{ SITEURL }}/{{ author.url }}">{{ author }}</a> |
|||
{% endfor %} |
|||
</address> |
|||
</footer><!-- /.post-info --> |
|||
<div class="entry-content"> {{ article.summary }} </div><!-- /.entry-content --> |
|||
</article></li> |
|||
{% endfor %} |
|||
</ol><!-- /#posts-list --> |
|||
{% if articles_page.has_other_pages() %} |
|||
{% include 'pagination.html' %} |
|||
{% endif %} |
|||
</section><!-- /#content --> |
|||
{% endblock content %} |
@ -0,0 +1,15 @@ |
|||
{% extends "base.html" %} |
|||
{% block title %}{{ page.title }}{%endblock%} |
|||
{% block content %} |
|||
<h1>{{ page.title }}</h1> |
|||
{% import 'translations.html' as translations with context %} |
|||
{{ translations.translations_for(page) }} |
|||
|
|||
{{ page.content }} |
|||
|
|||
{% if page.modified %} |
|||
<p> |
|||
Last updated: {{ page.locale_modified }} |
|||
</p> |
|||
{% endif %} |
|||
{% endblock %} |
@ -0,0 +1,11 @@ |
|||
{% if DEFAULT_PAGINATION %} |
|||
<p class="paginator"> |
|||
{% if articles_page.has_previous() %} |
|||
<a href="{{ SITEURL }}/{{ articles_previous_page.url }}">«</a> |
|||
{% endif %} |
|||
Page {{ articles_page.number }} / {{ articles_paginator.num_pages }} |
|||
{% if articles_page.has_next() %} |
|||
<a href="{{ SITEURL }}/{{ articles_next_page.url }}">»</a> |
|||
{% endif %} |
|||
</p> |
|||
{% endif %} |
@ -0,0 +1,11 @@ |
|||
{% extends "base.html" %} |
|||
{% block content %} |
|||
<h1>Archives for {{ period | reverse | join(' ') }}</h1> |
|||
|
|||
<dl> |
|||
{% for article in dates %} |
|||
<dt>{{ article.locale_date }}</dt> |
|||
<dd><a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }}</a></dd> |
|||
{% endfor %} |
|||
</dl> |
|||
{% endblock %} |
@ -0,0 +1,10 @@ |
|||
{% extends "base.html" %} |
|||
|
|||
{% block title %}{{ SITENAME }} - Tags{% endblock %} |
|||
|
|||
{% block content %} |
|||
<h1>Tags for {{ SITENAME }}</h1> |
|||
{%- for tag, articles in tags|sort %} |
|||
<li><a href="{{ SITEURL }}/{{ tag.url }}">{{ tag }}</a> ({{ articles|count }})</li> |
|||
{% endfor %} |
|||
{% endblock %} |
@ -0,0 +1,9 @@ |
|||
{% macro translations_for(article) %} |
|||
{% if article.translations %} |
|||
Translations: |
|||
{% for translation in article.translations %} |
|||
<a href="{{ SITEURL }}/{{ translation.url }}">{{ translation.lang }}</a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
{% endmacro %} |
|||
|
Loading…
Reference in new issue