Re: literal backslash in csv-table data

Guenter Milde via Docutils-users <[email protected]> Fri, 6 May 2022 22:29:25 -0000 (UTC)
Newsgroups gmane.text.docutils.user
Message-ID <[email protected]>
On 2022-05-04, Alan G. Isaac wrote:
> Are backslashes stripped out of the csv-table header?

Testing with the minimal example (provided in private mail) revealed that
a backslash must be quadrupled to appear in the output (rsp. the doctree).

This is a common "feature" if the same escape character is used two times...
(The first escape-round is the generic rST escape handling.)

Looking at the definitions in docutils/parsers/rst/directives/tables.py
reveals that headers from the argument list and table content are parsed
using different "CSV dialects": HeaderDialect vs. DocutilsDialect.
Only the first defines an escape character.

> If so, it this intentional? (In the csv-table data,
> they just need to be doubled.)

Given that this two different csv dialects are defined in tables.py
since at least 2004, it may be intentional or a side-effect of some intention.

OTOH, the documentation
https://docutils.sourceforge.io/docs/ref/rst/directives.html#csv-table-1
says regarding the "header" option:

  Must use the same CSV format as the main CSV data.
  
Either implementation or documentation should be changed. Now we need to
find out / decide which.

Günter  



_______________________________________________
Docutils-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.