ietf-tools / xml2rfc

Generate RFCs and IETF drafts from document source in XML according to the IETF xml2rfc v2 and v3 vocabularies
https://ietf-tools.github.io/xml2rfc/
BSD 3-Clause "New" or "Revised" License
69 stars 39 forks source link

xml file that renders fine in HTML and PDF but gets error for text rendering #1022

Closed d3e3e3 closed 1 year ago

d3e3e3 commented 1 year ago

Describe the issue

So, I have this xml v3 source file that seem to produce good HTML and PDF using the xml2rfc "IETF Author Tools" web interface. But if I ask for text output, I get the error "xml2rfc error: list index out of range". See attached: Sexp03-02.xml.zip

Code of Conduct

kesara commented 1 year ago

This is an xml2rfc text generation error.

   Completed preptool run
Traceback (most recent call last):
  File "/Users/kesara/lab/ietf-at/venv/bin/xml2rfc", line 8, in <module>
    sys.exit(main())
  File "/Users/kesara/lab/ietf-at/venv/lib/python3.8/site-packages/xml2rfc/run.py", line 730, in main
    writer.write(filename)
  File "/Users/kesara/lab/ietf-at/venv/lib/python3.8/site-packages/xml2rfc/writers/text.py", line 344, in write
    text = self.process()
  File "/Users/kesara/lab/ietf-at/venv/lib/python3.8/site-packages/xml2rfc/writers/text.py", line 302, in process
    lines = self.render(self.root, width=72, joiners=joiners)
  File "/Users/kesara/lab/ietf-at/venv/lib/python3.8/site-packages/xml2rfc/writers/text.py", line 368, in render
    res = func(e, width, **kwargs)
  File "/Users/kesara/lab/ietf-at/venv/lib/python3.8/site-packages/xml2rfc/writers/text.py", line 3053, in render_rfc
    lines = self.ljoin(lines, c, width, **kwargs)
  File "/Users/kesara/lab/ietf-at/venv/lib/python3.8/site-packages/xml2rfc/writers/text.py", line 557, in ljoin
    res = mklines(self.render(e, width, **kwargs), e)
  File "/Users/kesara/lab/ietf-at/venv/lib/python3.8/site-packages/xml2rfc/writers/text.py", line 368, in render
    res = func(e, width, **kwargs)
  File "/Users/kesara/lab/ietf-at/venv/lib/python3.8/site-packages/xml2rfc/writers/text.py", line 2231, in render_middle
    lines = self.ljoin(lines, c, width, **kwargs)
  File "/Users/kesara/lab/ietf-at/venv/lib/python3.8/site-packages/xml2rfc/writers/text.py", line 557, in ljoin
    res = mklines(self.render(e, width, **kwargs), e)
  File "/Users/kesara/lab/ietf-at/venv/lib/python3.8/site-packages/xml2rfc/writers/text.py", line 368, in render
    res = func(e, width, **kwargs)
  File "/Users/kesara/lab/ietf-at/venv/lib/python3.8/site-packages/xml2rfc/writers/text.py", line 3324, in render_section
    lines = self.ljoin(lines, c, width, **kwargs)
  File "/Users/kesara/lab/ietf-at/venv/lib/python3.8/site-packages/xml2rfc/writers/text.py", line 557, in ljoin
    res = mklines(self.render(e, width, **kwargs), e)
  File "/Users/kesara/lab/ietf-at/venv/lib/python3.8/site-packages/xml2rfc/writers/text.py", line 368, in render
    res = func(e, width, **kwargs)
  File "/Users/kesara/lab/ietf-at/venv/lib/python3.8/site-packages/xml2rfc/writers/text.py", line 1514, in render_dl
    and (width - len('  ') - len(text)) < len(c.text.split(None, 1)[0]))
IndexError: list index out of range
kesara commented 1 year ago

The reason for the error is <dd>&nbsp;</dd>. xml2rfc text generator is not happy that.

d3e3e3 commented 1 year ago

Hi Kesara,

On Sun, Aug 20, 2023 at 10:21 PM Kesara Rathnayake @.***> wrote:

The reason for the error is

 
. xml2rfc text generator is not happy that.

I am not surprised. I changed the draft to eliminate that and the problem went away. Still, it seems like a bug as I don't see anything inherently wrong with the problematic XML.
Thanks, Donald =============================== Donald E. Eastlake 3rd +1-508-333-2270 (cell) 2386 Panoramic Circle, Apopka, FL 32703 USA ***@***.*** > — > Reply to this email directly, view it on GitHub > , > or unsubscribe > > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> >
cabo commented 1 year ago

kramdown-rfc uses <dd><t/></dd> to insert the empty definitions required by the, er, suboptimal grammar.