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

Feature Request: RST input #69

Open
tomduck opened this issue Jun 25, 2019 · 5 comments
Open

Feature Request: RST input #69

tomduck opened this issue Jun 25, 2019 · 5 comments

Comments

@tomduck
Copy link
Owner

tomduck commented Jun 25, 2019

I am very interested in what pandoc-fignos does, but work with RST. It would be great if fignos handled rst input as well.

Originally posted by @ociule in #34 (comment)

@ociule
Copy link

ociule commented Jun 25, 2019

Thanks for the attention you're giving to this @tomduck

Just so you do not duplicate some analysis work I've done, here's my take on what needs to be patched in pandoc for this to become possible: jgm/pandoc#5619

@tomduck
Copy link
Owner Author

tomduck commented Jun 25, 2019

Thanks, @ociule. Note that the markdown cross-referencing spec was designed by @scaramouche1 in this post. Something similar would be needed for rst.

I don't expect to get to this soon, but want to keep tabs on the idea for future reference. There is a new 2.0.0 branch I am finalizing at the moment.

@tomduck tomduck changed the title RST input Feature Request: RST input Jun 25, 2019
@ociule
Copy link

ociule commented Jun 25, 2019

I'm very happy to report that rst support already works in pandoc-tablenos.

One just has to use the same trick md tables use, adding an id like `{#tbl:a} to the table caption.

Here's a working example rst example:

.. table:: Demonstration of a simple table. {#tbl:a}
   :widths: auto

   =====  =====
     A    not A
   =====  =====
   False  True
   True   False
   =====  =====

As reported in jgm/pandoc#5619 this is transformed in the following native code:

[Table [Str "Table:",Space,Str "Demonstration",Space,Str "of",Space,Str "a",Space,Str "simple",Space,Str "table.",Space,Str "{#tbl:a}"] [AlignDefault,AlignDefault] [0.0,0.0]
 [[Plain [Str "A"]]
 ,[Plain [Str "not",Space,Str "A"]]]
 [[[Plain [Str "False"]]
  ,[Plain [Str "True"]]]
 ,[[Plain [Str "True"]]
  ,[Plain [Str "False"]]]]]

Even if the {#tbl:a} bit was never parsed by pandoc, it is parsed by pandoc-tablenos (possibly py pandocfilters) so this works out of the box. I think documenting this would be valuable.

Edit: this works for numbering the tables, not for referencing them. Can't find a way to get a Citation element out of pandoc with rst input.

@tomduck
Copy link
Owner Author

tomduck commented Jun 25, 2019

That is good to hear. Maybe it won't be a difficult as I first thought.

@ociule
Copy link

ociule commented Jun 25, 2019

The same trick does not work in fignos. The rst fragment:

.. figure:: img1.jpg
  :name: The number one. {#fig:1}
  :width: 1in

  The number one. {#fig:1}

The name option is ignored by pandoc.Readers.RST anyway.

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

2 participants