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

JATS: Decoding tag <table-wrap-foot> missing in <table-wrap> #667

Closed
asisiuc opened this issue Sep 3, 2020 · 7 comments
Closed

JATS: Decoding tag <table-wrap-foot> missing in <table-wrap> #667

asisiuc opened this issue Sep 3, 2020 · 7 comments

Comments

@asisiuc
Copy link

asisiuc commented Sep 3, 2020

Jats lacks <table-wrap-foot> tag content when converting to format JSON:

Steps to reproduce

This is captured in the jats as:

<table-wrap id="table1" position="float">
  <label>Table 1.</label>
  <caption></caption>
  <table></table>
  <table-wrap-foot>
    <fn>
      <p>
        <italic>Source:</italic>
        CEPAL (2016) and World Bank (2016).
      </p>
    </fn>
    <fn id="T1_FN1" fn-type="general">
      <p><italic>Notes</italic>: a/ 2005&#x2013;2010; b/ 2010; c/ Percentage of population; d/ Population ages
        25&#x2013;59; e/ Population ages 15&#x2013;64; f/ Percentage of households.
      </p>
    </fn>
  </table-wrap-foot>
</table-wrap>

After running

encoda convert -- convert ./../encoda/article.xml article.json --from jats

In the converted result <table-wrap-foot> tag is missing content.

@nokome
Copy link
Member

nokome commented Sep 4, 2020

Thanks for this @asisiuc .

For reference, the JATS standard says that <table-wrap-foot> is a "Container element to hold the footnotes, general notes, or other paragraphs at the end of a table."

The main question is which property of a Table node should these notes get added to. I see two options:

  1. append it the existing caption property; downside is that this would be "lossy" in that it lumps <caption> and <table-wrap-foot> and so wouldn't allow the two to be displayed separately e.g. in HTML, upside is that it's the easiest to implement

  2. use it for one of the existing properties of a table https://schema.stenci.la/table: content or description (of the two, I suggest description since that is an schema.org property, whereas content is a custom extension of the Stencila schema.

If we were to go ahead with using description, it should be fairly straightforward to implement in decodeTableWrap, along the lines of how we handle caption e.g.

  const descriptionElem = child(elem, 'caption')
  const description =
    descriptionElem !== null && Array.isArray(descriptionElem.elements)
      ? decodeElements(descriptionElem.elements, state)
      : undefined

...

  return [
    stencila.table({
      id: decodeInternalId(attr(elem, 'id')),
      label: textOrUndefined(child(elem, 'label')),
      caption,
      rows: [...headerRows, ...bodyRows],
      description
    }),
  ]

cc @FAtherden-eLife

@fred-atherden
Copy link
Collaborator

description sounds fine to me.

@asisiuc
Copy link
Author

asisiuc commented Sep 8, 2020

Thanks for your replay @FAtherden-eLife @nokome , it is a very good solution, so we analyzed and came to the conclusion that fn-type and id must also be included, because it is possible that it will be a kind of anchor in the future in the articles, so there is little different from logic to caption.

@nokome
Copy link
Member

nokome commented Sep 8, 2020

Thanks @asisiuc . I'm having a look at your PR now. Can you please "Allow edits from maintainers" so that I can make changes to your PR directly: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork

@asisiuc
Copy link
Author

asisiuc commented Sep 8, 2020

Thanks for the quick reply @nokome, but we have some issue with allowing to edit PR because of ISSUE, so in order to make this work, please add me as a contributor.

Thanks @asisiuc . I'm having a look at your PR now. Can you please "Allow edits from maintainers" so that I can make changes to your PR directly: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork

@nokome
Copy link
Member

nokome commented Sep 8, 2020

@asisiuc I have added you as a collaborator with write permissions to this repo. It will probably be easier if you create future PRs in this repo directly, rather than in your fork.

I am closing this PR, in favour of its duplicate #674.

@nokome nokome closed this as completed Sep 8, 2020
@nokome
Copy link
Member

nokome commented Sep 8, 2020

Arrgh, sorry meant to close the PR, not this issue. Reopening.

@nokome nokome reopened this Sep 8, 2020
@asisiuc asisiuc closed this as completed Sep 11, 2020
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