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

The Jats reader does not parse multiple bodies or parse the footer's content #8765

Closed
noahmalmed opened this issue Apr 7, 2023 · 0 comments · Fixed by #8795
Closed

The Jats reader does not parse multiple bodies or parse the footer's content #8765

noahmalmed opened this issue Apr 7, 2023 · 0 comments · Fixed by #8795
Labels

Comments

@noahmalmed
Copy link
Contributor

Description

This is an issue sprung from a PR comment.

Essentially, the code assumes there is only one body in a table ([when there can be many](Table Body (NISO JATS table model), one or more)) and fully skips parsing any of the content from the table footer.

Here are the areas of code that will most likely need to change.

Here we pass in an empty list where we should be passing in a list of parsed Rows from the xml

Here we only filter for one child called tbody but we should be filtering for multiple tbodys so we can parse them if they exist

Running Pandoc

Text XML:

<table>
    <col align="left" />
    <col align="left" />
    <col align="left" />
    <thead>
        <tr>
            <td>
                <p>1</p>
            </td>
            <td>
                <p>2</p>
            </td>
            <td>
                <p>3</p>
            </td>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                <p>a</p>
            </td>
            <td>
                <p>b</p>
            </td>
            <td>
                <p>c</p>
            </td>
        </tr>
    </tbody>
    <tfoot>
        <tr>
            <td>footer 1</td>
            <td>footer 2</td>
            <td>footer 3</td>
        </tr>
    </tfoot>
</table>

Pandoc native output:

[ Table
    ( "" , [] , [] )
    (Caption Nothing [])
    [ ( AlignLeft , ColWidthDefault )
    , ( AlignLeft , ColWidthDefault )
    , ( AlignLeft , ColWidthDefault )
    ]
    (TableHead
       ( "" , [] , [] )
       [ Row
           ( "" , [] , [] )
           [ Cell
               ( "" , [] , [] )
               AlignDefault
               (RowSpan 1)
               (ColSpan 1)
               [ Para [ Str "1" ] ]
           , Cell
               ( "" , [] , [] )
               AlignDefault
               (RowSpan 1)
               (ColSpan 1)
               [ Para [ Str "2" ] ]
           , Cell
               ( "" , [] , [] )
               AlignDefault
               (RowSpan 1)
               (ColSpan 1)
               [ Para [ Str "3" ] ]
           ]
       ])
    [ TableBody
        ( "" , [] , [] )
        (RowHeadColumns 0)
        []
        [ Row
            ( "" , [] , [] )
            [ Cell
                ( "" , [] , [] )
                AlignDefault
                (RowSpan 1)
                (ColSpan 1)
                [ Para [ Str "a" ] ]
            , Cell
                ( "" , [] , [] )
                AlignDefault
                (RowSpan 1)
                (ColSpan 1)
                [ Para [ Str "b" ] ]
            , Cell
                ( "" , [] , [] )
                AlignDefault
                (RowSpan 1)
                (ColSpan 1)
                [ Para [ Str "c" ] ]
            ]
        ]
    ]
    (TableFoot ( "" , [] , [] ) [])
]

Note: only one tbody is parsed into the Pandoc AST and no content from the tfoot is parsed into the Pandoc AST

Pandoc version?
pandoc 3.1.2, MacOS Monterey

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

Successfully merging a pull request may close this issue.

1 participant