Enhance EPUB writer to support multiple EPUB versions and improve HTML format detection.#11628
Conversation
…L format detection. Added checks for EPUB format variants and updated transformation functions to accommodate versioning. Introduced tests for raw EPUB attributes rendering.
| % pandoc -f native -t epub --metadata title=Raw -o - | pandoc -f epub -t html | ||
| [ RawBlock (Format "epub") "<p>ok</p>" ] | ||
| ^D | ||
| <p><span id="title_page.xhtml"></span></p> | ||
| <p><span id="ch001.xhtml"></span></p> | ||
| <section id="ch001.xhtml_raw" class="unnumbered level1"> | ||
| <h1 class="unnumbered">Raw</h1> | ||
| <p>ok</p> | ||
| </section> | ||
| ``` |
There was a problem hiding this comment.
I don't think this test adds anything to the yreceding one. They both test the same thing on the writer side. Maybe just use this one (which doesn't also test the markdown reader) and omit the first one?
However, it would be good to ADD a test that shows that content marked epub2 is omitted for epub3 output (for example).
There was a problem hiding this comment.
Addressed in 329ad27
I removed the redundant first positive test and kept the native -> epub writer-side check, and added a negative case showing that content marked epub2 is omitted from epub3 output, while keeping epub3 case.
| Raw EPUB2 attributes are omitted from EPUB3 output. | ||
|
|
||
| ``` | ||
| % pandoc -f markdown -t epub3 --metadata title=Raw -o - | pandoc -f epub -t html | grep ok |
There was a problem hiding this comment.
The | grep ok is not needed; just make sure the output is right. We don't want to assume that grep is installed.
|
thanks! |
This change ensures that raw content marked `epub2` will appear in (only) EPUBv2 output and content marked `epub3` will appear in (only) EPUBv3 output.
Added checks for EPUB format variants and updated transformation functions to accommodate versioning. Introduced tests for raw EPUB attributes rendering.