1 ##############################################################################
2 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
13 THIS = sys.modules[__name__]
16 dom = {"chapter", "section", "unit"}
17 element = {"title", "table", "figure", "paragraph", "plot", "chart", "space"}
21 setattr(THIS, _node, _node)
24 def tuple2text(sn, node, style):
25 assert sn in range(__id_max)
26 assert style in range(__style_max)
28 return "%02d##%s#%d" % (sn, node, style)
32 assert "sn" in info and info["sn"] in range(__id_max)
33 assert "style" in info and info["style"] in range(__style_max)
34 assert "node" in info and info["node"] in nodes
35 return "%02d##%s#%d" % (info["sn"], info["node"], info["style"])
39 tmp = candy.replace("##","#").split("#")
45 assert result["sn"] in range(__id_max)
46 assert result["style"] in range(__style_max)
47 assert result["node"] in nodes
51 def text2tuple(candy):
52 tmp = candy.replace("##","#").split("#")
58 assert sn in range(__id_max)
59 assert style in range(__style_max)
61 return sn, node, style