Lucas_Werkmeister_WMDE added a comment.
> I suppose that depends on how much difference there is between API error
messages and what you're wanting to do with comments.
As far as I’m aware, both Wikibase and WikibaseSchema really don’t want to do
much actual formatting. They want parts that look like autocomments but aren’t
linked to sections; they want wikilinks; and they want parts that aren’t
subject to any formatting at all. If we strip all HTML tags without replacement
and just keep the text content, turning
<span dir="auto"><span class="autocomment">Changed claim: </span></span> <a
href="/wiki/Property:P119" title="place of burial | location of grave,
resting place, place of ash-scattering, etc, (e.g. town/city or cemetery) for a
person or animal. There may be several places: e.g. re-burials, cenotaphs,
parts of body buried separately."><span class="wb-itemlink"><span
class="wb-itemlink-label" dir="ltr" lang="en">place of burial</span> <span
class="wb-itemlink-id">(P119)</span></span></a>: <a href="/wiki/Q533697"
title="Highgate Cemetery | place of burial in north London, England"><span
class="wb-itemlink"><span class="wb-itemlink-label" dir="ltr"
lang="en">Highgate Cemetery</span> <span
class="wb-itemlink-id">(Q533697)</span></span></a>
into
Changed claim: place of burial (P119): Highgate Cemetery (Q533697)
that’s already a decent plain-text representation of the comment that also
works well enough when interpreted as comment text. (`/* Changed claim: */ …`
would also work.)
We could say that a `CommentStoreComment` created from a `Message` generates
the “best-effort text representation” by applying the following transformations:
- replace `/*` and `[[` with `/█*` and `[█[` in plaintext message arguments,
where `█` stands for some invisible Unicode character
- take the message `->text()`
- strip all HTML tags from the result (`Sanitizer::stripAllTags()`)
Since this doesn’t parse the message, for a typical Wikibase summary the
result might look like this:
Changed claim: [[Property:P119]]: [[Q533697]]
And coming back to @daniel’s idea, if an extension isn’t satisfied with that
it can still override the `CommentStoreComment`’s `->text` with an even better
representation. (Though I think we wouldn’t actually do this in Wikibase.)
TASK DETAIL
https://phabricator.wikimedia.org/T218127
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Lucas_Werkmeister_WMDE
Cc: WMDE-leszek, hoo, Aklapper, Lucas_Werkmeister_WMDE, Anomie, daniel,
pdehaye, alaa_wmde, Michael, Nandana, Lahi, Gq86, GoranSMilovanovic, QZanden,
YULdigitalpreservation, LawExplorer, Salgo60, _jensen, rosalieper, MGChecker,
abian, Wikidata-bugs, aude, Dinoguy1000, Lydia_Pintscher, Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs