# HG changeset patch # User Thinker K.F. Li # Date 1297086843 -28800 # Node ID 599b606c4669eb8cc24ee22fc8216d3537a915e3 # Parent 10d5f06f75665d185172476a56eb6ad688f59d5a Start to implement HTML5/CSS3 exporter diff -r 10d5f06f7566 -r 599b606c4669 pyink/extensions.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pyink/extensions.py Mon Feb 07 21:54:03 2011 +0800 @@ -0,0 +1,39 @@ +import pybExtension +import html5css3 + +_all_extensions = [html5css3.extension] + +_DEBUG_FLAG_NAME = 'PYINK_EXT_DBG_ENABLE' + +def _reg_extensions(): + import os + + if os.environ.has_key(_DEBUG_FLAG_NAME): + debug_level = int(os.environ[_DEBUG_FLAG_NAME]) + else: + debug_level = 0 + pass + + if debug_level > 0: + print 'Loading extensions' + pass + + for ext_imp, ext_id, ext_name, ioe_name, ioe_items in _all_extensions: + if debug_level > 0: + print ' register %s -- %s' % (ext_id, ext_name) + pass + + # + # ioe_items is description items for input, output, and effect. + # + if ioe_name not in ('input', 'output', 'effect'): + raise ValueError, 'invalid extension type (%s)' % (ioe_name) + + kws = {ioe_name: ioe_items} + pybExtension.register_extension(ext_imp, ext_id, ext_name, **kws) + pass + pass + +def initial(): + _reg_extensions() + pass diff -r 10d5f06f7566 -r 599b606c4669 pyink/html5css3.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pyink/html5css3.py Mon Feb 07 21:54:03 2011 +0800 @@ -0,0 +1,15 @@ +import pybExtension + +class html5css3_ext(pybExtension.PYBindExtImp): + def save(self, module, doc, filename): + print 'save to ' + filename + pass + pass + +extension = (html5css3_ext(), + 'net.scribboo.html5css3', + 'HTML5/CSS3 exporter', + 'output', + {'extension': '.html', + 'mimetype': 'text/html', + '_filetypename': 'HTML5/CSS3 (*.html)'}) diff -r 10d5f06f7566 -r 599b606c4669 pyink/pyink.py --- a/pyink/pyink.py Sun Feb 06 23:12:48 2011 +0800 +++ b/pyink/pyink.py Mon Feb 07 21:54:03 2011 +0800 @@ -47,7 +47,10 @@ def pyink_start(): + import extensions + pybInkscape.inkscape.connect('activate_desktop', act_desktop) + extensions.initial() pass