Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added the possibility to export all canvases in rubber compatible format

  • Loading branch information...
commit 162957981af370dc03cdc43a1c5f128e1f8adf24 1 parent a58aff0
@fikovnik authored
Showing with 27 additions and 6 deletions.
  1. +27 −6 src/omnigraffle_export/rubber.py
View
33 src/omnigraffle_export/rubber.py
@@ -7,12 +7,8 @@
arg_re_ = re.compile('(.*):(.*)\.(.*)')
-def main():
- if len(sys.argv) != 2:
- print >> sys.stderr, 'Usage: %s: <path_to_omnigraffle_source>:<canvas_name>.<format>' % sys.argv[0]
- sys.exit(1)
-
- input = arg_re_.match(sys.argv[1])
+def export_one(input):
+ input = arg_re_.match(input)
if len(input.groups()) != 3:
print >> sys.stderr, 'Invalid input: %s' % sys.argv[1]
@@ -26,7 +22,32 @@ def main():
schema = omnigraffle_export.OmniGraffleSchema(source)
schema.export(canvas, target, format)
+
sys.exit(0)
+def export_all(source, targetdir, format):
+ base_source = os.path.basename(source)
+ nameprefix = base_source[:base_source.rindex('.graffle')]
+
+ schema = omnigraffle_export.OmniGraffleSchema(source)
+ schema.export_all(targetdir, format, True, lambda n: '%s:%s.pdf' % (nameprefix, n))
+
+ sys.exit(0)
+
+def main():
+ if len(sys.argv) not in [2,4]:
+ name = os.path.basename(sys.argv[0])
+ print >> sys.stderr, 'Usage: %s <path_to_omnigraffle_source>:<canvas_name>.<format>' % name
+ print >> sys.stderr, ' exports one canvas\n'
+ print >> sys.stderr, ' %s <path_to_omnigraffle_source> <output_directory> <format>' % name
+ print >> sys.stderr, ' exports all canvases to output_directory'
+ sys.exit(1)
+
+ if len(sys.argv) == 2:
+ export_one(sys.argv[1])
+ elif len(sys.argv) == 4:
+ export_all(*sys.argv[1:])
+
+
if __name__ == '__main__':
main()
Please sign in to comment.
Something went wrong with that request. Please try again.