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

Bug: Inconsist output from usfmJS.toJSON() #103

Open
AndyHubert opened this issue Dec 11, 2021 · 0 comments
Open

Bug: Inconsist output from usfmJS.toJSON() #103

AndyHubert opened this issue Dec 11, 2021 · 0 comments

Comments

@AndyHubert
Copy link

Big idea: There is inconsistency as to whether the nextChar of a footnote is present in the subsequent verseObject, based on the presence of a cross-reference to follow both.

Explanation

In the results below (shown in comments), note the third item in verseObjects. For test2 there is a space before "God". For test1 there isn't.

Code

import usfmJS from 'usfm-js'

const test1 = usfmJS.toJSON(`\\v 1 In the beginning \\f + \\fk Alternate translation \\ft Or \\fq At the start\\f* God created.`)
const test2 = usfmJS.toJSON(`\\v 1 In the beginning \\f + \\fk Alternate translation \\ft Or \\fq At the start\\f* God created \\x + \\xt John 1:1|JOH 1:1\\xt*\\x*.`)

/*
test1 === {
  "headers": [],
  "chapters": {
    "1": {
      "1": {
        "verseObjects": [
          {
            "type": "text",
            "text": "In the beginning "
          },
          {
            "tag": "f",
            "type": "footnote",
            "content": "+ \\fk Alternate translation \\ft Or \\fq At the start",
            "endTag": "f*",
            "nextChar": " "
          },
          {
            "type": "text",
            "text": "God created."
          }
        ]
      }
    }
  }
}
*/

/*
test2 === {
  "headers": [],
  "chapters": {
    "1": {
      "1": {
        "verseObjects": [
          {
            "type": "text",
            "text": "In the beginning "
          },
          {
            "tag": "f",
            "type": "footnote",
            "content": "+ \\fk Alternate translation \\ft Or \\fq At the start",
            "endTag": "f*",
            "nextChar": " "
          },
          {
            "type": "text",
            "text": " God created "
          },
          {
            "tag": "x",
            "content": "+ \\xt John 1:1|JOH 1:1\\xt*",
            "endTag": "x*"
          },
          {
            "type": "text",
            "text": "."
          }
        ]
      }
    }
  }
}
*/
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

1 participant