Mercurial > MadButterfly
annotate pyink/extensions.py @ 1404:ce981aa3fbf2
Translate pathes for xlink:href attriutes to relative pathes.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 04 Apr 2011 12:43:29 +0800 |
parents | 2d56ed5b0995 |
children |
rev | line source |
---|---|
1341
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
1 import pybExtension |
1393
2d56ed5b0995
Add exporter for export svg with bbox information.
Thinker K.F. Li <thinker@codemud.net>
parents:
1341
diff
changeset
|
2 import html5css3, mbbbox |
1341
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
3 |
1393
2d56ed5b0995
Add exporter for export svg with bbox information.
Thinker K.F. Li <thinker@codemud.net>
parents:
1341
diff
changeset
|
4 _all_extensions = [html5css3.extension, mbbbox.extension] |
1341
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
5 |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
6 _DEBUG_FLAG_NAME = 'PYINK_EXT_DBG_ENABLE' |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
7 |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
8 def _reg_extensions(): |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
9 import os |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
10 |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
11 if os.environ.has_key(_DEBUG_FLAG_NAME): |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
12 debug_level = int(os.environ[_DEBUG_FLAG_NAME]) |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
13 else: |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
14 debug_level = 0 |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
15 pass |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
16 |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
17 if debug_level > 0: |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
18 print 'Loading extensions' |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
19 pass |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
20 |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
21 for ext_imp, ext_id, ext_name, ioe_name, ioe_items in _all_extensions: |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
22 if debug_level > 0: |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
23 print ' register %s -- %s' % (ext_id, ext_name) |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
24 pass |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
25 |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
26 # |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
27 # ioe_items is description items for input, output, and effect. |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
28 # |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
29 if ioe_name not in ('input', 'output', 'effect'): |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
30 raise ValueError, 'invalid extension type (%s)' % (ioe_name) |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
31 |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
32 kws = {ioe_name: ioe_items} |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
33 pybExtension.register_extension(ext_imp, ext_id, ext_name, **kws) |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
34 pass |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
35 pass |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
36 |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
37 def initial(): |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
38 _reg_extensions() |
599b606c4669
Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
39 pass |