merged the translation over to using my templates master
authorBenjamin Mako Hill <mako@atdot.cc>
Sat, 26 Oct 2013 04:15:25 +0000 (21:15 -0700)
committerBenjamin Mako Hill <mako@atdot.cc>
Sat, 26 Oct 2013 04:16:44 +0000 (21:16 -0700)
.gitignore [new file with mode: 0644]
hill-freedom_for_users-ES.tmpl [moved from hill-freedom_for_users.es.html with 84% similarity]
hill-freedom_for_users.tmpl [moved from hill-freedom_for_users.html with 84% similarity]
latex-like-layout.tmpl [new file with mode: 0644]
latex-like.css [new file with mode: 0644]
render_templates.py [new file with mode: 0755]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..981301c
--- /dev/null
@@ -0,0 +1,2 @@
+hill-freedom_for_users-ES.html
+hill-freedom_for_users.html
similarity index 84%
rename from hill-freedom_for_users.es.html
rename to hill-freedom_for_users-ES.tmpl
index edd97f3add64dadf4b25c440cff13529dddf88a8..cb7a6a8b291a39e88081c8e86dbf5e7e30a54183 100644 (file)
@@ -1,35 +1,11 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+{% extends 'latex-like-layout.tmpl' %}
+{% set page_title = 'Libertad para los usuarios, no para el software' %}
 
 
-<html xml:lang="es" lang="es">
-  <head>
-    <meta charset="UTF-8">
-    <title>Libertad para los usuarios, no para el software :: Benjamin Mako Hill</title>
-    <link rel="stylesheet" type="text/css" href="http://mako.cc//latex-like.css" />
-  </head>
-
-  <body>
-    <h1>Libertad para los usuarios, no para el software</h1>
-    <h2 class="author"><a href="http://mako.cc">Benjamin Mako Hill</a><br />
-       <span style="font-size: 0.9em;">mako@atdot.cc</span></h2>
-
-   
+{% block content_box %}
 
 <h2 class="date">23 de octubre de 2011</h2>
 
 
 <h2 class="date">23 de octubre de 2011</h2>
 
-<!-- 
-<blockquote><em>Translations into
-  <a href="http://osamak.wordpress.com/2010/09/07/hill-free_tools/">Arabic (لغة عربية)</a>,
-  <a href="http://www.framablog.org/index.php/post/2010/09/08/logiciels-libres-mais-outils-non-libres">French (Français)</a>,
-  <a href="http://wiki.lulug.org/freedom/benjamin">Italian (Italiano)</a>,
-  <a href="hill-free_tools-ES.html">Spanish (Español)</a>,
-  and <a href="http://zzz.fisek.com.tr/seyir-defteri/?p=758">Turkish (Türkçe)</a>
-are also available.</em></blockquote> 
--->
-
-<blockquote><em>Traducido por Laura Arjona (larjona99[at]gmail.com). Original (en Inglés),
-y otras traducciones disponibles en <a href="http://mako.cc/writing/hill-freedom_for_users.html">http://mako.cc/writing/hill-freedom_for_users.html</a>.</em></blockquote>
+<blockquote><em>Traducido por Laura Arjona (larjona99[at]gmail.com). Original (en Inglés), y otras traducciones disponibles en <a href="hill-freedom_for_users.html">http://mako.cc/writing/hill-freedom_for_users.html</a>.</em></blockquote>
 
 <blockquote><em>Publicado en <strong>Wealth of the Commons: A World Beyond Market and State.</strong> Editado por David Bollier y Silke Helfrich. Levellers Press, 2012. [<a href="http://en.wikipedia.org/wiki/Special:BookSources/978-1937146146">ISBN:978-1937146146</a> / <a href="http://www.wealthofthecommons.org/">Sitio web</a>]<br />
 
 
 <blockquote><em>Publicado en <strong>Wealth of the Commons: A World Beyond Market and State.</strong> Editado por David Bollier y Silke Helfrich. Levellers Press, 2012. [<a href="http://en.wikipedia.org/wiki/Special:BookSources/978-1937146146">ISBN:978-1937146146</a> / <a href="http://www.wealthofthecommons.org/">Sitio web</a>]<br />
 
@@ -94,30 +70,4 @@ Hoy, parece probable que Google y su modelo de negocio orientado al servicio rep
 
 </table>
 
 
 </table>
 
-
-
-  <div id="footer">
-  <hr />
-  © 1999-2013 <a href="/">Benjamin Mako Hill</a><br />
-  Publicado bajo la licencia <a rel="license"
-  href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative
-  Commons Attribution-Share Alike 3.0 United States License</a>.<br />
-  Puede solicitar una licencia más permisiva.<br />
-
-  Última modificación: Dom 30 Dic 20:17:04 2012
-  </div>
-
-<!-- Piwik -->
-<script type="text/javascript">
-var pkBaseURL = (("https:" == document.location.protocol) ? "https://analytics.mako.cc/" : "http://analytics.mako.cc/");
-document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
-</script><script type="text/javascript">
-try {
-var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
-piwikTracker.trackPageView();
-piwikTracker.enableLinkTracking();
-} catch( err ) {}
-</script><noscript><p><img src="http://analytics.mako.cc/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
-<!-- End Piwik Tracking Code -->
-  </body>
-</html>
+{% endblock %}
similarity index 84%
rename from hill-freedom_for_users.html
rename to hill-freedom_for_users.tmpl
index 5f26c56c305faf97e7868466958fd3af351ad6fa..40b5c3d2f2b7f58e5886a277a7582ec8528ffd21 100644 (file)
@@ -1,32 +1,13 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+{% extends 'latex-like-layout.tmpl' %}
+{% set page_title = 'Freedom for Users, Not for Software' %}
 
 
-<html xml:lang="en" lang="en">
-  <head>
-    <meta charset="UTF-8">
-    <title>Freedom for Users, Not for Software :: Benjamin Mako Hill</title>
-    <link rel="stylesheet" type="text/css" href="http://mako.cc//latex-like.css" />
-  </head>
-
-  <body>
-    <h1>Freedom for Users, Not for Software</h1>
-    <h2 class="author"><a href="http://mako.cc">Benjamin Mako Hill</a><br />
-       <span style="font-size: 0.9em;">mako@atdot.cc</span></h2>
-
-   
+{% block content_box %}
 
 <h2 class="date">October 23, 2011</h2>
 
 
 <h2 class="date">October 23, 2011</h2>
 
-<!-- 
-<blockquote><em>Translations into
-  <a href="http://osamak.wordpress.com/2010/09/07/hill-free_tools/">Arabic (لغة عربية)</a>,
-  <a href="http://www.framablog.org/index.php/post/2010/09/08/logiciels-libres-mais-outils-non-libres">French (Français)</a>,
-  <a href="http://wiki.lulug.org/freedom/benjamin">Italian (Italiano)</a>,
-  <a href="hill-free_tools-ES.html">Spanish (Español)</a>,
-  and <a href="http://zzz.fisek.com.tr/seyir-defteri/?p=758">Turkish (Türkçe)</a>
-are also available.</em></blockquote> 
--->
+<blockquote><em>Translation into
+  <a href="hill-freedom_for_users-ES.html">Spanish (Español)</a> is also available.</em>
+</blockquote> 
 
 <blockquote><em>Published in <strong>Wealth of the Commons: A World Beyond Market and State.</strong> Edited by David Bollier and Silke Helfrich. Levellers Press, 2012. [<a href="http://en.wikipedia.org/wiki/Special:BookSources/978-1937146146">ISBN:978-1937146146</a> / <a href="http://www.wealthofthecommons.org/">Website</a>]<br />
 
 
 <blockquote><em>Published in <strong>Wealth of the Commons: A World Beyond Market and State.</strong> Edited by David Bollier and Silke Helfrich. Levellers Press, 2012. [<a href="http://en.wikipedia.org/wiki/Special:BookSources/978-1937146146">ISBN:978-1937146146</a> / <a href="http://www.wealthofthecommons.org/">Website</a>]<br />
 
@@ -87,30 +68,4 @@ Also published in German in <strong>Commons: Für eine neue Politik Jenseits von
 
 </table>
 
 
 </table>
 
-
-
-  <div id="footer">
-  <hr />
-  © 1999-2013 <a href="/">Benjamin Mako Hill</a><br />
-  Licensed under the <a rel="license"
-  href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative
-  Commons Attribution-Share Alike 3.0 United States License</a>.<br />
-  More permissive licensing may be available on request.<br />
-
-  Last modified: Sun Dec 30 20:17:04 2012
-  </div>
-
-<!-- Piwik -->
-<script type="text/javascript">
-var pkBaseURL = (("https:" == document.location.protocol) ? "https://analytics.mako.cc/" : "http://analytics.mako.cc/");
-document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
-</script><script type="text/javascript">
-try {
-var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
-piwikTracker.trackPageView();
-piwikTracker.enableLinkTracking();
-} catch( err ) {}
-</script><noscript><p><img src="http://analytics.mako.cc/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
-<!-- End Piwik Tracking Code -->
-  </body>
-</html>
+{% endblock %}
diff --git a/latex-like-layout.tmpl b/latex-like-layout.tmpl
new file mode 100644 (file)
index 0000000..1170994
--- /dev/null
@@ -0,0 +1,47 @@
+{%- set base_url = "http://mako.cc/" -%}
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8">
+    <title>{{ page_title }}{% if page_title %} :: {% endif %}Benjamin Mako Hill</title>
+    <link rel="stylesheet" type="text/css" href="{{base_url}}/latex-like.css" />
+    <link rel="shortcut icon" href="http://mako.cc/favicon.ico" />
+  </head>
+
+  <body>
+    <h1>{{page_title}}</h1>
+    <h2 class="author"><a href="http://mako.cc">Benjamin Mako Hill</a><br />
+       <span style="font-size: 0.9em;">mako@atdot.cc</span></h2>
+
+   {% block content_box %}
+   {% endblock %}
+
+  <div id="footer">
+  <hr />
+  © 1999-2013 <a href="/">Benjamin Mako Hill</a><br />
+  Licensed under the <a rel="license"
+  href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative
+  Commons Attribution-Share Alike 3.0 United States License</a>.<br />
+  More permissive licensing may be available on request.<br />
+
+  Last modified: {{last_modified}}
+  </div>
+
+<!-- Piwik -->
+<script type="text/javascript">
+var pkBaseURL = (("https:" == document.location.protocol) ? "https://analytics.mako.cc/" : "http://analytics.mako.cc/");
+document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
+</script><script type="text/javascript">
+try {
+var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
+piwikTracker.trackPageView();
+piwikTracker.enableLinkTracking();
+} catch( err ) {}
+</script><noscript><p><img src="http://analytics.mako.cc/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
+<!-- End Piwik Tracking Code -->
+  </body>
+</html>
+
diff --git a/latex-like.css b/latex-like.css
new file mode 100644 (file)
index 0000000..998d1d5
--- /dev/null
@@ -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 (executable)
index 0000000..299c6a1
--- /dev/null
@@ -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)
+
+

Benjamin Mako Hill || Want to submit a patch?