-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Option to use list-tables in rST writer. #4564
Comments
This will be very helpful! |
how do you imagine the user interface for this? an extension for the writer? |
@danse maybe as a command line option for the writer: pandoc -f html -t rst --list-tables test.html -o result.rst Although, in my opinion the list-table syntax is so much better than the grid-table, that is should be the default option. I've added a bug report that can be solved by switching to list-tables. |
A global option like that works if you want all the tables to be
list-tables. But I can imagine someone preferring grid tables
for readability in simple cases, but wanting list tables for
some special cases.
… @danse maybe as a command line option for the writer:
```bash
pandoc -f html -t rst --list-tables test.html -o result.rst
```
|
@jgm in my company it's a question of documentation style guide. We have to choose one syntax option and stick to it. We chose list-tables for many reasons. Same with headers: rST allows using any character for any header level, but when you see a header, you should know the level without reading the whole document. So we chose Indeed, people may want to use both styles. Maybe the answer is to use grid-tables in simple cases and switch to list-tables if table contains lists, code blocks, URL's, long words or any other complex things. Then a global option could be used to enforce always using one of the syntaxes. I can help with gathering a set of examples of such things. Another option could be to mark tables with special classes in native representation. Then someone using Pandoc to write rST would implement their own logic to make a decision about each table, then add a marker class and pass the sources to Pandoc. |
honestly i am curious about the motivations you mention in favour of
list-tables. we did stumble upon some problems with complex content in grid
tables, and the solution we adopted is to apply `--wrap none` to tables,
which leads to documents that are less readable.
if list tables prove to be a better solution also for my team, i could
start working on the code for rendering them while we refine ideas about
the interface.
if you think that there is a criteria pandoc could apply, like the presence
of a style in cell contents, then your examples are definitely helpful to
design this automation better.
if i understand correctly, we don't know how to enable the users to specify
the rendering style by table. i'd say that having a writer option would
already be an improvement in pandoc. that could be a first step while we
discuss further.
…On 11 May 2018 at 06:45, Nick Volynkin ***@***.***> wrote:
@jgm <https://github.com/jgm> in my company it's a question of
documentation style guide. We have to choose one syntax option and stick to
it. We chose list-tables for many reasons.
Same with headers: rST allows using any character for any header level,
but when you see a header, you should know the level without reading the
whole document. So we chose =-~^, just like in Pandoc
<https://github.com/jgm/pandoc/blob/8b01f03eaa0c73259ed7a6d73c649cac65edcddc/src/Text/Pandoc/Writers/RST.hs#L252>
.
Indeed, people may want to use both styles. Maybe the answer is to use
grid-tables in simple cases and switch to list-tables if table contains
lists, code blocks, URL's, long words or any other complex things. Then a
global option could be used to enforce always using one of the syntaxes. I
can help with gathering a set of examples of such things.
Another option could be to mark tables with special classes in native
representation. Then someone using Pandoc to write rST would implement
their own logic to make a decision about each table, then add a marker
class and pass the sources to Pandoc.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4564 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AA2Er_BMBIIjDwW5-Lx81GOFqm40JQNyks5txRdagaJpZM4TbWQl>
.
|
@danse First, some insight into how I'm using Pandoc. We have lots of documentation in a legacy authoring system. Tens of guides, many languages. All these docs will be converted from HTML to rST/Sphinx projects. New sources should be consisent in style and syntax, because we will update and improve them a lot. So we've defined a single true way for doing anything that has more than one option. For tables we chose the list-table syntax. Here's why:
|
Thanks, that seems to be plenty of reasons. The rST documentation about list tables is very concise so it's not clear to me how to structure a list table containing nested markup like in the case of code with long lines. Does anybody have an example of a complex list table? It would help to assess how this option would affect the users |
@danse here's an example of a list-table with paragraphs, block and inline code from our docs. |
This test derived from your complex table example succeeds with the code in that branch. While i'm working on improvements i could use some directions from the future users of this feature. Indentation levels are chosen in order to follow those currently used for bullet lists, in order to reuse the code. Do we have any good reason to do differently? It is not clear to me how to precisely find the options supported by a directive. Looking at the docutils code it seems like the supported options are I assume that widths are the desired widths ... with sizes expressed in proportions of the column width of the document? I assume that Any pointer to better doc is appreciated, if i won't find anything better i could look at the docutils code. Currently i think that i will produce |
This might be too technical for some readers but it makes sense to write it here: in the RST writer i see that |
alright, pull request #4780 is finally adding this feature 🙂 |
this changes the API adding a global `--list-table` option which only affects the rST writer, and causes all tables to be rendered using the list table syntax documented here http://docutils.sourceforge.net/docs/ref/rst/directives.html#list-table
this changes the API adding a global `--list-table` option which only affects the rST writer, and causes all tables to be rendered using the list table syntax documented here http://docutils.sourceforge.net/docs/ref/rst/directives.html#list-table
Hi. I have a national standard document I would like to convert to RST with list-table. Is there any hope to have an official pandoc version with this support? I tried unsuccessfully to build the code from the above mentioned pull request, without success (some version skew, not sure what was wrong), and thus hope an official pandoc version will be released with thus support, so I can pick it up via Debian. :) |
The main thing blocking this is figuring out a good way to trigger the table style. I'd prefer not to have a command-line option that just affects rst rendering, and affects it globally. Better to be able to mark up tables individually. However, currently, there's no way to put attributes on tables. This should change soon, hopefully, and then we'll have a way to
|
[John MacFarlane]
The main thing blocking this is figuring out a good way to trigger the
table style. I'd prefer not to have a command-line option that just
affects rst rendering, and affects it globally. Better to be able to
mark up tables individually. However, currently, there's no way to put
attributes on tables. This should change soon, hopefully, and then
we'll have a way to
For my use case, one time conversion for future maintenance using RST, a
global flag work just fine. :)
…--
Happy hacking
Petter Reinholdtsen
|
I too would love to see this feature. The only solution I have now is to also install rstdoc with |
I haven't been working on pandoc in years and i'm definitely out of training, anyway this is a relatively simple update of an existing patch so here is the new pull request |
this changes the API adding a global `--list-table` option which only affects the rST writer, and causes all tables to be rendered using the list table syntax documented here http://docutils.sourceforge.net/docs/ref/rst/directives.html#list-table
I tried the patch, and from what I can tell it produced RST that Pandoc is not able to read back in:
The format that is output-ed by this patch is:
|
[Baard H. Rehn Johansen]
I tried the patch, and from what I can tell it produced RST that
Pandoc is not able to read back in:
As far as I can tell, not being an RST expert, the input and output seem
to be equivalent. At least any :widths with two identical numbers would
work the same way, so "1 1", "50 50" and "36 36" are all the same. And
the list in list seem to be equivalent too.
What specific do you see that is not understood correctly?
…--
Happy hacking
Petter Reinholdtsen
|
We could easily change the patch to produce the more compact list output (which seems desirable to me). |
The native output after parsing doesn't contain any of the text in the input, it's just a blank table. So the format output-ed by the patch is not parsed correctly by pandoc. I'm not an RST guru, so not sure if the output of the patch is wrong or if the RST reader in pandoc is broken (I suspect the latter). |
If this reveals a problem with pandoc's RST list parsing, then you might open a new issue for that, using as simple an example as possible (regular list, not list table). |
Just to add support to this need: Here at Adobe our rst/sphinx docs use list tables 100% of the time. Pandoc's grid table output is very time consuming to work with. Keep up the good work. |
hopefully i will get some time to work on this in the next weeks, but i am still blocked by this #4564 (comment) about the feature's design. personally if i had to convert many documents, the idea of marking every table would sound tedious to me, but i am willing to follow users' consensus and look for another way, since i agree that having a global option is not ideal either. Is it now possible to add attributes to tables, or should this still wait a bit? |
Yes, Tables can have attributes added to them now -- in the AST. But many input formats (including Markdown) still don't have a way to add attributes directly to a table. |
It would be good to know, from those who use list tables, whether they have a need to have documents containing some list and some non-list tables. |
When a table is marked with a "list-table" attribute class, it will now be rendered using the list table syntax documented here http://docutils.sourceforge.net/docs/ref/rst/directives.html#list-table
I created a new pull request including the required changes. As discussed, a filter will be required in order to render all tables in a document as list tables. A filter instance is attached here, along with a
|
[API change] Add writerListTables to WriterOptions. RST writer: Remove sensitivity to "list-table" class in table attributes. Instead, just check `writerListTables` in writer options. See #4564.
It would be great if pandoc could write list-tables instead of the usual grid-like tables.
The grid-like rST tables have several faults that list-tables do not have:
I've searched through
pandoc -h
, tests and source code but could not find anything related. If there's a filter that can do it, please drop a link. 😄The text was updated successfully, but these errors were encountered: