Repository navigation
feat: link page numbers to the dictionary's scan on archive.org - #120
Merged
Merged
Conversation
A term's "ص. N" now opens page N of its paper dictionary's scan on archive.org, in the UI, the raw search and the gadget. The API builds the link once, as `page_url` on each occurrence, from the `archive_org_url` and `page_offset` columns that arabterm adds to the `dictionary` table: printed page p is `<url>/page/n<p + page_offset - 1>`, the link the Cite Q module of ar.wikipedia builds from Wikidata's P953 and P8330. /api/v1/dicts returns the two columns as they are. Needs a DB import that has the two columns: the search query names them.
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.
Important
Draft until the DB refresh PR for forzagreen/arabterm#65 is merged and deployed: the search query names the two new
dictionarycolumns, so this code against the current DB would turn every search into a 500. The other way round is safe (the current code ignores the new columns).A term's ص. N now opens page N of its paper dictionary's scan on archive.org — in the UI, the raw search and the gadget.
search_terms_mariadbjoinsdictionary.archive_org_url/page_offset(new in arabterm#65) andarchive_page_url()turns them intopage_urlon each occurrence:<url>/page/n<page + page_offset - 1>/mode/1up, the same link the Cite Q module builds from Wikidata's P953 + P8330. The two columns are not repeated in every row;/api/v1/dictsreturns them as they are. Both are documented in the OpenAPI schema.DictionaryApp.jsx,RawSearch.jsx):ص. Nis a link whenpage_urlis there;dist/rebuilt.Gadget-WikiTerm.js,SearchTerm.jsre-synced (npm run sync), lint clean. Needs to be copied toMediaWiki:Gadget-WikiTerm.jsto reach ar.wikipedia.Coverage: 40 of the 46 dictionaries with page numbers have a scan.
Testing
make test: 173 passed, including new tests forarchive_page_urland forpage_urlin the search rows (with the DB stubbed)."telescope"returns e.g.at_physicsp. 285 →Ara1989ENFRAR/page/n404/mode/1up; for that link and two others, the OCR of the linked scan page contains "telescope" and its neighbours do not.