Commits

Steve Losh committed 8e11569

dat unicode

  • Participants
  • Parent commits 3134a7a
  • Tags v0.2.1

Comments (0)

Files changed (5)

File LICENSE.markdown

-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
 <!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"/>
 <!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"/>
 
 
 
+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]
 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']:
         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 ''
 
     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):
 
 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)
 
         os.makedirs(destination)
 
     with open(j(destination, 'index.html'), 'w') as f:
-        f.write(content)
+        _write(f, content)
 
     return page_title
 

File docs/02-usage.markdown

     mkdir docs
     cd docs
 
-Write some docs:
+Write some docs (UTF-8):
 
     :::bash
     touch index.markdown

File docs/footer.markdown

 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>
 
 setup(
     name='d',
-    version='0.2.0',
+    version='0.2.1',
     author='Steve Losh',
     author_email='steve@stevelosh.com',
     packages=['d'],