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: Footnote support #880

Open
rgieseke opened this issue Mar 25, 2021 · 3 comments
Open

JATS: Footnote support #880

rgieseke opened this issue Mar 25, 2021 · 3 comments

Comments

@rgieseke
Copy link
Contributor

Probably related to issue #144

How would one add support to read a footnote as an inline element as part of a paragraph?
Right now it's rendered as another paragraph next to the paragraph which has the annotated word as the last word.

E.g. JATS:

    <p id="p1">Text<fn id="idm6"><p id="footnote1">Footy note about Text.</p></fn> begins and ends.</p>

To JSON:

"content": [
    {
      "type": "Paragraph",
      "id": "p1",
      "content": [
        "Text"
      ]
    },
    {
      "type": "Paragraph",
      "id": "footnote1",
      "content": [
        "Footy note about Text."
      ]
    },
    {
      "type": "Paragraph",
      "content": [
        " begins and ends."
      ]
    }

It should be inline like a mark i think:

  {
      "type": "Paragraph",
      "id": "p2",
      "content": [
        "Normal Text, ",
        {
          "type": "Strong",
          "content": [
            "bold"
          ]
        },
        " or not."
      ]
    }

I played around with adding a decodeFootnote function but don't really know what the best approach would be.

@nokome
Copy link
Member

nokome commented Mar 25, 2021

Thanks for raising this @rgieseke. I propose a new Note type that would encompass footnotes and endnotes (and perhaps default to being an inline note i.e. in HTML it appears when you hover over it?):

[
  {
    "type": "Paragraph",
    "id": "p1",
    "content": ["Text"]
  },
  {
    "type": "Note",
    "id": "idm6",
    "noteType": "Footnote",
    "content": [
      {
        "type": "Paragraph",
        "id": "footnote1",
        "content": ["Footy note about Text."]
      }
    ]
  },
  {
    "type": "Paragraph",
    "content": [" begins and ends."]
  }
]

The Note.schema.yaml in https://github.com/stencila/schema/tree/master/schema would look something like,

title: Note
'@id': stencila:Note
extends: Entity
role: secondary
status: unstable
description: .
properties:
  noteType:
    '@id': stencila:noteType
    description: Determines where the note content is displayed within document.
    type: string
    enum:
      - Footnote
      - Endnote
  content:
    '@id': stencila:content
    description: Content of the note, usually a paragraph.
    type: array
    items:
      $ref: BlockContent
    $comment: |
      Most notes will have a single paragraph but could have multiple
      paragraphs, tables and even figures.
required:
  - content

But needs more research into how other document schemas represent footnotes etc e.g. JATS, Pandoc, MDAST.

@rgieseke
Copy link
Contributor Author

This sounds quite good!

JATS describes <fn> footnotes like:

Additional information tied to a particular location in the text. This material is not considered to be part of the body of the text, but is a note used instead of, in addition to, as a source for, or as a commentary on either some body text or on an element in the metadata such as an author.

They can be grouped in <fn-group> for endnotes:

When footnotes are grouped at the end of an article, wrap them in a and use an element in the text, as usual, to tie each footnote in the list to a particular location in the text.

https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/fn.html

Pandoc Markdown extension allows for footnotes like:

Here is a footnote reference,[^1] and another.[^longnote]

[^1]: Here is the footnote.

[^longnote]: Here's one with multiple blocks.

https://pandoc.org/MANUAL.html#footnotes

It HTML sidenotes or margin notes are also quite common (e.g. https://edwardtufte.github.io/tufte-css/#sidenotes), but there is no implementation standard, so it would be difficult to parse and have a separate category to footnote/endnote.

<aside> is sometimes used:

The HTML

element represents a portion of a document whose content is only indirectly related to the document's main content. Asides are frequently presented as sidebars or call-out boxes.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/aside

Should we continue this as a PR to stencila/schema?

@nokome
Copy link
Member

nokome commented Mar 30, 2021

Thanks for doing that research,, useful stuff.

Should we continue this as a PR to stencila/schema?

Yes, if you could start one based on the above YAML that'd be great.

rgieseke added a commit to rgieseke/schema that referenced this issue Mar 30, 2021
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

2 participants