Add markup format option to work queries - #53
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
markup_formatkeyword support towork_by_id,work_by_doi,book_by_doi,chapter_by_doi,works,books, andchaptersJATS_XML,PLAIN_TEXT,HTML, andMARKDOWNJATS_XMLas the default when the argument is omitted orNoneValueErrorbefore any HTTP request1.2.0and document the public APIDesign
Work-query markup formatting belongs to the nested canonical
titles(...)andabstracts(...)selections, not to the rootwork/worksfield. The generated endpoint helpers therefore consumemarkup_formatas a field-rendering option and pass a fresh per-request field list through the query layer.Rendering replaces only field entries exactly matching the canonical top-level title and abstract selections. Biographies, related-work titles, additional resources, awards, endorsements, book reviews, and other rich-text fields keep their existing
JATS_XMLselections.No static query definition or shared field list is mutated, so sequential requests, multiple clients, concurrent calls, and tests in any order retain independent formatting.
Verification
python3 -m unittest thothlibrary.tests.test_queries thothlibrary.tests.test_rest thothlibrary.thoth-1_0_0.tests.tests— 28 tests passedpython3 -m compileall -q thothlibrary— passedgit diff --check— passedpython3 setup.py --version—1.2.0Focused coverage proves the default and
PLAIN_TEXTrendering for all seven methods, unquotedHTML/MARKDOWN, restricted transformation, pre-request validation, raw and structured responses, and no state leakage.Live read-only verification
A credential-free check against
https://api.thoth.pubused worke0f748b2-984f-45cc-8b9e-13989c31dda4withraw=True. Both explicitJATS_XMLandPLAIN_TEXTcalls succeeded. Three non-empty canonical title/abstract values were inspected: the JATS response retained tags, while the plain-text response contained visible text without JATS tags. No mutation was performed.Release preparation
This backward-compatible public API addition prepares version
1.2.0. GitHub was checked before the bump: nov1.2.0tag, release-preparation branch, or issue/PR mentioning1.2.0existed. This PR does not create a release or publish to PyPI.