summaryrefslogtreecommitdiff
path: root/docgen.py
diff options
context:
space:
mode:
authorBenjamin Valentin <[email protected]>2012-03-27 03:03:55 +0200
committerBenjamin Valentin <[email protected]>2012-03-27 03:03:55 +0200
commite214b332395adbc77ad596218895a4834cad434d (patch)
tree52df3b5c109d78f18e2d48f1b34336561e939c93 /docgen.py
parentd367ab28270220c1378d2a7ca9bda4a9012c76cb (diff)
downloadcaja-dropbox-e214b332395adbc77ad596218895a4834cad434d.tar.bz2
caja-dropbox-e214b332395adbc77ad596218895a4834cad434d.tar.xz
import nautilus dropbox 0.7.1
Diffstat (limited to 'docgen.py')
-rw-r--r--docgen.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/docgen.py b/docgen.py
new file mode 100644
index 0000000..a2a3912
--- /dev/null
+++ b/docgen.py
@@ -0,0 +1,25 @@
+import sys
+import datetime
+
+# heeeheee
+env = {"__name__":"__notmain__"}
+execfile("dropbox", env)
+commands = env["commands"]
+
+f = open("AUTHORS", "r")
+authors = '| ' + f.read().replace('\n', '\n| ')
+f.close()
+
+formatted_commands = ""
+for cmd in commands:
+ split = commands[cmd].__doc__.split('\n', 2)
+ formatted_commands += split[1].decode('ascii').replace(cmd, "`%s`" % cmd).replace("dropbox", "``dropbox``")
+ formatted_commands += split[2].decode('ascii').replace('\n', '\n | ')
+ formatted_commands += '\n\n'
+
+sys.stdout.write(sys.stdin.read().replace\
+ ('@AUTHORS@', authors).replace\
+ ('@DATE@', datetime.date.today().isoformat()).replace\
+ ('@PACKAGE_VERSION@', sys.argv[1]).replace\
+ ('@SYNOPSIS@', '| '+'\n| '.join(commands[cmd].__doc__.split('\n', 2)[1].decode('ascii').replace(cmd, "`%s`" % cmd).replace("dropbox", "``dropbox``") for cmd in commands)).replace\
+ ('@COMMANDS@', formatted_commands))