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

Can't get Pod table formatted right #1821

Closed
zoffixznet opened this issue May 12, 2018 · 6 comments

Comments

Projects
None yet
2 participants
@zoffixznet
Copy link
Contributor

commented May 12, 2018

I have this table in my code:

=begin table

    Type    | Comments
    ========+=================================================
    Complex |
    Num     |
    FatRat  |
    MidRat  | Special infectiousness. See prose that follows. 
    Rat     |
    Int     |

=end table

Which errors out with this:

$ perl6 -c doc/Language/numerics.pod6                                                                                                                                                                   
===FATAL: Table 2 has a mixture of visible and invisible column-separator types.
    Type    | Comments
    ========+=================================================
    Complex |
    Num     |
    FatRat  |
    MidRat  | Special infectiousness. See prose that follows. 
    Rat     |
    Int     |

===end FATAL table 2 input
===SORRY!===

I've no idea what it's talking about since as far as I can tell I've only used visible separators for all the things I wanted to use separators for.

I changed the code to this:

=begin table

    Type    | Comments                                        |
    ========+=================================================+
    Complex |                                                 |
    Num     |                                                 |
    FatRat  |                                                 |
    MidRat  | Special infectiousness. See prose that follows. |
    Rat     |                                                 |
    Int     |                                                 |

=end table

And now the fatal error is gone, but I get a warning instead:

$ perl6 -c doc/Language/numerics.pod6 
===WARNING: One or more tables evidence bad practice.
==          Set environment variable 'RAKUDO_POD_TABLE_DEBUG' for more details.
Syntax OK

$ RAKUDO_POD_TABLE_DEBUG=1 perl6 -c doc/Language/numerics.pod6
[...]
===WARNING: Table 2 has unneeded border vis col separators.
    Type    | Comments                                        |
    ========+=================================================+
    Complex |                                                 |
    Num     |                                                 |
    FatRat  |                                                 |
    MidRat  | Special infectiousness. See prose that follows. |
    Rat     |                                                 |
    Int     |                                                 |

===end WARNING table 2 input rows
[...]

First of all, why is drawing the full table a "bad practice"? What's bad about it? And second, what's the right way to draw such a table?

@tbrowder

This comment has been minimized.

Copy link
Member

commented May 12, 2018

Maybe you’ve found an edge case, and I’ll have to look at to see what triggers the error and warning.

I can’t tell at the moment, but are there two adjacent embedded spaces in the filled second column? If so, that will trigger a failure (see the docs: “Pod 6 Tables”). If there are one or more instances of two adjacent spaces, try escaping one space of each pair and see if that mitigates the error (and produces the desired results).

The warning is intended to keep table authors away from habits that can cause table failures more easily with subtle typos.

UPDATE After checking the Rakudo code I don’t see what is causing the error at the moment.
Any adjacent spaces in the second column should be ignored because the line has visible column separators, but I’m just revisiting after a long time away...this will be solved!

UPDATE 2. I think I see the problem. Can you try REMOVING the trailing pipes in your original version (just leave the single pipe separating the two columns of text) and see if that solves the problem. I’m not able to compute at the moment but your test would help me later.

@zoffixznet

This comment has been minimized.

Copy link
Contributor Author

commented May 12, 2018

two adjacent embedded spaces in the filled second column?

You mean after See prose that follows.? No, there's just one space before the border and no spaces in the variant without the border.

The warning is intended to keep table authors away from habits that can cause table failures more easily with subtle typos.

That feels like fence-sitting. Either make it fatal and forbid me from writing tables in that way or don't tell me anything. The warning just pollutes the output and doesn't really tell me what is wrong (I still don't follow what typos it's trying to protect me from).

@tbrowder

This comment has been minimized.

Copy link
Member

commented May 12, 2018

@tbrowder

This comment has been minimized.

Copy link
Member

commented May 12, 2018

Your “baby-sitting” comments are spot on. Realize that when I finished that table pod work I was heavily invested in numerous edge cases and troublesome differences in vis and non-vis col sep tables, and I wanted to warn table authors about subtle traps. I will change the warning approach when I fix your problem: remove all warnings as the default unless an appropriate environment variable is set.

@zoffixznet

This comment has been minimized.

Copy link
Contributor Author

commented May 12, 2018

UPDATE 2. I think I see the problem. Can you try REMOVING the trailing pipes in your original version (just leave the single pipe separating the two columns of text) and see if that solves the problem. I’m not able to compute at the moment but your test would help me later.

This still has the fatal error:

=begin table

    Type    | Comments
    ========+=================================================
    Complex
    Num
    FatRat
    MidRat  | Special infectiousness. See prose that follows.
    Rat
    Int

=end table
===FATAL: Table 2 has a mixture of visible and invisible column-separator types.
    Type    | Comments
    ========+=================================================
    Complex
    Num
    FatRat
    MidRat  | Special infectiousness. See prose that follows.
    Rat
    Int

===end FATAL table 2 input
===SORRY!===

lizmat added a commit that referenced this issue May 16, 2018

Merge pull request #1826 from tbrowder/fix-gh1821
Fix for GH #1821: unexpected table failure

jstuder-gh added a commit to jstuder-gh/rakudo that referenced this issue May 19, 2018

Fix for GH rakudo#1821: unexpected table failure
The failure was unexpected because the failure message
reported mixed visual and non-visual column separators
but such were not seen. The fix was to properly
detect trailing visual column separators.

Tests have been added for the fix.

Additional changes:

+ turn off unsolicited warnings for tables violating
  best practices (but code just commented out for now)
+ typo fix
@tbrowder

This comment has been minimized.

Copy link
Member

commented May 20, 2018

Closed with commit 35afcc9.

@tbrowder tbrowder closed this May 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.