Handle <ndash> and <mdash> tags in the docs xml

This commit is contained in:
Robin Dunn
2019-10-30 18:19:25 -07:00
parent 0d9670c9bf
commit 8614e1ae09

View File

@@ -1915,6 +1915,27 @@ class ULink(Node):
return text
# ----------------------------------------------------------------------- #
class DashBase(Node):
dash_text = '-'
def Join(self, with_tail=True):
text = self.dash_text
if self.element.text:
text += self.element.text
if with_tail and self.element.tail:
text += convertToPython(self.element.tail)
return text
class EnDash(DashBase):
dash_text = u'\u2013'
class EmDash(DashBase):
dash_text = u'\u2014'
# ----------------------------------------------------------------------- #
class XMLDocString(object):
@@ -2217,6 +2238,11 @@ class XMLDocString(object):
self.root.AddSection(section)
rest_class = parent
elif tag == 'ndash':
rest_class = EnDash(element, parent)
elif tag == 'mdash':
rest_class = EmDash(element, parent)
else:
rest_class = Node('', parent)