*sigh* go back to pycco... for now...
authorRalf Jung <post@ralfj.de>
Wed, 10 Jun 2015 06:50:03 +0000 (08:50 +0200)
committerRalf Jung <post@ralfj.de>
Wed, 10 Jun 2015 06:50:03 +0000 (08:50 +0200)
.gitignore
Makefile
docs/.gitignore [new file with mode: 0644]
docs/pycco_custom.css [new file with mode: 0644]
pycco-rs [new file with mode: 0755]

index aabea6fd3fa68f20625979c76a1a386e515081f0..4903df59e089e43676680bd8dbbafb319fe06b0c 100644 (file)
@@ -1,4 +1,3 @@
 target/
-docs/
 sync-docs
 rawsrc/
index dc3ffb02c3be03f3a44fce6636e037ab20087179..706b1db48ac643b063dae9ae241c6218d5c0390a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ all: docs rawsrc
 .PHONY: docs rawsrc
 
 docs:
-       @docco $(FILES) # -l linear
+       @./pycco-rs $(FILES)
 
 rawsrc:
        @mkdir -p rawsrc
diff --git a/docs/.gitignore b/docs/.gitignore
new file mode 100644 (file)
index 0000000..fe099b8
--- /dev/null
@@ -0,0 +1,3 @@
+fonts/
+*.html
+pycco.css
diff --git a/docs/pycco_custom.css b/docs/pycco_custom.css
new file mode 100644 (file)
index 0000000..bee0e24
--- /dev/null
@@ -0,0 +1,31 @@
+/*--------------------- Typography ----------------------------*/
+
+@font-face {
+    font-family: 'aller-light';
+    src: url('fonts/aller-light.eot');
+    src: url('fonts/aller-light.eot?#iefix') format('embedded-opentype'),
+         url('fonts/aller-light.woff') format('woff'),
+         url('fonts/aller-light.ttf') format('truetype');
+    font-weight: normal;
+    font-style: normal;
+}
+
+/*--------------------- Layout ----------------------------*/
+body {
+  font-family: 'aller-light', sans-serif;
+}
+
+h1, h2, h3, h4, h5, h6 {
+  line-height: 1em;
+}
+
+/*---------------------- Syntax Highlighting -----------------------------*/
+body .k { font-weight: bold }                   /* Keyword */
+body .kd { font-weight: normal }                /* Keyword.Declaration */
+body .n { color: #19469D }                      /* Name */
+
+body .mf { color: #40A070 }                     /* Literal.Number.Float */
+body .mh { color: #40A070 }                     /* Literal.Number.Hex */
+body .mi { color: #40A070 }                     /* Literal.Number.Integer */
+body .mo { color: #40A070 }                     /* Literal.Number.Oct */
+body .il { color: #40A070 }                     /* Literal.Number.Integer.Long */
diff --git a/pycco-rs b/pycco-rs
new file mode 100755 (executable)
index 0000000..bfb731c
--- /dev/null
+++ b/pycco-rs
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+# A little wrapper around pycco, to add Rust support.
+import pycco, pycco_resources
+from pygments import lexers, formatters
+import re
+
+# now, monkey-patch pycco for Rust support
+pycco.main.languages[".rs"] = { "name": "rust", "symbol": "//"}
+for ext, l in pycco.main.languages.items():
+    # Does the line begin with a comment?
+    l["comment_matcher"] = re.compile(r"^\s*" + l["symbol"] + "\s?")
+    # The dividing token we feed into Pygments, to delimit the boundaries between
+    # sections.
+    l["divider_text"] = "\n" + l["symbol"] + "DIVIDER\n"
+    # The mirror of `divider_text` that we expect Pygments to return. We can split
+    # on this to recover the original sections.
+    l["divider_html"] = re.compile(r'\n*<span class="c[1]?">' + l["symbol"] + 'DIVIDER</span>\n*')
+    # Get the Pygments Lexer for this language.
+    l["lexer"] = lexers.get_lexer_by_name(l["name"])
+# and monkey-patch for a custom CSS file
+html_src = pycco_resources.html
+marker = '<link rel="stylesheet" href="{{ stylesheet }}">'
+custom_css = '<link rel="stylesheet" href="pycco_custom.css">'
+patched_html = html_src.replace(marker, marker+custom_css, 1)
+pycco.main.pycco_template = pycco.main.template(patched_html)
+
+pycco.main.main()