8e1156959046 v0.2.1

dat unicode
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 10 Jul 2013 18:47:25 -0400
parents 3134a7a14ee0
children 341cf2a97a8f
branches/tags v0.2.1
files LICENSE.markdown d/base.py docs/02-usage.markdown docs/footer.markdown setup.py

Changes

--- a/LICENSE.markdown	Sat Jul 07 00:00:59 2012 -0400
+++ b/LICENSE.markdown	Wed Jul 10 18:47:25 2013 -0400
@@ -1,4 +1,4 @@
-Copyright (c) 2012 Steve Losh and contributors
+Copyright (c) 2013 Steve Losh and contributors
 
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal in
--- a/d/base.py	Sat Jul 07 00:00:59 2012 -0400
+++ b/d/base.py	Wed Jul 10 18:47:25 2013 -0400
@@ -13,6 +13,7 @@
 <!DOCTYPE html>
 <html>
     <head>
+        <meta charset="utf-8" />
         <title>{title_tag}</title>
         <link rel="stylesheet" href="./_dmedia/bootstrap.css"/>
         <link rel="stylesheet" href="./_dmedia/tango.css"/>
@@ -29,6 +30,7 @@
 <!DOCTYPE html>
 <html>
     <head>
+        <meta charset="utf-8" />
         <title>{title_tag}</title>
         <link rel="stylesheet" href="../_dmedia/bootstrap.css"/>
         <link rel="stylesheet" href="../_dmedia/tango.css"/>
@@ -51,6 +53,12 @@
 
 
 
+def _read(f):
+    return f.read().decode('utf-8')
+
+def _write(f, content):
+    return f.write(content.encode('utf-8'))
+
 
 def _get_target_url(path, destination):
     return os.path.split(_get_target(path, destination))[-1]
@@ -68,7 +76,7 @@
 def _get_project_title(source):
     if os.path.isfile(j(source, 'title')):
         with open(j(source, 'title')) as f:
-            return f.read().strip()
+            return _read(f).strip()
     else:
         current = dirname(source).lower()
         if current not in ['doc', 'docs', 'documentation']:
@@ -90,7 +98,7 @@
         target = j(source, filename);
         if os.path.isfile(target):
             with open(target) as f:
-                return md.convert(f.read())
+                return md.convert(_read(f))
 
     return ''
 
@@ -133,7 +141,8 @@
     else:
         e('.markdown').prepend('<h1><a href="">' + fallback_title + '</a></h1>')
 
-    return unicode(e)
+    # What the fuck, pyquery?
+    return u'<!DOCTYPE html>\n' + unicode(e)
 
 def _ensure_dir(path):
     if not os.path.isdir(path):
@@ -175,7 +184,7 @@
 
 def _render(title, header, footer, source, destination, page_type, toc=None):
     with open(source) as f:
-        data = f.read()
+        data = _read(f)
 
     fallback_title = _get_fallback_title(source)
 
@@ -197,7 +206,7 @@
         os.makedirs(destination)
 
     with open(j(destination, 'index.html'), 'w') as f:
-        f.write(content)
+        _write(f, content)
 
     return page_title
 
--- a/docs/02-usage.markdown	Sat Jul 07 00:00:59 2012 -0400
+++ b/docs/02-usage.markdown	Wed Jul 10 18:47:25 2013 -0400
@@ -15,7 +15,7 @@
     mkdir docs
     cd docs
 
-Write some docs:
+Write some docs (UTF-8):
 
     :::bash
     touch index.markdown
--- a/docs/footer.markdown	Sat Jul 07 00:00:59 2012 -0400
+++ b/docs/footer.markdown	Wed Jul 10 18:47:25 2013 -0400
@@ -2,17 +2,3 @@
 Inspired by [t](http://stevelosh.com/projects/t/).
 
 <br/><a id='rochester-made' href='http://rochestermade.com' title='Rochester Made'><img src='http://rochestermade.com/media/images/rochester-made-dark-on-light.png' alt='Rochester Made' title='Rochester Made' /></a>
-
-<script type="text/javascript">
-    var _gauges = _gauges || [];
-    (function() {
-        var t   = document.createElement('script');
-        t.type  = 'text/javascript';
-        t.async = true;
-        t.id    = 'gauges-tracker';
-        t.setAttribute('data-site-id', '4f1df6cb844d521f7b000003');
-        t.src = '//secure.gaug.es/track.js';
-        var s = document.getElementsByTagName('script')[0];
-        s.parentNode.insertBefore(t, s);
-    })();
-</script>
--- a/setup.py	Sat Jul 07 00:00:59 2012 -0400
+++ b/setup.py	Wed Jul 10 18:47:25 2013 -0400
@@ -2,7 +2,7 @@
 
 setup(
     name='d',
-    version='0.2.0',
+    version='0.2.1',
     author='Steve Losh',
     author_email='steve@stevelosh.com',
     packages=['d'],