Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list-table support for conversion ReST files #3432

Closed
lruzicka opened this issue Feb 10, 2017 · 4 comments
Closed

list-table support for conversion ReST files #3432

lruzicka opened this issue Feb 10, 2017 · 4 comments

Comments

@lruzicka
Copy link

list-table RST conversion problem

Problem description

I wanted to convert some .rst files and pandoc reported the following error:

pandoc: ignoring unknown directive: list-table "source" (line 351, column 1)

I went through the source file and realized that it does not recognize the list-table directive that is used by reSt to define a table.

How does that work.

The table designed by the list-table directive look like this:

.. list-table:: Frozen Delights!
   :widths: 15 10 30
   :header-rows: 1

   * - Treat
     - Quantity
     - Description
   * - Albatross
     - 2.99
     - On a stick!
   * - Crunchy Frog
     - 1.49
     - If we took the bones out, it wouldn't be
       crunchy, now would it?
   * - Gannet Ripple
     - 1.99
     - On a stick!

Where:

  • ..list-table:: is the beginning of the table data
  • Frozen Delights! is the title.
  • :widths: define how wide each column should be
  • :header-rows: defines the header row (makes it bold)
  • each * represents a new row
  • each - represents a column in that row

This would make the following output:

Treat Quantity Description
Albatross 2.99 On a stick!
Crunchy Frog 1.49 If we took the bones out, it wouldn't be,crunchy, now would it?
Gannet Ripple 1.99 On a stick!

Problem solution

It would be nice, if support for understanding tables in this format could be added. Thanks.

@jgm
Copy link
Owner

jgm commented Feb 10, 2017 via email

@jgm
Copy link
Owner

jgm commented Feb 11, 2017

Here's a test case for the bug mentioned above:

% pandoc -f rst
* - a
  - b
* - c
  - d
^D
<ul>
<li><ul>
<li>a</li>
</ul>
- b</li>
<li><ul>
<li>c</li>
<li>d</li>
</ul></li>
</ul>

jgm added a commit that referenced this issue Feb 11, 2017
See #3432.  Previously the parser didn't handle properly this
case:

    * - a
      - b
    * - c
      - d
@gingerhot
Copy link

gingerhot commented Mar 19, 2017

hi, when I try to convert a ghc user guide file:

https://github.com/bgamari/ghc-users-guide/blob/master/content/using-warnings.rst

and I have similar error messages:

[pandoc warning] ignoring unknown role :ghc-flag: in "source" (line 1057, column 63)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 1057, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 1047, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 1041, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 1035, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 1029, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 1006, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 993, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 971, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 950, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 932, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 921, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 901, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 889, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 859, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 846, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 825, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 821, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 809, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 793, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 786, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 764, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 746, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 724, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 707, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 694, column 1)
[pandoc warning] ignoring unknown directive: ghc-flag "source" (line 684, column 1)

...

I use a pandoc version 1.19.2.1 in a Ubuntu 16.04 64bit EC2 node.

Thanks a lot.

@jgm jgm added this to the pandoc 2.0 milestone Mar 19, 2017
@jgm
Copy link
Owner

jgm commented Mar 19, 2017

@gingerhot the problem here is that your document uses some custom rst directives (hlist, ghc-option). pandoc has no way of knowing what these mean. (rst2html.py will also choke on them, unless special python definitions of the custom directives are given.)

One possible change would be to have pandoc emit the block-level contents of any unknown directive. So, in the list-table case above, pandoc would at least emit the list, and similarly with your hlist. (However, in this case the ghc-option itself would still be omitted.)

jgm added a commit that referenced this issue Mar 19, 2017
In most cases it's better to preserve the content than
to emit it.  This isn't guaranteed to have good results;
it will fail spectacularly for unknown raw or verbatim
directives.

See #3432.
jgm added a commit that referenced this issue Mar 21, 2017
In most cases it's better to preserve the content than
to emit it.  This isn't guaranteed to have good results;
it will fail spectacularly for unknown raw or verbatim
directives.

See #3432.
k16shikano added a commit to k16shikano/pandoc that referenced this issue May 23, 2017
@jgm jgm closed this as completed in c0c54b7 May 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants