Fredrik Håård committed 4a6d434

multiple styles

Comments (0)

Files changed (2)

     """Create a identifier from doc title, replacing special chars with dash (-)"""
     return re.sub("[^\w]", "-", parts["title"]).strip("-")
-def setup_target_folder(html_path, css_path, css_name):
+def setup_target_folder(html_path, css_path, css_names):
     """Create target folder if it does not exist, and copy CSS files there"""
     if not os.path.exists(html_path):
-    shutil.copy(os.path.join(css_path, css_name), html_path)
-    shutil.copy(os.path.join(css_path, "html4css1.css"), html_path)
+    for css in css_names:
+        shutil.copy(os.path.join(css_path, css), html_path)
 def hgdate_to_utc(hgdate_string):
     """Convert a hgdate format string to unix time UTC"""
         css_path=config.get('html', 'css_path'),
-        css_name=config.get('html', 'css_name')
+        css_names=config.get('html', 'css_name').split()
     entries_path = config.get('content', 'entries_path')
     blurbs = get_custom(
         config.get('content','custom_path'), 'blurbs')
+    css_files = [config.get('html', 'css_url') + name + "?" + str(int(time())) 
+            for name in config.get('html', 'css_name').split()]
     defaults = {
         'disqus': disqus,
-        'css': config.get('html', 'css_url') + "?" + str(int(time())), #force reload. 
+        'css_files': css_files, 
         'page_title': title,
         'blaag_title': title,
         'author': config.get('content', 'author'),
     parser.add_argument('-t', '--test',
-                        help="generate html for local testing")
+                        help="Generate html for local testing")
+    parser.add_argument('-s', '--server',
+                        action='store_true',
+                        default=False,
+                        help="After generating, start at HTTP Server at port 8000 " +
+                        "rooted in the html folder")
     parser.add_argument('-c', '--config',
                         help="custom .cfg file (defaults to blaag.cfg)")
     args = parser.parse_args()
     generate_blaag(args.config, args.test)
+    if args.server:
+        import SimpleHTTPServer, SocketServer
+        os.chdir("html")
+        Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
+        httpd = SocketServer.TCPServer(("", 8000), Handler)
+        print("Serving")
+        httpd.serve_forever()
 if __name__ == "__main__":


   <meta charset="UTF-8" />
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-  <link rel="stylesheet" type="text/css" href="$css" />
+  <link py:for="css in css_files" rel="stylesheet" type="text/css" href="$css" />
   <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
   <meta name="description" content="$page_title"/>
   <meta name="author" content="$author" />
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.