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