Bug#1002303: po4a: Incorrect handling of asciidoc tables with empty elements

2021-12-22 Thread Petter Reinholdtsen


I found a third mishandled table style in the LinuxCNC documentation.
When po4a is given this table from remap.adoc:

# remap.adoc
[format="csv",width="60%",cols="2"]
[frame="topbot",grid="none"]
[options="header"]
|===
iocontrol.0 pin  ,motion pin 
tool-prepare,digital-out-00 
tool-prepared,digital-in-00  
tool-change,digital-out-01 
tool-changed,digital-in-01  
tool-prep-number,analog-out-00  
tool-prep-pocket,analog-out-01  
tool-number,analog-out-02  
|===

we end up with this translated table:

[format="csv", width="60%", cols="2"]
[frame="topbot", grid="none"]
[options="header"]
|===

iocontrol.0 pin  ,motion pin 
tool-prepare,digital-out-00 
tool-prepared,digital-in-00  
tool-change,digital-out-01 
tool-changed,digital-in-01  
tool-prep-number,analog-out-00  
tool-prep-pocket,analog-out-01  
tool-number,analog-out-02  
|===

Sadly the extra newline after |=== cause the asciidoc tool to reject the
translated table. :(

-- 
Happy hacking
Petter Reinholdtsen



Bug#1002303: po4a: Incorrect handling of asciidoc tables with empty elements

2021-12-22 Thread Petter Reinholdtsen


I came across another problematic table.  Seem to me the AsciiDoc parser
interpret zero as empty in the table cells.  This table:

.Look Up Table
[width="50%",cols="6*^",options="header"]
|
|Bit 4|Bit 3|Bit 2|Bit 1|Bit 0|Output
|0|0|0|0|0|0
|0|0|0|0|1|1
|0|0|0|1|0|0
|0|0|0|1|1|1
|

it is 'translated' into this table:

.Look Up Table
[width="50%", cols="6*^", options="header"]
|
|Bit 4|Bit 3|Bit 2|Bit 1|Bit 0|Output
|||1|1
1||1|1|1
|

As you can see, not quite what was intended.  I tried to add space in
front of the 0 elements, but it did not make a difference.  Is it the
perl evaluation of 'false' that messes things up?

-- 
Happy hacking
Petter Reinholdtsen



Bug#1002303: po4a: Incorrect handling of asciidoc tables with empty elements

2021-12-21 Thread Petter Reinholdtsen


Note, a workaround for the issue is to place a space character after the
last '|' character on the table rows with empty fields in the right
column.

-- 
Happy hacking
Petter Reinholdtsen



Bug#1002303: po4a: Incorrect handling of asciidoc tables with empty elements

2021-12-21 Thread Petter Reinholdtsen


Package: po4a
Version: 0.62-1

I ran into something while setting up po4a in the LinuxCNC project,
which I suspect is a bug in po4a handling of AsciiDoc tables.

This set of test files demonstrate the problem, where the translated
table format is messed up (lacking newlines).  Note, adding '.' at the
end of the lines with directions avoid the problem.

% cat table.adoc
= table test

.HAL Option Names
[width="100%", cols="<3s,4*<"]
|===
|Pin and Parameter Types: |HAL_BIT |HAL_FLOAT |HAL_S32 |HAL_U32
|Pin Directions:  |HAL_IN  |HAL_OUT   |HAL_IO  |
|Parameter Directions:|HAL_RO  |HAL_RW||
|===
% cat po4a.cfg
[po4a_langs] fr
[po4a_paths] table.pot $lang:$lang.po

[po4a_alias:AsciiDoc_def] AsciiDoc opt:"--keep 0 --option 'entry=lang' --option 
'tablecells'"

[type: AsciiDoc_def] table.adoc $lang:$lang/table.adoc
% po4a po4a.cfg; cat fr/table.adoc 
= table test

.HAL Option Names
[width="100%", cols="<3s,4*<"]
|===
|Pin and Parameter Types: |HAL_BIT |HAL_FLOAT |HAL_S32 |HAL_U32
|Pin Directions:  |HAL_IN  |HAL_OUT   |HAL_IO  ||Parameter Directions:  
  |HAL_RO  |HAL_RW|
||===
%

-- 
Happy hacking
Petter Reinholdtsen