Skip to content

moinmoin and textile formats: literal pipes in cells silently split columns #501

Open

Description

@rahul05ranjan

What breaks

tablefmt="moinmoin" and tablefmt="textile" write cell and header values raw, so a literal pipe in the content silently splits the cell — the same class as the mediawiki problem in #499, but with these two formats' own separators:

>>> import tabulate
>>> print(tabulate.tabulate([["x | y", "a || b"]], tablefmt="moinmoin"))
||<style="text-align: left;">  x | y    ||<style="text-align: left;">  a || b  ||

|| is the cell separator in MoinMoin tables, so a || b becomes three cells and the style attribute of the second one ends up on a phantom cell. In textile, | is the separator, so x | y splits in two. Rendered on a real MoinMoin wiki or through a textile converter, the data is silently corrupted.

Fix direction

Escape | as &#124; in the cell and header values of both formats — MoinMoin and Textile both pass numeric character references through and render them as the literal character — the same approach the mediawiki fix (#500) uses.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions