Skip to content

Commit e7b2606

Browse files
Minimal HTML build; styles not working yet.
1 parent a3f4249 commit e7b2606

File tree

17 files changed

+5434
-1
lines changed

17 files changed

+5434
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ _site
1111
htmlcov
1212
output
1313
tex/*.tex.1
14+
tex/500L.bib
1415
tex/500L.bbl
1516
tex/500L.blg
1617
tex/500L.log
@@ -21,3 +22,5 @@ tex/frontmatter-images
2122
tex/colophon.tex
2223
tex/intro.tex
2324
tex/template-engine.markdown
25+
html/content
26+
html/cache

_build/fix_html_title.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
#!/usr/bin/env bash
22

3-
sed -i 's|<p>\(title:.*\)author:\(.*\)</p>|\1\nauthor:\2\n|' $1
3+
sed -i '' 's|<p>\(title:.*\)author:\(.*\)</p>|\1\
4+
author:\2\
5+
|' $1

html/Makefile

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
PY=python
2+
PELICAN=pelican
3+
PELICANOPTS=
4+
5+
BASEDIR=$(CURDIR)
6+
INPUTDIR=$(BASEDIR)/content
7+
OUTPUTDIR=$(BASEDIR)/output
8+
CONFFILE=$(BASEDIR)/pelicanconf.py
9+
PUBLISHCONF=$(BASEDIR)/publishconf.py
10+
11+
FTP_HOST=localhost
12+
FTP_USER=anonymous
13+
FTP_TARGET_DIR=/
14+
15+
SSH_HOST=tavman
16+
SSH_PORT=22
17+
SSH_USER=tavish
18+
SSH_TARGET_DIR=/var/shared/sites/theperformanceofopensourcesoftware.com/site/
19+
20+
S3_BUCKET=my_s3_bucket
21+
22+
DROPBOX_DIR=~/Dropbox/Public/
23+
24+
help:
25+
@echo 'Makefile for a pelican Web site '
26+
@echo ' '
27+
@echo 'Usage: '
28+
@echo ' make html (re)generate the web site '
29+
@echo ' make clean remove the generated files '
30+
@echo ' make regenerate regenerate files upon modification '
31+
@echo ' make publish generate using production settings '
32+
@echo ' make serve serve site at http://localhost:8000'
33+
@echo ' make devserver start/restart develop_server.sh '
34+
@echo ' make stopserver stop local server '
35+
@echo ' ssh_upload upload the web site via SSH '
36+
@echo ' rsync_upload upload the web site via rsync+ssh '
37+
@echo ' dropbox_upload upload the web site via Dropbox '
38+
@echo ' ftp_upload upload the web site via FTP '
39+
@echo ' s3_upload upload the web site via S3 '
40+
@echo ' github upload the web site via gh-pages '
41+
@echo ' '
42+
43+
44+
html:
45+
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
46+
47+
clean:
48+
[ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)
49+
50+
regenerate:
51+
$(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
52+
53+
serve:
54+
cd $(OUTPUTDIR) && $(PY) -m pelican.server
55+
56+
devserver:
57+
$(BASEDIR)/develop_server.sh restart
58+
59+
stopserver:
60+
kill -9 `cat pelican.pid`
61+
kill -9 `cat srv.pid`
62+
@echo 'Stopped Pelican and SimpleHTTPServer processes running in background.'
63+
64+
publish:
65+
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
66+
67+
ssh_upload: publish
68+
scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)
69+
70+
rsync_upload: publish
71+
rsync -e "ssh -p $(SSH_PORT)" -P -rvz --delete $(OUTPUTDIR)/ $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) --cvs-exclude
72+
73+
dropbox_upload: publish
74+
cp -r $(OUTPUTDIR)/* $(DROPBOX_DIR)
75+
76+
ftp_upload: publish
77+
lftp ftp://$(FTP_USER)@$(FTP_HOST) -e "mirror -R $(OUTPUTDIR) $(FTP_TARGET_DIR) ; quit"
78+
79+
s3_upload: publish
80+
s3cmd sync $(OUTPUTDIR)/ s3://$(S3_BUCKET) --acl-public --delete-removed
81+
82+
github: publish
83+
ghp-import $(OUTPUTDIR)
84+
git push origin gh-pages
85+
86+
.PHONY: html help clean regenerate serve devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload github

html/develop_server.sh

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#!/usr/bin/env bash
2+
##
3+
# This section should match your Makefile
4+
##
5+
PY=python
6+
PELICAN=pelican
7+
PELICANOPTS=
8+
9+
BASEDIR=$(pwd)
10+
INPUTDIR=$BASEDIR/content
11+
OUTPUTDIR=$BASEDIR/output
12+
CONFFILE=$BASEDIR/pelicanconf.py
13+
14+
###
15+
# Don't change stuff below here unless you are sure
16+
###
17+
18+
SRV_PID=$BASEDIR/srv.pid
19+
PELICAN_PID=$BASEDIR/pelican.pid
20+
21+
function usage(){
22+
echo "usage: $0 (stop) (start) (restart)"
23+
echo "This starts pelican in debug and reload mode and then launches"
24+
echo "A pelican.server to help site development. It doesn't read"
25+
echo "your pelican options so you edit any paths in your Makefile"
26+
echo "you will need to edit it as well"
27+
exit 3
28+
}
29+
30+
function alive() {
31+
kill -0 $1 >/dev/null 2>&1
32+
}
33+
34+
function shut_down(){
35+
PID=$(cat $SRV_PID)
36+
if [[ $? -eq 0 ]]; then
37+
if alive $PID; then
38+
echo "Killing pelican.server"
39+
kill $PID
40+
else
41+
echo "Stale PID, deleting"
42+
fi
43+
rm $SRV_PID
44+
else
45+
echo "pelican.server PIDFile not found"
46+
fi
47+
48+
PID=$(cat $PELICAN_PID)
49+
if [[ $? -eq 0 ]]; then
50+
if alive $PID; then
51+
echo "Killing Pelican"
52+
kill $PID
53+
else
54+
echo "Stale PID, deleting"
55+
fi
56+
rm $PELICAN_PID
57+
else
58+
echo "Pelican PIDFile not found"
59+
fi
60+
}
61+
62+
function start_up(){
63+
echo "Starting up Pelican and pelican.server"
64+
shift
65+
$PELICAN --debug --autoreload -r $INPUTDIR -o $OUTPUTDIR -s $CONFFILE $PELICANOPTS &
66+
pelican_pid=$!
67+
echo $pelican_pid > $PELICAN_PID
68+
cd $OUTPUTDIR
69+
$PY -m pelican.server 8002 &
70+
srv_pid=$!
71+
echo $srv_pid > $SRV_PID
72+
cd $BASEDIR
73+
sleep 1
74+
if ! alive $pelican_pid ; then
75+
echo "Pelican didn't start. Is the pelican package installed?"
76+
return 1
77+
elif ! alive $srv_pid ; then
78+
echo "pelican.server didn't start. Is there something else which uses port 8000?"
79+
return 1
80+
fi
81+
echo 'Pelican and pelican.server processes now running in background.'
82+
}
83+
84+
###
85+
# MAIN
86+
###
87+
[[ $# -ne 1 ]] && usage
88+
if [[ $1 == "stop" ]]; then
89+
shut_down
90+
elif [[ $1 == "restart" ]]; then
91+
shut_down
92+
start_up
93+
elif [[ $1 == "start" ]]; then
94+
if ! start_up; then
95+
shut_down
96+
fi
97+
else
98+
usage
99+
fi

html/pelicanconf.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*- #
3+
from __future__ import unicode_literals
4+
5+
AUTHOR = u'Tavish Armstrong'
6+
SITENAME = u'The Performance of Open Source Software'
7+
SITEURL = ''
8+
9+
TIMEZONE = 'Europe/Paris'
10+
11+
DEFAULT_LANG = u'en'
12+
13+
# Feed generation is usually not desired when developing
14+
FEED_ALL_ATOM = None
15+
CATEGORY_FEED_ATOM = None
16+
TRANSLATION_FEED_ATOM = None
17+
18+
STATIC_PATHS = [
19+
# 'chrome-images',
20+
# 'ethercalc-images',
21+
# 'infinispan-images',
22+
# 'khmer-images',
23+
# 'memshrink-images',
24+
# 'mobile-perf-images',
25+
# 'pugixml-images',
26+
# 'talos-images',
27+
# 'warp-images',
28+
# 'zotonic-images',
29+
]
30+
31+
32+
DEFAULT_PAGINATION = False
33+
34+
THEME = 'posa'
35+
36+
# TODO This turns --- into &mdash;. Why? :(
37+
TYPOGRIFY = True
38+
39+
EXTENSIONS = ('latex',)
40+
41+
# Uncomment following line if you want document-relative URLs when developing
42+
#RELATIVE_URLS = True

html/posa/README

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#POSA pelican/jinja2 theme
2+
3+
The content of the **static** directory will be copied into the **output** folder.
4+
5+
The **templates** folder contains the page, tag, index and other **templates**.
6+
7+
Jinja2 template engine is quite similar to Twig, and resembles a little bit
8+
Java's JSTL, so any Java, Python, PHP dev should be comfortable with it.

0 commit comments

Comments
 (0)