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

AsciiDoc: Drop last character of table entries #386

Open
mquinson opened this issue Sep 11, 2022 · 7 comments
Open

AsciiDoc: Drop last character of table entries #386

mquinson opened this issue Sep 11, 2022 · 7 comments

Comments

@mquinson
Copy link
Owner

Hello,

a new bug was reported against the Debian package, here: https://bugs.debian.org/1019548

@jnavila, do you have some time to look at it? I'm not sure when I'll find some time to devote to po4a, but this will happen. It always happen after a while :)

Thanks for your help, Mt

@jnavila
Copy link
Collaborator

jnavila commented Sep 11, 2022

This is related to how cells lines are split into cells. The regexp for the separator include "e":

my @texts = split /(?:(?:\d+|\d*(?:\.\d+)?)(?:\+|\*))?[<^>]?(?:\.[<^>])?[demshalv]?\|/, $line;

I'm not sure we can use the split trick if we want to fix this.

I would argue that the formatting in the bug report is not proper Asciidoc:
https://docs.asciidoctor.org/asciidoc/latest/tables/add-cells-and-rows/ stipulates that the cell separator is prefixed with a space character.

@mquinson
Copy link
Owner Author

I'd prefer to save the split trick if possible. That's really convenient.

Is it possible to at least detect that the input is malformated and report it as an error to the users?

@smoe
Copy link

smoe commented Sep 13, 2022

I just learned about table style operators. Many thanks for that ;) On https://docs.asciidoctor.org/asciidoc/latest/tables/format-cell-content/ all these operators are at the beginning of a line. Would that help in some way ro keep the split? Have not seen any formal grammar anywhere, but the least I would expect is some whitespace to preceed the operator.

@jnavila
Copy link
Collaborator

jnavila commented Sep 14, 2022

We can introduce the need of a beginning of line or space as prefix, but this is a change of behavior.

@jnavila
Copy link
Collaborator

jnavila commented Sep 15, 2022

@smoe The first paragraph of https://docs.asciidoctor.org/asciidoc/latest/tables/add-cells-and-rows/#table-cells is quite clear:

Each new cell in a table is declared with a cell separator. The default cell separator is a vertical bar (|). All of the content entered after a cell separator is included in that cell until the processor encounters a space followed by another vertical bar (|) or a new line that begins with a |.

The cell specifiers are place directly in front of the cell separator, that is after a space or a new line.

The po4a parser for cells can work with well formatted cells, but will not behave correctly if the whitespace is missing.

@smoe
Copy link

smoe commented Sep 15, 2022

You are correct.

@mquinson
Copy link
Owner Author

I think we should at least produce a warning when there is no space involved in the separator, saying that something may go wrong. Don't you think so?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants