jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.39k stars 3.37k forks source link

docx writer: documents with lists fail to validate #9265

Closed jgm closed 10 months ago

jgm commented 10 months ago

These documents in test/docx/golden fail to validate with docx-validator: @edwintorok

lists.docx

./tmp/document-pretty.xml:129: element pStyle: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}pStyle': This element is not expected. Expected is one of ( {http://schemas.openxmlformats.org/wordprocessingml/2006/main}suppressLineNumbers, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}pBdr, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}shd, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tabs, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}suppressAutoHyphens, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}kinsoku, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}wordWrap, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}overflowPunct, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}topLinePunct, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}autoSpaceDE ).

lists_div_bullets.docx

./tmp/document-pretty.xml:33: element pStyle: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}pStyle': This element is not expected. Expected is one of ( {http://schemas.openxmlformats.org/wordprocessingml/2006/main}suppressLineNumbers, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}pBdr, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}shd, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tabs, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}suppressAutoHyphens, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}kinsoku, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}wordWrap, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}overflowPunct, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}topLinePunct, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}autoSpaceDE ).
./tmp/document-pretty.xml:45: element pStyle: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}pStyle': This element is not expected. Expected is one of ( {http://schemas.openxmlformats.org/wordprocessingml/2006/main}suppressLineNumbers, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}pBdr, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}shd, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tabs, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}suppressAutoHyphens, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}kinsoku, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}wordWrap, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}overflowPunct, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}topLinePunct, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}autoSpaceDE ).

lists_multiple_initial.docx

./tmp/document-pretty.xml:10: element pStyle: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}pStyle': This element is not expected. Expected is one of ( {http://schemas.openxmlformats.org/wordprocessingml/2006/main}suppressLineNumbers, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}pBdr, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}shd, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tabs, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}suppressAutoHyphens, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}kinsoku, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}wordWrap, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}overflowPunct, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}topLinePunct, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}autoSpaceDE ).
./tmp/document-pretty.xml:41: element pStyle: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}pStyle': This element is not expected. Expected is one of ( {http://schemas.openxmlformats.org/wordprocessingml/2006/main}suppressLineNumbers, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}pBdr, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}shd, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tabs, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}suppressAutoHyphens, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}kinsoku, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}wordWrap, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}overflowPunct, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}topLinePunct, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}autoSpaceDE ).
jgm commented 10 months ago

Looks like w:pStyle has to come before w:numPr? https://github.com/devoidfury/docx-validator/blob/main/schemas/ISO-IEC29500-4_2016/wml.xsd#L1090

edwintorok commented 10 months ago

Yes, looks like pStyle needs to be first. Looks like the xmllint error shows all the valid tags (up to a limit?) you can have in that position