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

Extented footnote support #215

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion py-usfm-parser/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ def find_all_markers(usfm_path, keep_id=False, keep_number=True):
all_markers_in_input.remove("esbe")
return all_markers_in_input

all_usfm_files = glob(f"{TEST_DIR}/*/*/origin.usfm")
all_usfm_files = glob(f"{TEST_DIR}/*/*/origin.usfm") +\
glob(f"{TEST_DIR}/*/origin.usfm") +\
glob(f"{TEST_DIR}/*/*/*/origin.usfm")

doubtful_usfms = [
]
Expand Down Expand Up @@ -170,6 +172,7 @@ def find_all_markers(usfm_path, keep_id=False, keep_number=True):
f"{TEST_DIR}/usfmjsTests/acts-1-20.aligned.crammed.oldformat/origin.usfm": "fail",
f"{TEST_DIR}/special-cases/empty-para/origin.usfm": "fail",
f"{TEST_DIR}/special-cases/sp/origin.usfm": "fail",
f"{TEST_DIR}/specExamples/extended/sidebars/origin.usfm":"fail",

# No. of columns in table not validated by usfm-grammar
f"{TEST_DIR}/paratextTests/MissingColumnInTable/origin.usfm": "pass",
Expand Down Expand Up @@ -205,6 +208,8 @@ def find_all_markers(usfm_path, keep_id=False, keep_number=True):
f"{TEST_DIR}/usfmjsTests/45-ACT.ugnt/origin.usfm": "fail", # also has \toc1 without content

f"{TEST_DIR}/biblica/PublishingVersesWithFormatting/origin.usfm": "fail", # \c without number

f"{TEST_DIR}/specExamples/extended/contentCatogories1/origin.usfm": "fail", # cat inside footnote
########### Need to be fixed #######################
f"{TEST_DIR}/paratextTests/NoErrorsShort/origin.usfm": "pass", # \c is mandatory!
f"{TEST_DIR}/usfmjsTests/gn_headers/origin.usfm": "fail", # what is the valid position for mte and imt
Expand Down
5 changes: 3 additions & 2 deletions tree-sitter-usfm3/grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,11 @@ module.exports = grammar({
$._nestedCharacterMarker,
))),

footnote: $ => choice($.f, $.fe, $.fm),
footnote: $ => choice($.f, $.fe, $.fm, $.ef),

f: $ => seq("\\f ",$.caller, repeat($._footnoteContents), "\\f*"),
fe: $ => seq("\\fe ",$.caller, $._footnoteContents, "\\fe*"),
fe: $ => seq("\\fe ",$.caller, repeat($._footnoteContents), "\\fe*"),
ef: $ => seq("\\ef ",$.caller, repeat($._footnoteContents), "\\ef*"),
fr: $ => seq("\\fr ", $.noteText, optional("\\fr*")),
fq: $ => seq("\\fq ", $.noteText, optional("\\fq*")),
fqa: $ => seq("\\fqa ", $.noteText, optional("\\fqa*")),
Expand Down