Page MenuHomePhabricator

[MEX] avoid or remove <p> wrapper around statement values
Closed, ResolvedPublic

Description

In T401901, we found that VueJsTemplating\HtmlParser::parseHtml (source in github) takes a string value and wraps it in a <p> *only if* it does not start with an html tag. This causes inconsistency in the final rendered HTML for statements, and has caused us to add some stylistic hacks in CSS/LESS to get <a> and <p> tags to behave similarly in their spacing and relationship to other elements.

For example, an entity type snak value looks like this:

<div class="wikibase-wbui2025-snak-value" data-snak-hash="cd2c5132f5528b694b71575ae6a56587185893d0">
    <a title="Item:Q52" href="/wiki/Item:Q52">Entity Label</a>
</div>

and a string datatype looks like this:

<div class="wikibase-wbui2025-snak-value" data-snak-hash="1a4dc5949ca21bec92999952a7204995d21d35f2">
    <p>some simple text ends up in a paragraph</p>
</div>

We should update php-vuejs-templating to stop wrapping *some* values in <p> tags, so that we get predictable and consistent html. In other words, we should get html in the exact structure that was given to the parser.

Acceptance Criteria

  • statements of all* datatypes are rendered according to the output of the relevant formatter and are not wrapped in a <p>.

*except the Globe Coordinates type, which gets its problematic <p> from the parser in core, and gets its html transformed into an even less valid state via Kartographer's frontend code (T401606)

Details

Event Timeline

Change #1180914 had a related patch set uploaded (by Audrey Penven; author: Audrey Penven):

[mediawiki/vendor@master] Bump wmde/php-vuejs-templating to 2.2.0-beta.8

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

Change #1180914 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wmde/php-vuejs-templating to 2.2.0-beta.8

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