Page MenuHomePhabricator

Save edited main reference content back to inline main+details
Open, Needs TriagePublic

Description

User story:

As VE user I want to be able to correctly see and save sub-refs when main and details content are part of one reference tag.

Background:

This task is about wiring the edited main ref back into a main+details ref where it came from. Currently, editing a main ref (adding text "NEW") will save it in list-defined references:

image.png (239×1 px, 29 KB)

Acceptance criteria:

Assume Wikitext like:

<ref name="main-ref" details="p. 123">Old main text</ref>

After editing either the main or the details content it should result in Wikitext like

<ref name="main-ref" details="p. 123">New main text</ref>

Event Timeline

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

[mediawiki/extensions/Cite@master] [WIP] Exploring why wrong main content is used

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

Change #1131261 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/Cite@master] Fix id of the main body element

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

I'll move this back for now but here some things I found:

  • refs will only be processed in the conversion to Wikitext when they have been touched. So when you edit the main in VE but not the sub then the later will not be processed by Parsoid it seems.
  • In RefTagHandler::domToWikitext() the doc you get from $extApi->getTopLevelDoc() does not include the whole doc in the body. But you will find all the data you need in the DataBag that can be retrieved with DOMDataUtils::getBag(doc)
awight renamed this task from Save edited, inline main reference content back to main+details to Save edited main reference content back to main+details.Wed, Apr 2, 9:40 AM
awight updated the task description. (Show Details)

The following document can be safely edited in VE, both the subref and main ref:

<ref name="book">The book</ref>
<ref details="p. 123" name="book" />

It's possible that this task was actually caused by issues with T387847: Parsoid handles subref coming before its main ref, I'm merging as a duplicate.

The following document can be safely edited in VE, both the subref and main ref:

<ref name="book">The book</ref>
<ref details="p. 123" name="book" />

It's possible that this task was actually caused by issues with T387847: Parsoid handles subref coming before its main ref, I'm merging as a duplicate.

It's not working for wikitext like

<ref name="main-ref" details="p. 123">Old main text</ref>

There I get

<ref name="main-ref" details="p. 123">Old main text</ref>
<references>
<ref name="main-ref">New main text</ref></references>

After saving.

Change #1131261 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Fix id of the main body element

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

WMDE-Fisch renamed this task from Save edited main reference content back to main+details to Save edited main reference content back to inline main+details.Mon, Apr 7, 1:02 PM
WMDE-Fisch edited projects, added Story; removed Patch-For-Review.
WMDE-Fisch updated the task description. (Show Details)