From 84f42fc4aaf8d95b027f1d076c66ef04e227014d Mon Sep 17 00:00:00 2001 From: theo lem <=> Date: Wed, 29 Apr 2020 20:17:21 +0200 Subject: [PATCH] first version --- .gitignore | 4 + Makefile | 79 +++++++++++++ output/archives.html | 28 +++++ output/authors.html | 0 output/categories.html | 0 output/feeds/all.atom.xml | 2 + output/index.html | 30 +++++ output/tags.html | 0 output/theme/css/main.css | 30 +++++ output/theme/css/main.less | 42 +++++++ pelicanconf.py | 38 ++++++ publishconf.py | 25 ++++ tasks.py | 110 ++++++++++++++++++ themes/theo_lem/static/css/main.css | 30 +++++ themes/theo_lem/static/css/main.less | 41 +++++++ themes/theo_lem/templates/archive.html | 0 themes/theo_lem/templates/article.html | 6 + themes/theo_lem/templates/author.html | 0 themes/theo_lem/templates/authors.html | 0 themes/theo_lem/templates/base.html | 33 ++++++ themes/theo_lem/templates/categories.html | 0 themes/theo_lem/templates/category.html | 0 themes/theo_lem/templates/index.html | 9 ++ themes/theo_lem/templates/page.html | 0 .../theo_lem/templates/period_archives.html | 0 themes/theo_lem/templates/tag.html | 0 themes/theo_lem/templates/tags.html | 0 27 files changed, 507 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 output/archives.html create mode 100644 output/authors.html create mode 100644 output/categories.html create mode 100644 output/feeds/all.atom.xml create mode 100644 output/index.html create mode 100644 output/tags.html create mode 100644 output/theme/css/main.css create mode 100644 output/theme/css/main.less create mode 100644 pelicanconf.py create mode 100644 publishconf.py create mode 100644 tasks.py create mode 100644 themes/theo_lem/static/css/main.css create mode 100644 themes/theo_lem/static/css/main.less create mode 100644 themes/theo_lem/templates/archive.html create mode 100644 themes/theo_lem/templates/article.html create mode 100644 themes/theo_lem/templates/author.html create mode 100644 themes/theo_lem/templates/authors.html create mode 100644 themes/theo_lem/templates/base.html create mode 100644 themes/theo_lem/templates/categories.html create mode 100644 themes/theo_lem/templates/category.html create mode 100644 themes/theo_lem/templates/index.html create mode 100644 themes/theo_lem/templates/page.html create mode 100644 themes/theo_lem/templates/period_archives.html create mode 100644 themes/theo_lem/templates/tag.html create mode 100644 themes/theo_lem/templates/tags.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3ced0ac --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +content/images/* +output/images/* + +*.pyc diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0d1ba4a --- /dev/null +++ b/Makefile @@ -0,0 +1,79 @@ +PY?=python3 +PELICAN?=pelican +PELICANOPTS= + +LESSC=lessc +LESSFILES=themes/theo_lem/static/css/main.less +CSSFILES=themes/theo_lem/static/css/main.css +BASEDIR=$(CURDIR) +INPUTDIR=$(BASEDIR)/content +OUTPUTDIR=$(BASEDIR)/output +CONFFILE=$(BASEDIR)/pelicanconf.py +PUBLISHCONF=$(BASEDIR)/publishconf.py + + +DEBUG ?= 0 +ifeq ($(DEBUG), 1) + PELICANOPTS += -D +endif + +RELATIVE ?= 0 +ifeq ($(RELATIVE), 1) + PELICANOPTS += --relative-urls +endif + +help: + @echo 'Makefile for a pelican Web site ' + @echo ' ' + @echo 'Usage: ' + @echo ' make html (re)generate the web site ' + @echo ' make clean remove the generated files ' + @echo ' make regenerate regenerate files upon modification ' + @echo ' make publish generate using production settings ' + @echo ' make serve [PORT=8000] serve site at http://localhost:8000' + @echo ' make serve-global [SERVER=0.0.0.0] serve (as root) to $(SERVER):80 ' + @echo ' make devserver [PORT=8000] serve and regenerate together ' + @echo ' make ssh_upload upload the web site via SSH ' + @echo ' make rsync_upload upload the web site via rsync+ssh ' + @echo ' ' + @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html ' + @echo 'Set the RELATIVE variable to 1 to enable relative urls ' + @echo ' ' + +html: + $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) + +clean: + [ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR) + +regenerate: + $(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) + +serve: +ifdef PORT + $(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT) +else + $(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) +endif + +serve-global: +ifdef SERVER + $(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT) -b $(SERVER) +else + $(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT) -b 0.0.0.0 +endif + + +devserver: +ifdef PORT + $(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT) +else + $(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) +endif + +publish: + $(LESSC) $(LESSFILES) $(CSSFILES) + $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS) + + +.PHONY: html help clean regenerate serve serve-global devserver publish diff --git a/output/archives.html b/output/archives.html new file mode 100644 index 0000000..0aa5c5b --- /dev/null +++ b/output/archives.html @@ -0,0 +1,28 @@ + + + + + theo lem - Archives + + + + + + +
+

Archives for theo lem

+ +
+
+
+ + + + \ No newline at end of file diff --git a/output/authors.html b/output/authors.html new file mode 100644 index 0000000..e69de29 diff --git a/output/categories.html b/output/categories.html new file mode 100644 index 0000000..e69de29 diff --git a/output/feeds/all.atom.xml b/output/feeds/all.atom.xml new file mode 100644 index 0000000..8a7d779 --- /dev/null +++ b/output/feeds/all.atom.xml @@ -0,0 +1,2 @@ + +theo lemhttps://theo-lem.org/2020-04-29T20:13:10Z \ No newline at end of file diff --git a/output/index.html b/output/index.html new file mode 100644 index 0000000..74214fe --- /dev/null +++ b/output/index.html @@ -0,0 +1,30 @@ + + + + + theo lem + + + + + + +
+ + + +
+ + + + \ No newline at end of file diff --git a/output/tags.html b/output/tags.html new file mode 100644 index 0000000..e69de29 diff --git a/output/theme/css/main.css b/output/theme/css/main.css new file mode 100644 index 0000000..e68f5f7 --- /dev/null +++ b/output/theme/css/main.css @@ -0,0 +1,30 @@ +* { + background-color: white; + font-family: 'Courier New', Courier, monospace; +} +.navbar { + font-size: 1.5em; + width: 100%; + height: 10px; + border-right-color: black; + background-color: white; + margin-top: 30px; + border-bottom: solid; + border-width: 1px; +} +.banner { + height: 530px; + border: solid; + border-width: 1px; +} +.banner-img { + width: 100%; +} +.content { + margin-top: 50px; + margin-left: 15%; +} +.article-anchor { + padding-left: 10px; + padding-right: 10px; +} diff --git a/output/theme/css/main.less b/output/theme/css/main.less new file mode 100644 index 0000000..f26bd99 --- /dev/null +++ b/output/theme/css/main.less @@ -0,0 +1,42 @@ +@navbar-width:100%; +@navbar-height: 10px; +@banner-height: 530px; +@banner-width: 100%; + + +* { + background-color: white; + font-family: 'Courier New', Courier, monospace; +} + +.navbar { + font-size: 1.5em; + width: @navbar-width; + height: @navbar-height; + border-width: 1px; + border-right-color: black; + background-color: white; + margin-top: 30px; + border-bottom: solid; + border-width: 1px; +} + +.banner { + height: @banner-height; + border: solid; + border-width: 1px; +} + +.banner-img { + width: @banner-width; +} + +.content { + margin-top: @navbar-height + 40px; + margin-left: 15%; +} + +.article-anchor { + padding-left: 10px; + padding-right: 10px; +} \ No newline at end of file diff --git a/pelicanconf.py b/pelicanconf.py new file mode 100644 index 0000000..b69a107 --- /dev/null +++ b/pelicanconf.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- # +from __future__ import unicode_literals + +AUTHOR = 'theo' +SITENAME = 'theo lem' +SITEURL = '' + +PATH = 'content' + +TIMEZONE = 'Europe/Paris' + +DEFAULT_LANG = 'fr' + +# Feed generation is usually not desired when developing +FEED_ALL_ATOM = None +CATEGORY_FEED_ATOM = None +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 + +CSS_FILE = 'main.css' +THEME = 'themes/theo_lem' + +# Uncomment following line if you want document-relative URLs when developing +#RELATIVE_URLS = True \ No newline at end of file diff --git a/publishconf.py b/publishconf.py new file mode 100644 index 0000000..4f261f1 --- /dev/null +++ b/publishconf.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- # +from __future__ import unicode_literals + +# This file is only used if you use `make publish` or +# explicitly specify it as your config file. + +import os +import sys +sys.path.append(os.curdir) +from pelicanconf import * + +# If your site is available via HTTPS, make sure SITEURL begins with https:// +SITEURL = 'https://theo-lem.org' +RELATIVE_URLS = False + +FEED_ALL_ATOM = 'feeds/all.atom.xml' +CATEGORY_FEED_ATOM = 'feeds/{slug}.atom.xml' + +DELETE_OUTPUT_DIRECTORY = True + +# Following items are often useful when publishing + +#DISQUS_SITENAME = "" +#GOOGLE_ANALYTICS = "" \ No newline at end of file diff --git a/tasks.py b/tasks.py new file mode 100644 index 0000000..e89b3db --- /dev/null +++ b/tasks.py @@ -0,0 +1,110 @@ +# -*- coding: utf-8 -*- + +import os +import shutil +import sys +import datetime + +from invoke import task +from invoke.util import cd +from pelican.server import ComplexHTTPRequestHandler, RootedHTTPServer +from pelican.settings import DEFAULT_CONFIG, get_settings_from_file + +SETTINGS_FILE_BASE = 'pelicanconf.py' +SETTINGS = {} +SETTINGS.update(DEFAULT_CONFIG) +LOCAL_SETTINGS = get_settings_from_file(SETTINGS_FILE_BASE) +SETTINGS.update(LOCAL_SETTINGS) + +CONFIG = { + 'settings_base': SETTINGS_FILE_BASE, + 'settings_publish': 'publishconf.py', + # Output path. Can be absolute or relative to tasks.py. Default: 'output' + 'deploy_path': SETTINGS['OUTPUT_PATH'], + # Port for `serve` + 'port': 8000, +} + +@task +def clean(c): + """Remove generated files""" + if os.path.isdir(CONFIG['deploy_path']): + shutil.rmtree(CONFIG['deploy_path']) + os.makedirs(CONFIG['deploy_path']) + +@task +def build(c): + """Build local version of site""" + c.run('pelican -s {settings_base}'.format(**CONFIG)) + +@task +def rebuild(c): + """`build` with the delete switch""" + c.run('pelican -d -s {settings_base}'.format(**CONFIG)) + +@task +def regenerate(c): + """Automatically regenerate site upon file modification""" + c.run('pelican -r -s {settings_base}'.format(**CONFIG)) + +@task +def serve(c): + """Serve site at http://localhost:$PORT/ (default port is 8000)""" + + class AddressReuseTCPServer(RootedHTTPServer): + allow_reuse_address = True + + server = AddressReuseTCPServer( + CONFIG['deploy_path'], + ('', CONFIG['port']), + ComplexHTTPRequestHandler) + + sys.stderr.write('Serving on port {port} ...\n'.format(**CONFIG)) + server.serve_forever() + +@task +def reserve(c): + """`build`, then `serve`""" + build(c) + serve(c) + +@task +def preview(c): + """Build production version of site""" + c.run('pelican -s {settings_publish}'.format(**CONFIG)) + +@task +def livereload(c): + """Automatically reload browser tab upon file modification.""" + from livereload import Server + build(c) + server = Server() + # Watch the base settings file + server.watch(CONFIG['settings_base'], lambda: build(c)) + # Watch content source files + content_file_extensions = ['.md', '.rst'] + for extension in content_file_extensions: + content_blob = '{0}/**/*{1}'.format(SETTINGS['PATH'], extension) + server.watch(content_blob, lambda: build(c)) + # Watch the theme's templates and static assets + theme_path = SETTINGS['THEME'] + server.watch('{}/templates/*.html'.format(theme_path), lambda: build(c)) + static_file_extensions = ['.css', '.js'] + for extension in static_file_extensions: + static_file = '{0}/static/**/*{1}'.format(theme_path, extension) + server.watch(static_file, lambda: build(c)) + # Serve output path on configured port + server.serve(port=CONFIG['port'], root=CONFIG['deploy_path']) + + +@task +def publish(c): + """Publish to production via rsync""" + c.run('pelican -s {settings_publish}'.format(**CONFIG)) + c.run( + 'rsync --delete --exclude ".DS_Store" -pthrvz -c ' + '-e "ssh -p {ssh_port}" ' + '{} {ssh_user}@{ssh_host}:{ssh_path}'.format( + CONFIG['deploy_path'].rstrip('/') + '/', + **CONFIG)) + diff --git a/themes/theo_lem/static/css/main.css b/themes/theo_lem/static/css/main.css new file mode 100644 index 0000000..e68f5f7 --- /dev/null +++ b/themes/theo_lem/static/css/main.css @@ -0,0 +1,30 @@ +* { + background-color: white; + font-family: 'Courier New', Courier, monospace; +} +.navbar { + font-size: 1.5em; + width: 100%; + height: 10px; + border-right-color: black; + background-color: white; + margin-top: 30px; + border-bottom: solid; + border-width: 1px; +} +.banner { + height: 530px; + border: solid; + border-width: 1px; +} +.banner-img { + width: 100%; +} +.content { + margin-top: 50px; + margin-left: 15%; +} +.article-anchor { + padding-left: 10px; + padding-right: 10px; +} diff --git a/themes/theo_lem/static/css/main.less b/themes/theo_lem/static/css/main.less new file mode 100644 index 0000000..861fb6c --- /dev/null +++ b/themes/theo_lem/static/css/main.less @@ -0,0 +1,41 @@ +@navbar-width:100%; +@navbar-height: 10px; +@banner-height: 530px; +@banner-width: 100%; + +* { + background-color: white; + font-family: 'Courier New', Courier, monospace; +} + +.navbar { + font-size: 1.5em; + width: @navbar-width; + height: @navbar-height; + border-width: 1px; + border-right-color: black; + background-color: white; + margin-top: 30px; + border-bottom: solid; + border-width: 1px; +} + +.banner { + height: @banner-height; + border: solid; + border-width: 1px; +} + +.banner-img { + width: @banner-width; +} + +.content { + margin-top: @navbar-height + 40px; + margin-left: 15%; +} + +.article-anchor { + padding-left: 10px; + padding-right: 10px; +} \ No newline at end of file diff --git a/themes/theo_lem/templates/archive.html b/themes/theo_lem/templates/archive.html new file mode 100644 index 0000000..e69de29 diff --git a/themes/theo_lem/templates/article.html b/themes/theo_lem/templates/article.html new file mode 100644 index 0000000..6c40814 --- /dev/null +++ b/themes/theo_lem/templates/article.html @@ -0,0 +1,6 @@ +{% extends 'base.html' %} +{% block content %} + +{{ article.content }} + +{% endblock content %} \ No newline at end of file diff --git a/themes/theo_lem/templates/author.html b/themes/theo_lem/templates/author.html new file mode 100644 index 0000000..e69de29 diff --git a/themes/theo_lem/templates/authors.html b/themes/theo_lem/templates/authors.html new file mode 100644 index 0000000..e69de29 diff --git a/themes/theo_lem/templates/base.html b/themes/theo_lem/templates/base.html new file mode 100644 index 0000000..3db7c74 --- /dev/null +++ b/themes/theo_lem/templates/base.html @@ -0,0 +1,33 @@ + + + + + {% block title %}{{ SITENAME }}{% endblock %} + + + + + + +
+ {% block content%} + {% endblock %} +
+ + + + \ No newline at end of file diff --git a/themes/theo_lem/templates/categories.html b/themes/theo_lem/templates/categories.html new file mode 100644 index 0000000..e69de29 diff --git a/themes/theo_lem/templates/category.html b/themes/theo_lem/templates/category.html new file mode 100644 index 0000000..e69de29 diff --git a/themes/theo_lem/templates/index.html b/themes/theo_lem/templates/index.html new file mode 100644 index 0000000..3d2e1dc --- /dev/null +++ b/themes/theo_lem/templates/index.html @@ -0,0 +1,9 @@ +{% extends 'base.html' %} +{% block content %} + + + +{% endblock content %} \ No newline at end of file diff --git a/themes/theo_lem/templates/page.html b/themes/theo_lem/templates/page.html new file mode 100644 index 0000000..e69de29 diff --git a/themes/theo_lem/templates/period_archives.html b/themes/theo_lem/templates/period_archives.html new file mode 100644 index 0000000..e69de29 diff --git a/themes/theo_lem/templates/tag.html b/themes/theo_lem/templates/tag.html new file mode 100644 index 0000000..e69de29 diff --git a/themes/theo_lem/templates/tags.html b/themes/theo_lem/templates/tags.html new file mode 100644 index 0000000..e69de29