beta-0.89.2
[luatex.git] / source / libs / zziplib / zziplib-0.13.62 / docs / zzipdoc / dbk2htm.py
blobf8593e697b05c593863eb3c7782038e5c13e8217
1 from match import Match
2 import string
4 class dbk2htm_conversion:
5 mapping = { "<screen>" : "<pre>", "</screen>" : "</pre>",
6 "<para>" : "<p>", "</para>" : "</p>" ,
7 "<function>" : "<link>", "</function>" : "</link>" }
8 def __init__(self):
9 pass
10 def section2html(self, text):
11 for str in self.mapping:
12 text = string.replace(text, str, self.mapping[str])
13 return text
14 def paramdef2html(self, text):
15 s = Match()
16 txt = text & s(r"\s+<paramdef>") >> r"\n<nobr>"
17 txt &= s(r"<paramdef>") >> r"<nobr>"
18 txt &= s(r"</paramdef>") >> r"</nobr>"
19 txt &= s(r"<parameters>") >> r"\n <code>"
20 txt &= s(r"</parameters>") >> r"</code>\n"
21 return txt
23 def section2html(text):
24 return dbk2htm_conversion().section2html(text)
25 def paramdef2html(text):
26 return dbk2htm_conversion().paramdef2html(text)