Skip to content

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

@LtdJorge

Description

@LtdJorge

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

table = do
tableStart
styles <- option [] $
parseAttrs <* skipMany spaceChar <* optional (char '|')
skipMany spaceChar
optional $ template >> skipMany spaceChar
optional blanklines
let tableWidth = case lookup "width" styles of
Just w -> fromMaybe 1.0 $ parseWidth w
Nothing -> 1.0
caption <- option mempty tableCaption
optional rowsep

Or in

tableCaption = try $ do
optional rowsep
guardColumnOne
skipSpaces
sym "|+"
optional (try $ parseAttrs *> skipSpaces *> char '|' *> blanklines)
trimInlines . mconcat <$>
many (notFollowedBy (void cellsep <|> rowsep) *> inline)

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions