Page MenuHomePhabricator

Wrong section segmentation causes infobox presented as table
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

Translate the article Meg Johnson from English to Spanish(or any other language). Click on the infbox to translate.

What happens?:

image.png (760×1 px, 111 KB)

Infobox is presented as a table

What should have happened instead?:

Infobox should have presented as a template instead of table

Event Timeline

As per https://cxserver.wikimedia.org/v2/page/en/es/Meg%20Johnson the sections are split as follows.

<section data-mw-section-number="0" id="cxSourceSection0" rel="cx:Section">
    <style about="#mwt1" data-mw="{&#34;parts&#34;:[{&#34;template&#34;:{&#34;target&#34;:{&#34;wt&#34;:&#34;About&#34;,&#34;href&#34;:&#34;./Template:About&#34;},&#34;params&#34;:{&#34;1&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;2&#34;:{&#34;wt&#34;:&#34;the English actress&#34;},&#34;3&#34;:{&#34;wt&#34;:&#34;Meg Johnson (actress)&#34;},&#34;4&#34;:{&#34;wt&#34;:&#34;other uses&#34;}},&#34;i&#34;:0}}]}" data-mw-deduplicate="TemplateStyles:r1033289096" id="mwAg" typeof="mw:Extension/templatestyles mw:Transclusion">.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}</style> 
    <style about="#mwt5" data-mw="{&#34;parts&#34;:[{&#34;template&#34;:{&#34;target&#34;:{&#34;wt&#34;:&#34;Infobox writer\\n&#34;,&#34;href&#34;:&#34;./Template:Infobox_writer&#34;},&#34;params&#34;:{&#34;name&#34;:{&#34;wt&#34;:&#34;Meg Johnson&#34;},&#34;image&#34;:{&#34;wt&#34;:&#34;File:Meg Johnson profile shot.png&#34;},&#34;image_size&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;alt&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;caption&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;birth_name&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;birth_date&#34;:{&#34;wt&#34;:&#34;&#60;!-- {{birth date and age|YYYY|MM|DD}} --&#62;&#34;},&#34;birth_place&#34;:{&#34;wt&#34;:&#34;[[Ames, Iowa|Ames]], [[Iowa]]&#34;},&#34;death_date&#34;:{&#34;wt&#34;:&#34;&#60;!-- {{death date and age|YYYY|MM|DD|YYYY|MM|DD}} --&#62;&#34;},&#34;death_place&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;resting_place&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;occupation&#34;:{&#34;wt&#34;:&#34;{{flat list |\\n* [[Poet]]\\n* [[Lecturer]]\\n}}&#34;},&#34;language&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;nationality&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;ethnicity&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;citizenship&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;education&#34;:{&#34;wt&#34;:&#34;[[Master of Fine Arts|MFA]] in [[Creative Writing]]&#34;},&#34;alma_mater&#34;:{&#34;wt&#34;:&#34;[[University of Akron]]&#34;},&#34;period&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;genre&#34;:{&#34;wt&#34;:&#34;[[Poetry]]&#34;},&#34;subject&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;movement&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;notableworks&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;spouse&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;partner&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;children&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;relatives&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;awards&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;signature&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;signature_alt&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;years_active&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;website&#34;:{&#34;wt&#34;:&#34;{{URL|megjohnson.org}}&#34;}},&#34;i&#34;:0}}]}" data-mw-deduplicate="TemplateStyles:r1063604326" id="mwBg" typeof="mw:Extension/templatestyles mw:Transclusion">.mw-parser-output .infobox-subbox{padding:0;border:none;margin:-3px;width:auto;min-width:100%;font-size:100%;clear:none;float:none;background-color:transparent}.mw-parser-output .infobox-3cols-child{margin:auto}.mw-parser-output .infobox .navbar{font-size:100%}</style>
</section>
<section data-mw-section-number="0" id="cxSourceSection1" rel="cx:Section">
    <table about="#mwt5" class="infobox vcard" id="mwBw"><tbody id="4"><tr id="5"><th class="infobox-above" colspan="2" id="6\ ...
</section

This is wrong because the style with about="mwt5" should be grouped the table below as they are single template. Template definition going to wrong section causes the table to treated as just table.

https://gerrit.wikimedia.org/r/c/mediawiki/services/cxserver/+/751926 fixes it by removing the dangling About template.

However, to make the solution future proof, this issue need better defence in section wrapping algorithm

Change 751926 had a related patch set uploaded (by Santhosh; author: Santhosh):

[mediawiki/services/cxserver@master] Add Template:About to the removable sections

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

The root cause is a bug in the "removable tags" logic. Consider the following example. Imagine we have configured class hatnote as removable. Our parser will surely remove it. but it is connected to the previous element having same about attribute. But our parser is a linear, forward only parser, we cannot go back and remove it. Unless we do a second parsing(that is bad for many reasons). This results orphan fragment.

<section>
<style about="#mwt1" data-mw="{&#34;parts&#34;:[{&#34;template&#34;:{&#34;target&#34;:{&#34;wt&#34;:&#34;About&#34;,&#34;href&#34;:&#34;./Template:About&#34;},&#34;params&#34;:{&#34;1&#34;:{&#34;wt&#34;:&#34;&#34;},&#34;2&#34;:{&#34;wt&#34;:&#34;the English actress&#34;},&#34;3&#34;:{&#34;wt&#34;:&#34;Meg Johnson (actress)&#34;},&#34;4&#34;:{&#34;wt&#34;:&#34;other uses&#34;}},&#34;i&#34;:0}}]}" data-mw-deduplicate="TemplateStyles:r1033289096" id="mwAg" typeof="mw:Extension/templatestyles mw:Transclusion">.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}</style>
<div role="note" class="hatnote navigation-not-searchable" about="#mwt1" id="mwBQ">For the English actress, see <a rel="mw:WikiLink" href="./Meg_Johnson_(actress)" title="Meg Johnson (actress)">Meg Johnson (actress)</a>. For other uses, see <a rel="mw:WikiLink" href="./Meg_Johnson_(disambiguation)" title="Meg Johnson (disambiguation)" class="mw-disambig">Meg Johnson (disambiguation)</a>.</div>

Change 751926 merged by KartikMistry:

[mediawiki/services/cxserver@master] Add Template:About to the removable sections

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

Change 751547 had a related patch set uploaded (by KartikMistry; author: KartikMistry):

[operations/deployment-charts@master] Deploy Flores MT

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

Tried with both Spanish and Malayalam as target languages and got an "automatic translation failed" message with the infobox not being added to the translation:

Screenshot 2022-01-21 at 11.15.35 2.png (829×1 px, 207 KB)

Pginer-WMF changed the task status from Open to In Progress.Jan 21 2022, 11:40 AM

Change 751547 merged by jenkins-bot:

[operations/deployment-charts@master] Deploy Flores MT

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

Tried with both Spanish and Malayalam as target languages and got an "automatic translation failed" message with the infobox not being added to the translation:

This fix was deployed only on Feb 1st.
The template here is Infobox writer. It is not available in es. Wrongly linked to a different template in ml. But correct linking to existing templates are available for languages like eo, fr, simple

image.png (815×1 px, 225 KB)

Tried with both Spanish and Malayalam as target languages and got an "automatic translation failed" message with the infobox not being added to the translation:

This fix was deployed only on Feb 1st.
The template here is Infobox writer. It is not available in es. Wrongly linked to a different template in ml. But correct linking to existing templates are available for languages like eo, fr, simple

Thanks for the clarification. The adaptation works as expected for Esperanto. Interestingly, for Spanish a template was added despite not being available in Spanish. I created a separate bug for it: T301322: Wrong template added for a template not available in the target language

Screenshot 2022-02-09 at 09.31.55 2.png (668×1 px, 233 KB)