Python module: Revised JSON structure and filters #175
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The python module, especially the
to_dict()
or--format json
API, has been re-written completely with the following effects[--filter {scripture-bcv,notes,scripture-paragraph,all}]
to
[--filter {BOOK_HEADERS,PARAGRAPHS,TITLES,SCRIPTURE_TEXT,NOTES,ATTRIBUTES,MILESTONES,STUDY_BIBLE}]
Also, the way filter is used has been changed. Instead of selecting one option, now user can add more than one filter choice and include different combinations of the contents he needs to extract from the USFM. Example, scripture-and-notes, notes-and-milestones, scripture-and-titles, scripture-paragraphs-and-titles etc.
The
to_list()
or--format table
API, used for getting TSV outputs, has been re-written to work according to the JSON changes. This API is internally dependant on theto_dict()
api and just re-formats the dict output to a convenient list form. But this api cannot handle the paragraph filter option, as the nested structure of paragraphs is hard to implement in a table output format.Added linting check on gitactions for the python module
As part of the above to_dict refactoring, one grammar rule had to be changed(
toc
) to follow the pattern of other marker rules. This results in a slight change in the syntax tree.