22 from pylatexenc.latex2text
import LatexNodes2Text
36 output.warn(
"Unknown tag: ", t)
39 output.warn(
"Unknown reference: ", ref, node.text)
44 nlines = str.split(
"\n")
45 if len(self.
lines) == 0:
48 self.
lines[-1] += nlines[0]
49 self.
lines += nlines[1:]
62 for line
in self.
lines:
63 if len(line.strip()) == 0:
68 for line
in reversed(self.
lines):
69 if len(line.strip()) == 0:
79 if detailled
is not None and len(detailled.getchildren()) > 0:
83 from sys
import version_info
87 if version_info[0] == 2:
93 assert isinstance(node.tag, str)
95 if tag
not in self.
tags:
106 self.
_write(node.text.strip().replace(
'"',
r"\""))
107 for c
in node.iterchildren():
110 self.
_write(c.tail.strip().replace(
'"',
r"\""))
118 self.
_write(node.attrib[
"kind"].title() +
": ")
123 self.
_write(node.text.replace(
'"',
r"\""))
124 for c
in node.iterchildren():
127 self.
_write(c.tail.replace(
'"',
r"\""))
131 refid = node.attrib[
"refid"]
132 if self.
index.hasref(refid):
137 assert len(node.getchildren()) == 0
141 self.
_write(node.attrib[
"kind"].title())
143 for item
in node.iterchildren(
"parameteritem"):
148 self.
_write(indent +
"- ")
150 assert len(node.getchildren()) == 2
151 namelist = node.find(
"parameternamelist")
152 desc = node.find(
"parameterdescription")
154 for name
in namelist.iterchildren(
"parametername"):
155 self.
_write(sep + name.text)
170 if self.
latex is None:
171 self.
_write(node.text.strip())