New markdown to asciidoc tests
I've written a script (not included) and transformed the tests from https://github.com/bodiam/markdown-to-asciidoc/tree/master/src/test/resources/nl/jworks/markdown_to_asciidoc to our test format.
There are also another two files in that repo we could look at named testsuite.[adoc|md]: https://github.com/bodiam/markdown-to-asciidoc/tree/master/src/test/resources
To execute only the new tests:
stack test --test-arguments='-p markdown-to-asciidoc'
After fixing quite a few tests manually (insignificant changes like word-wrapping), we are at:
23 out of 61 tests failed (2.45s)
Those are somewhat interesting cases where I'm not sure whether pandoc is wrong or the test is wrong.
Also a few places where it should be possible to improve pandoc to output nicer asciidoc. I'll see whether I get to that as well...
Hm.. asciidoc lists are interesting...
btw. what's the difference between OrderedList (1,Decimal,Period) and OrderedList (1,DefaultStyle,DefaultDelim) in the AST?
what's the difference between OrderedList (1,Decimal,Period) and OrderedList (1,DefaultStyle,DefaultDelim) in the AST?
Decimal says "I definitely want a decimal list number." DefaultStyle says "use whatever is the default for this list level in this output format" (e.g. in LaTeX, just give me an unadorned \begin{enumerate}). Similarly for Period vs DefaultDelim.
About the heading levels... I think I let myself be confused by #5615 (which seems more about how we should handle heading levels in the markdown input).
From asciidoctor docs:
= Document Title (Level 0) == Level 1 Section Title === Level 2 Section TitleWhen using the article doctype (the default), you can only have one level-0 section title (i.e., the document title) and it must be in the document header.
@cagix I guess you were right and I assume that's how it's always worked in asciidoc (not just asciidoctor) and these test by @bodiam are just not correct? The correct equivalences would be:
- HTML:
<h1>foo</h1> - Markdown:
# foo - AsciiDoc:
== foo
@mb21 following the discussion in #5615, it seems to me, that the new --shift-heading-level-by option should be included in the above tests somehow. if i'm not mistaken, without this option pandoc should translate # header 1 to = header 1 (missing the asciidoc semantics, but seems to me to be the expected behaviour). using --shift-heading-level-by=-1 in the tests would establish the asciidoc semantics ...
@cagix yes, --shift-heading-level-by=-1 would certainly make the tests pass... but from if == foo is a level 1 header in asciidoc, then the tests are just wrong. correct?
Pandoc renders level-1 headers into asciidoc as ==.
No heading shift is required for that.
then all tests regarding headings are currently wrong and this is the intended behaviour:
$ pandoc -t asciidoc
# Level 1
## Level 2
### Level 3
^D
== Level 1
=== Level 2
==== Level 3
and
$ pandoc -t asciidoc --shift-heading-level-by=-1
# Level 1
## Level 2
### Level 3
^D
= Level 1
== Level 2
=== Level 3
?
I would like to contribute to this code