From 86d96fbd939d2eba86cc3316aa47e530894f3db9 Mon Sep 17 00:00:00 2001 From: Benjamin Mako Hill Date: Fri, 25 Oct 2013 21:15:25 -0700 Subject: [PATCH] merged the translation over to using my templates --- .gitignore | 2 + ....es.html => hill-freedom_for_users-ES.tmpl | 60 ++----------------- ..._users.html => hill-freedom_for_users.tmpl | 59 +++--------------- latex-like-layout.tmpl | 47 +++++++++++++++ latex-like.css | 31 ++++++++++ render_templates.py | 40 +++++++++++++ 6 files changed, 132 insertions(+), 107 deletions(-) create mode 100644 .gitignore rename hill-freedom_for_users.es.html => hill-freedom_for_users-ES.tmpl (84%) rename hill-freedom_for_users.html => hill-freedom_for_users.tmpl (84%) create mode 100644 latex-like-layout.tmpl create mode 100644 latex-like.css create mode 100755 render_templates.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..981301c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +hill-freedom_for_users-ES.html +hill-freedom_for_users.html diff --git a/hill-freedom_for_users.es.html b/hill-freedom_for_users-ES.tmpl similarity index 84% rename from hill-freedom_for_users.es.html rename to hill-freedom_for_users-ES.tmpl index edd97f3..cb7a6a8 100644 --- a/hill-freedom_for_users.es.html +++ b/hill-freedom_for_users-ES.tmpl @@ -1,35 +1,11 @@ - - +{% extends 'latex-like-layout.tmpl' %} +{% set page_title = 'Libertad para los usuarios, no para el software' %} - - - - Libertad para los usuarios, no para el software :: Benjamin Mako Hill - - - - -

Libertad para los usuarios, no para el software

-

Benjamin Mako Hill
- mako@atdot.cc

- - +{% block content_box %}

23 de octubre de 2011

- - -
Traducido por Laura Arjona (larjona99[at]gmail.com). Original (en Inglés), -y otras traducciones disponibles en http://mako.cc/writing/hill-freedom_for_users.html.
+
Traducido por Laura Arjona (larjona99[at]gmail.com). Original (en Inglés), y otras traducciones disponibles en http://mako.cc/writing/hill-freedom_for_users.html.
Publicado en Wealth of the Commons: A World Beyond Market and State. Editado por David Bollier y Silke Helfrich. Levellers Press, 2012. [ISBN:978-1937146146 / Sitio web]
@@ -94,30 +70,4 @@ Hoy, parece probable que Google y su modelo de negocio orientado al servicio rep - - - - - - - - - +{% endblock %} diff --git a/hill-freedom_for_users.html b/hill-freedom_for_users.tmpl similarity index 84% rename from hill-freedom_for_users.html rename to hill-freedom_for_users.tmpl index 5f26c56..40b5c3d 100644 --- a/hill-freedom_for_users.html +++ b/hill-freedom_for_users.tmpl @@ -1,32 +1,13 @@ - - +{% extends 'latex-like-layout.tmpl' %} +{% set page_title = 'Freedom for Users, Not for Software' %} - - - - Freedom for Users, Not for Software :: Benjamin Mako Hill - - - - -

Freedom for Users, Not for Software

-

Benjamin Mako Hill
- mako@atdot.cc

- - +{% block content_box %}

October 23, 2011

- +
Translation into + Spanish (Español) is also available. +
Published in Wealth of the Commons: A World Beyond Market and State. Edited by David Bollier and Silke Helfrich. Levellers Press, 2012. [ISBN:978-1937146146 / Website]
@@ -87,30 +68,4 @@ Also published in German in Commons: Für eine neue Politik Jenseits von - - - - - - - - - +{% endblock %} diff --git a/latex-like-layout.tmpl b/latex-like-layout.tmpl new file mode 100644 index 0000000..1170994 --- /dev/null +++ b/latex-like-layout.tmpl @@ -0,0 +1,47 @@ +{%- set base_url = "http://mako.cc/" -%} + + + + + + + {{ page_title }}{% if page_title %} :: {% endif %}Benjamin Mako Hill + + + + + +

{{page_title}}

+

Benjamin Mako Hill
+ mako@atdot.cc

+ + {% block content_box %} + {% endblock %} + + + + + + + + + diff --git a/latex-like.css b/latex-like.css new file mode 100644 index 0000000..998d1d5 --- /dev/null +++ b/latex-like.css @@ -0,0 +1,31 @@ +body { + margin-left: 1in; + margin-right: 1in; + +} +h1 { + font-style: italic; + font-size: 2em; +} + +a { + text-decoration: none; +} + +.author { + font-size: 1.4em; +} + +.date { + font-size: 1em; +} + + +p,blockquote,li { + line-height: 170%; +} + +#footer { + font-size: 1em; + text-align: right; +} diff --git a/render_templates.py b/render_templates.py new file mode 100755 index 0000000..299c6a1 --- /dev/null +++ b/render_templates.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python + +import os +import re +import codecs +from time import ctime +from os.path import walk, getctime + +root = os.path.dirname(os.path.abspath(__file__)) + +from jinja2 import Environment, FileSystemLoader +jinja_env = Environment(loader=FileSystemLoader(root)) + +def render_walk(arg=None, dirname='', filenames=[]): + for filename in filenames: + match = re.match(r'(.*)\.tmpl$', filename) + if match: + filename_base = match.group(1) + + # skip if this is the layout file + if filename_base == 'layout': continue + if filename_base == 'latex-like-layout': continue + + vars = { 'last_modified' : + unicode(ctime(getctime(os.path.join(dirname, filename)))) } + + # remove the root from the dirname + dirname = re.sub(re.escape(root) + r'/?(.*)$', r'\1', dirname) + + tmpl = jinja_env.get_template(os.path.join(dirname, filename)) + tmpl.render(vars) + + output_file = codecs.open(os.path.join(dirname, filename_base + '.html'), 'w', 'utf-8') + print >>output_file, tmpl.render(vars) + output_file.close() + +os.chdir(root) +walk(root, render_walk, None) + + -- 2.30.2