Skip to content

feat(reader): clickable citation links - #648

Merged
kdroidFilter merged 1 commit into
devfrom
feat/clickable-ref-links
Oct 11, 2026
Merged

kdroidFilter merged 1 commit into
devfrom
feat/clickable-ref-links

Conversation

@kdroidFilter

Copy link
Copy Markdown
Owner

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.content as

<a class="ref" href="seforim://line/<id>">(בראשית א, ד)</a>

Changes

  • htmlparser: ParsedHtmlElement.href keeps the target of <a class="ref">; buildAnnotatedFromHtml marks the citation as an underlined LinkAnnotation.Url, without the surrounding spaces. Other anchors stay plain text.
  • RefLinkUriHandler: opens seforim://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 not
  • RefLinkUriHandlerTest: seforim://line/<id> parsing, other URIs ignored
  • ktlint, detekt
  • real run on a database generated with the links (E2E harness, isolated user data): citations underlined in בראשית רבתי, a real click on (בראשית ה, ו) opened a new tab on Bereshit 5:6

To try locally:

SEFORIMAPP_DATABASE_PATH=/path/to/reflinks/seforim.db ./gradlew :SeforimApp:run

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>
@kdroidFilter
kdroidFilter marked this pull request as ready for review October 11, 2026 11:29
@kdroidFilter
kdroidFilter merged commit 56a48d0 into dev Oct 11, 2026
2 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant