about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/etc/rustdoc.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/etc/rustdoc.py b/src/etc/rustdoc.py
new file mode 100644
index 00000000000..d5189a19e0f
--- /dev/null
+++ b/src/etc/rustdoc.py
@@ -0,0 +1,34 @@
+# A little helper script for passing rustdoc output through markdown
+#  and pandoc
+
+import sys, os, commands;
+
+if len(sys.argv) < 2:
+    print("Please provide an input crate")
+    sys.exit(1)
+
+crate = sys.argv[1]
+
+status, output = commands.getstatusoutput("rustdoc " + crate)
+
+basename = os.path.splitext(os.path.basename(crate))[0]
+
+markdownfile = basename + ".md"
+
+f = open(markdownfile, 'w')
+f.write(output)
+f.close()
+
+status, output = commands.getstatusoutput("markdown " + markdownfile)
+
+htmlfile = basename + ".md.html"
+
+f = open(htmlfile, 'w')
+f.write(output)
+f.close()
+
+pdcmd = "pandoc --standalone --toc --section-divs --number-sections \
+         --from=markdown --to=html --css=rust.css \
+         --output=" + basename + ".pd.html " + markdownfile
+
+os.system(pdcmd)