jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.78k stars 3.39k forks source link

mediawiki reader fails on tables when the line following a table caption starts with spaces #10390

Closed LtdJorge closed 3 days ago

LtdJorge commented 6 days ago

Explain the problem.

A minimal example that works:

 {| class="wikitable"
 |+ Overview of basic table markup
! Key
 |-
 | Value
 |}

Same minimal example that doesn't work:

 {| class="wikitable"
 |+ Overview of basic table markup
 ! Key
 |-
 | Value
 |}

Notice how every line starts with a space. The amount of spaces is irrelevant, as long as it's more than 0. If you take the caption out, it works again:

 {| class="wikitable"
 ! Key
 |-
 | Value
 |}

I guess the issue is in https://github.com/jgm/pandoc/blob/1e917dd1fc16a067267db3343db999bf99a4b5af/src/Text/Pandoc/Readers/MediaWiki.hs#L201-L212

Or in https://github.com/jgm/pandoc/blob/1e917dd1fc16a067267db3343db999bf99a4b5af/src/Text/Pandoc/Readers/MediaWiki.hs#L284-L291

rowsep looks good to me, but I don't know anything about Haskell.

Pandoc version? This happens on "Try pandoc!" as well as on my local installation. My local pandoc, on Gentoo Linux is:

pandoc 2.18
Compiled with pandoc-types 1.22.2, texmath 0.12.5.1, skylighting 0.12.3.1,
citeproc 0.7, ipynb 0.2, hslua 2.2.0
Scripting engine: Lua 5.4
User data directory: /home/jorge/.local/share/pandoc
Copyright (C) 2006-2022 John MacFarlane. Web:  https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.