diff --git a/tests/valid/draft-miek-test.pages.text b/tests/valid/draft-miek-test.pages.text index 75904750..7b0cd1de 100644 --- a/tests/valid/draft-miek-test.pages.text +++ b/tests/valid/draft-miek-test.pages.text @@ -1102,8 +1102,8 @@ A.10. Figure tests This is a figure This is a figure - Figure 4: This is the caption, with text in `typewriter`. Which - isnt converted to a style, because this is copied as-is. + Figure 4: This is the caption, with text in `typewriter`. Which isnt + converted to a style, because this is copied as-is. And how a figure that is not centered, do to using figure and not Figure. diff --git a/tests/valid/draft-miek-test.text b/tests/valid/draft-miek-test.text index efda0e63..b9408666 100644 --- a/tests/valid/draft-miek-test.text +++ b/tests/valid/draft-miek-test.text @@ -930,8 +930,8 @@ A.10. Figure tests This is a figure This is a figure - Figure 4: This is the caption, with text in `typewriter`. Which - isnt converted to a style, because this is copied as-is. + Figure 4: This is the caption, with text in `typewriter`. Which isnt + converted to a style, because this is copied as-is. And how a figure that is not centered, do to using figure and not Figure. diff --git a/tests/valid/draft-miek-test.txt b/tests/valid/draft-miek-test.txt index 5e5d7520..8fe49969 100644 --- a/tests/valid/draft-miek-test.txt +++ b/tests/valid/draft-miek-test.txt @@ -1102,8 +1102,8 @@ A.10. Figure tests This is a figure This is a figure - Figure 4: This is the caption, with text in `typewriter`. Which - isnt converted to a style, because this is copied as-is. + Figure 4: This is the caption, with text in `typewriter`. Which isnt + converted to a style, because this is copied as-is. And how a figure that is not centered, do to using figure and not Figure. diff --git a/xml2rfc/writers/text.py b/xml2rfc/writers/text.py index 671a33e6..eeba38a8 100644 --- a/xml2rfc/writers/text.py +++ b/xml2rfc/writers/text.py @@ -1736,11 +1736,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)