metanorma / metanorma-ogc

Metanorma processor for OGC documents
https://www.metanorma.com
BSD 2-Clause "Simplified" License
2 stars 3 forks source link

Columns of requirements class table are too narrow on the PDF #629

Closed ghobona closed 8 months ago

ghobona commented 10 months ago

Requirements Class 2 on pdf page 52. Table is not filling the width of the page.

The result is that the columns become too narrow.

https://opengeospatial.github.io/ogcna-auto-review/22-003.pdf

Screenshot 2024-02-05 at 12 12 13

ronaldtse commented 10 months ago

@Intelligent2013 could you please help urgently? Thanks.

Intelligent2013 commented 10 months ago

XML fragment:

<table id="rc_movingfeature" class="modspec" type="recommendclass">
    <thead>
        <tr>
            <th scope="colgroup" colspan="2">
                <p class="RecommendationTitle">Requirements class 2: Requirements Class ‘Moving Features’</p>
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <th>Identifier</th>
            <td>
                <tt>http://www.opengis.net/spec/ogcapi-movingfeatures-1/1.0/req/movingfeatures</tt>
            </td>
        </tr>

Internally, in XSL-FO the table contains 6 columns with non determined widths:

<fo:table id="rc_movingfeature" table-omit-footer-at-break="true" table-layout="fixed" width="100%">
    <fo:table-column column-width="proportional-column-width(NaN)"/>
    <fo:table-column column-width="proportional-column-width(NaN)"/>
    <fo:table-column column-width="proportional-column-width(NaN)"/>
    <fo:table-column column-width="proportional-column-width(NaN)"/>
    <fo:table-column column-width="proportional-column-width(NaN)"/>
    <fo:table-column column-width="proportional-column-width(NaN)"/>
    <fo:table-header>

I'll investigate what's happened.

@ronaldtse FYI, the current issue doesn't relate to the mn2pdf, but https://opengeospatial.github.io/ogcna-auto-review/22-003.pdf generated by mn2pdf version 1.50 (Sep 3, 2022) image

The latest version is 1.82 (https://github.com/metanorma/mn2pdf/releases/tag/v1.82)

May be something wrong in the metanorma container? From https://github.com/opengeospatial/ogcna-auto-review/blob/main/.github/workflows/generate_22-003.yml:

jobs:
  build:
    runs-on: ubuntu-latest
    container: metanorma/metanorma:latest
...
Intelligent2013 commented 10 months ago

@ronaldtse issue fixed in https://github.com/metanorma/metanorma-ogc and https://github.com/metanorma/mn2pdf/releases/tag/v1.83. (The issue was in the table processing algorithm with the ids rc_movingfeature and rc_movingfeature_collection, both start with the same prefix rc_movingfeature_ in the algorithm).

Intelligent2013 commented 10 months ago

Resulted PDF: image

ronaldtse commented 10 months ago

@Intelligent2013 it's a little strange that the table column balancing depends on the ID...?

Intelligent2013 commented 10 months ago

@Intelligent2013 it's a little strange that the table column balancing depends on the ID...?

@ronaldtse table column balancing algorithm based on the Apache Intermediate Format (IF) XML processing. Apache IF XML doesn't contain table 'as is'. It contains the portions of the text with the 'x,y' coordinates. For identifying the relation each text to the table, we need to mark each text with id = table's id + row number + column number. In the algorithm there was issue with the extraction the row number + column number after the table's id. Now it's fixed.

ghobona commented 8 months ago

Discussed 2024-03-19

Confirmed that the fix worked.