metanorma / asciidoctor-rfc

AsciiRFC: an AsciiDoc/asciidoctor backend to produce RFC XML v3 (RFC 7991) and v2 (RFC 7749)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

<texttable> table implementation broken in V2

ronaldtse opened this issue · comments

In https://github.com/riboseinc/rfc-crypto-sm4 , run make clean all and you will see (please ignore the missing references for now) this error with the <texttable> element:

...
V2 RELAXNG Validation: 999:0: ERROR: Did not expect element c there
V2 RELAXNG Validation: 999:0: ERROR: Element texttable has extra content: c
xml2rfc --text draft-ribose-cfrg-sm4.xml draft-ribose-cfrg-sm4.txt
Parsing file draft-ribose-cfrg-sm4.xml
ERROR: Unable to validate the XML document: draft-ribose-cfrg-sm4.xml
 <string>: Line 998: Element texttable content does not follow the DTD, expecting (preamble? , ttcol+ , c* , postamble?), got (c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c)
...

It looks like we're not giving ttcol?

FYI the table is like this:

[cols="6*"]
|===

| Method
| Rounds
3+| Complexity
| Reference

|
|
| Time
| Data
| Memory
|

| Differential
| 23
| $$2^126.7$$
| $$2^117$$
| $$2^120.7$$
| <<SM4-DiffSu>>

| Matrix
| 18
| $$2^110.77$$
| $$2^127$$
| $$2^130$$
| <<SM4-MatrixShe>>

|===

( middle content omitted )

Your table may be malformed, but even if it is, you've come up with an instance I should be dealing with.

There is a blank line between the |=== and the first row of data. Asciidoc interprets that as meaning there is no header row for the table: it starts with normal table cells. But in RFC XML v2, the header row of a table is mandatory, and I should be issuing a warning for that. (I don't want to blanket-assume that the first row of a table is always a header row, no matter the spacing; that markup might be intentional.)

The table will still result in incorrect RFC XML; but at least you'll know why. :-)