asciidoctor / asciidoctor-doctest

:hammer: Test suite for Asciidoctor backends
MIT License
12 stars 16 forks source link

Support for XML #19

Open manuelprinz opened 5 years ago

manuelprinz commented 5 years ago

First, thanks a lot for this project! It helped me quite a bit with getting an Asciidoctor converter started!

I noticed a bug when using asciidoctor-doctest with a converter that produces XML: When converting using the HTML converter things are fine most of the time. But processing fails if certain tags are inserted, such as article. The reason seems to be that some tags (such as body) get injected. I think it might be due to the use of htmlbeautifier or something inside Nokogiri.

It would be nice to have a dedicated support for XML that also respects <?xml ?> tags and <!DOCTYPE> lines.

As a proof-of-concept I copied the HTML converter and spec and modified it so it deals with XML. I got it to work but the duplication is bothering me a lot. I think one way forward would be to extract the common code on the converter and use it as a base for the HTML converter that then could only contain the modifications that are specific to this converter. What do you think? Would you be willing to review a PR?