metanorma/metanorma-ietf

Warnings and errors in documentation generation

Closed this issue · 3 comments

We need to fix the crashing error below.

$ bundle exec metanorma site generate
[info]: Compiling /Users/me/src/mn/mn-samples-ietf/sources/antioch/document.adoc ...
...
Bibliography: (XML Line 000636): Reference grail_film is missing a document identifier (docid)
...
Metanorma XML Syntax: (XML Line 000103:88): attribute "obligation" not allowed here; expected attribute "language", "numbered", "removeInRFC", "script" or "toc"
Metanorma XML Syntax: (XML Line 000620:26): element "bibitem" not allowed here; expected the element end-tag or element "clause", "definitions" or "terms"
Metanorma XML Syntax: (XML Line 000682:33): element "passthrough" not allowed here; expected the element end-tag or element "bibitem", "note" or "references"
Metanorma XML Syntax: (XML Line 000682:33): found attribute "formats", but no attributes allowed here
Metanorma XML Syntax: (XML Line 000125:36): IDREF "RFC7990" without matching ID
...
 Created file /Users/me/src/mn/mn-samples-ietf/site/documents/antioch/document.txt
 Created file /Users/me/src/mn/mn-samples-ietf/site/documents/antioch/document.html
[info]: Compiling /Users/me/src/mn/mn-samples-ietf/sources/example/document.adoc ...
...
Document Attributes: IETF: unrecognised working group Network Working Group
Metanorma XML Syntax: (XML Line 000308:12): element "workgroup" not allowed here; expected the element end-tag or element "committee"
Metanorma XML Syntax: (XML Line 000318:88): attribute "obligation" not allowed here; expected attribute "language", "numbered", "removeInRFC", "script" or "toc"
/Users/me/src/mn/mn-samples-ietf/site/documents/example/document.rfc.xml(170): Warning: Removed a redundant ascii= attribute from <organization>
/Users/me/src/mn/mn-samples-ietf/site/documents/example/document.rfc.xml(173): Warning: Removed a redundant ascii= attribute from <organization>
/Users/me/src/mn/mn-samples-ietf/site/documents/example/document.rfc.xml(8): Warning: Expected a <link> with rel="prev" providing the datatracker url for the origin draft, or alternatively a "docName" attribute on <rfc> from which to construct such a <link> element.
 Created file /Users/me/src/mn/mn-samples-ietf/site/documents/example/document.txt
/Users/me/src/mn/mn-samples-ietf/site/documents/example/document.rfc.xml(170): Warning: Removed a redundant ascii= attribute from <organization>
/Users/me/src/mn/mn-samples-ietf/site/documents/example/document.rfc.xml(173): Warning: Removed a redundant ascii= attribute from <organization>
/Users/me/src/mn/mn-samples-ietf/site/documents/example/document.rfc.xml(8): Warning: Expected a <link> with rel="prev" providing the datatracker url for the origin draft, or alternatively a "docName" attribute on <rfc> from which to construct such a <link> element.
Traceback (most recent call last):
  File "/usr/local/bin/xml2rfc", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/xml2rfc/run.py", line 754, in main
    writer.write(filename)
  File "/usr/local/lib/python3.9/site-packages/xml2rfc/writers/html.py", line 266, in write
    html_tree = self.html_tree()
  File "/usr/local/lib/python3.9/site-packages/xml2rfc/writers/html.py", line 244, in html_tree
    html_tree = self.render(None, self.root)
  File "/usr/local/lib/python3.9/site-packages/xml2rfc/writers/html.py", line 321, in render
    res = func(h, x)
  File "/usr/local/lib/python3.9/site-packages/xml2rfc/writers/html.py", line 664, in render_rfc
    self.render(body, c)
  File "/usr/local/lib/python3.9/site-packages/xml2rfc/writers/html.py", line 321, in render
    res = func(h, x)
  File "/usr/local/lib/python3.9/site-packages/xml2rfc/writers/html.py", line 335, in skip_renderer
    self.render(h, c)
  File "/usr/local/lib/python3.9/site-packages/xml2rfc/writers/html.py", line 321, in render
    res = func(h, x)
  File "/usr/local/lib/python3.9/site-packages/xml2rfc/writers/html.py", line 2235, in render_references
    self.render(hh, c)
  File "/usr/local/lib/python3.9/site-packages/xml2rfc/writers/html.py", line 321, in render
    res = func(h, x)
  File "/usr/local/lib/python3.9/site-packages/xml2rfc/writers/html.py", line 2136, in render_reference
    self.render(inner, c)
  File "/usr/local/lib/python3.9/site-packages/xml2rfc/writers/html.py", line 321, in render
    res = func(h, x)
  File "/usr/local/lib/python3.9/site-packages/xml2rfc/writers/html.py", line 1162, in render_author
    if after_next.tag != 'author':
AttributeError: 'NoneType' object has no attribute 'tag'
[info]: Building collection file: /Users/me/src/mn/mn-samples-ietf/site/documents.xml ...
[relaton-bib] Series type is invalid: stream
[relaton-bib] Series type is invalid: intended
[relaton-bib] Series type is invalid: stream
[relaton-bib] Series type is invalid: intended
[info]: Generating html site in /Users/me/src/mn/mn-samples-ietf/site ...
[relaton-bib] Series type is invalid: stream
[relaton-bib] Series type is invalid: intended
[relaton-bib] Series type is invalid: stream
[relaton-bib] Series type is invalid: intended

Cannot reproduce with xml2rfc 3.5.0. Is happening with xml2rfc 3.7.0, which means the IETF in their wisdom have broken RFC XML that used to be valid.

Bug in xml2rfc 3.7.0, xml2rfc/writers/html.py:

if next is not None and next.tag == 'author':
                after_next = next.getnext()
                if after_next.tag != 'author':
                    after_next = None

should read:

if next is not None and next.tag == 'author':
                after_next = next.getnext()
                if after_next is not None and after_next.tag != 'author':
                    after_next = None