Page MenuHomePhabricator

Mobile apps: Reference popup should support subreferences
Closed, ResolvedPublic

Description

Currently, clicking on a footnote marker in the article causes the ReferenceDialog popup to display the full footnote body for that ref. We want this mechanism to be extended to show both the main ref on top and subref on the bottom.

As an example of how subreference previews are rendered in the mobile web view, the following wikitext:

<ref name="main">Named ref (body)</ref>
<ref name="main" details="Subreference (body)" />

is shown in a preview with the main and subref bodies stacked vertically, single-spaced:

image.png (168×613 px, 9 KB)

This has already been implemented for MobileFrontend, see the relevant code: https://gerrit.wikimedia.org/g/mediawiki/extensions/MobileFrontend/+/refs/changes/72/1161872/1/src/mobile.startup/references/ReferencesHtmlScraperGateway.js#36

The basic algorithm is that when a footnote marker is clicked, we extract two chunks of content rather than one, following these steps:

  • Use ID embedded in the footnote marker to locate the subref reflist item
  • Extract subreference footnote body content the same as for a normal ref
  • Traverse to the parent, which is the main ref for the subref.
  • Extract the parent's footnote body content.
  • Render the foonote preview like:
[<subref number, eg. 1.1>] <main ref content>
<subref content>

Ideally this be wholly or partially implemented in the shared pagelib JS layer.

The attached proof-of-concept patch shows the basic desired behavior, but the style and code should be refined:

image.png (171×260 px, 9 KB)

Event Timeline

awight changed the subtype of this task from "Spike" to "Task".Sep 4 2025, 4:27 PM
awight renamed this task from Android app: Reference popup should support subreferences to Mobils apps: Reference popup should support subreferences.Sep 6 2025, 12:47 PM
awight renamed this task from Mobils apps: Reference popup should support subreferences to Mobile apps: Reference popup should support subreferences.
awight updated the task description. (Show Details)

Change #1185256 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/services/mobileapps@master] Concatenate main and subref for preview

https://gerrit.wikimedia.org/r/1185256

Change #1186064 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/services/mobileapps@master] [refactor] Split collectRefText function

https://gerrit.wikimedia.org/r/1186064

Change #1186064 abandoned by Thiemo Kreuz (WMDE):

[mediawiki/services/mobileapps@master] [refactor] Split collectRefText function

Reason:

Merged as part of I7d90079. 🎉

https://gerrit.wikimedia.org/r/1186064

Change #1185256 abandoned by Thiemo Kreuz (WMDE):

[mediawiki/services/mobileapps@master] Concatenate main and subref for preview

Reason:

Merged as part of I7d90079. 🎉

https://gerrit.wikimedia.org/r/1185256