Repository navigation
feat(reader): clickable citation links - #648
Merged
Merged
Conversation
The database now writes the citations of the texts as <a class="ref" href="seforim://line/<id>">(בראשית א, ד)</a> (SeforimLibrary :reflinks). HtmlParser keeps the href of these links and the annotated text marks them as underlined LinkAnnotation.Url, the surrounding spaces left out. Every window provides a UriHandler that opens seforim://line/<id> in a new tab on the target line; any other URI still goes to the platform. Signed-off-by: Elie Gambache <elyahou.hadass@gmail.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Client side of #111 (SeforimLibrary: kdroidFilter/SeforimLibrary#120): citations in the texts become underlined links that open their target in a new tab.
The database writes them into
line.contentasChanges
ParsedHtmlElement.hrefkeeps the target of<a class="ref">;buildAnnotatedFromHtmlmarks the citation as an underlinedLinkAnnotation.Url, without the surrounding spaces. Other anchors stay plain text.RefLinkUriHandler: opensseforim://line/<id>in a new tab on the target line (book looked up through the repository); any other URI still goes to the platform handler.MainAppWindow: provides that handler to the whole window, so links work in the book, the commentaries and everywhere else.A link click is consumed by the text's link handling, so it does not also select the line.
Without links in the database
No change: the current databases contain no
<a class="ref">. Links reach users with the first database release built with:reflinks:generateRefLinks.Test plan
:htmlparser:jvmTest: the href survives parsing, only the citation is a link, other anchors are notRefLinkUriHandlerTest:seforim://line/<id>parsing, other URIs ignored(בראשית ה, ו)opened a new tab on Bereshit 5:6To try locally: