metanorma / asciidoctor-rfc

AsciiRFC: an AsciiDoc/asciidoctor backend to produce RFC XML v3 (RFC 7991) and v2 (RFC 7749)
BSD 2-Clause "Simplified" License
15 stars 7 forks source link

Line numbers / file path missing in WARNING messages #82

Closed ronaldtse closed 6 years ago

ronaldtse commented 6 years ago

When running the RFCv2 backend, sometimes there are messages from lines like this:

warn "asciidoctor: WARNING (#{node.lineno}): header row of table is longer than 72 ascii characters" if rowlength > 72

However, #{node.lineno} is empty, so it is unclear which file / line the error is at. It seems that the node doesn't have lineno and path set when it was parsed by the Reader.

Any thoughts @opoudjis ?

opoudjis commented 6 years ago

Hm. Not all instances of node have lineno defined on them, it seems. Let me see if I can replicate this.

opoudjis commented 6 years ago

I can replicate it, and indeed, while all blocks have a lineno method, if their source_location attribute is not set, neither is their line number. (And I can't tell why a table's source_location attribute wouldn't be set in this case.)

As a mitigation, I'm going to give the current section title instead for all such warnings, wherever the line number is not available.

opoudjis commented 6 years ago

Done: Line number if available, else anchor of node, else current section title, else "??".