From 29358a7bd0ea99f6404563ae7b4f3ce4d99cc794 Mon Sep 17 00:00:00 2001 From: Kesara Rathnayake Date: Tue, 9 Jul 2024 20:17:10 +1200 Subject: [PATCH] fix: Render ol items correctly Fixes #1135 --- xml2rfc/writers/text.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xml2rfc/writers/text.py b/xml2rfc/writers/text.py index 94a3b7fb..9e9aeb64 100644 --- a/xml2rfc/writers/text.py +++ b/xml2rfc/writers/text.py @@ -2152,7 +2152,11 @@ def render_li(self, e, width, **kwargs): tt, __ = self.text_or_block_renderer(e, width, **kwargs) if isinstance(tt, list): lines = stripl(tt) - if lines and lines[0].elem.tag not in ['artwork', 'figure', 'sourcecode', 'li', ]: + if ( + lines + and lines[0].elem.tag not in ["artwork", "figure", "sourcecode"] + and not (p.tag == "ul" and lines[0].elem.tag == "li") + ): lines[0].text = text + lines[0].text.lstrip(stripspace) else: text += tt.lstrip(stripspace)