Skip to content

Commit

Permalink
fix: Include figure prefix in name before rendering text
Browse files Browse the repository at this point in the history
  • Loading branch information
kesara committed Aug 31, 2023
1 parent 0704155 commit fc90be2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions xml2rfc/writers/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -1737,11 +1737,20 @@ def render_figure(self, e, width, **kwargs):
pn = e.get('pn')
num = pn.split('-')[1].capitalize()
children = e.getchildren()
title = "Figure %s" % (num, )
title = "Figure {}".format(num)
if len(children) and children[0].tag == 'name':
name = children[0]
if name.text:
name.text = "{prefix}{joiner} {text}".format(
prefix=title,
joiner=kwargs["joiners"]["name"].join,
text=name.text)
else:
name.text = "{prefix}{joiner} ".format(
prefix=title,
joiner=kwargs["joiners"]["name"].join)
children = children[1:]
title = self.tjoin(title, name, width, **kwargs)
title = self.render(name, width, **kwargs)
lines = []
for c in children:
lines = self.ljoin(lines, c, width, **kwargs)
Expand Down

0 comments on commit fc90be2

Please sign in to comment.