Is there any way we can default to having the body of the link not be
passed as html? It's called $html, well documented that it's raw html, and
I've lost track of the number of times people pass unsanitized text to it.
I'd rather it not be something developers have to worry about, unless they
know they need to handle the sanitization themselves. Maybe typehint a
Message object, and people can add raw params if they really need to send
it raw html?

On Sun, May 15, 2016 at 4:28 PM, Legoktm <[email protected]>
wrote:

> Hi,
>
> For the past few weeks I've been working[1] on rewriting Linker::link()
> to be non-static, use LinkTarget/TitleValue and some of the other fancy
> new services stuff. Yay!
>
> For the most part, you'd use it in similar ways:
>  Linker::link( $title, $html, $attribs, $query );
> is now:
>  $linkRenderer = MediaWikiServices::getInstance()
>    ->getHtmlPageLinkRenderer();
>  $linkRenderer->makeLink( $title, $html, $attribs, $query );
>
> And there are makeKnownLink() and makeBrokenLink() entry points as well.
>
> Unlike Linker::link(), there is no $options parameter to pass in every
> time a link needs to be made. Those options are set on the
> HtmlPageLinkRenderer instance, and then applied to all links made using
> it. MediaWikiServices has an instance using the default settings, but
> other classes like Parser will have their own that should be used[2].
>
> I'm also deprecating the two hooks called by Linker::link(), LinkBegin
> and LinkEnd. They are being replaced by the mostly-equivalent
> HtmlPageLinkRendererBegin and HtmlPageLinkRendererEnd hooks. More
> details are in the commit message. [3] is an example conversion for
> Wikibase.
>
> The commit is still a WIP because I haven't gotten around to writing
> specific tests for it (it passes all the pre-existing Linker and parser
> tests though!), and will be doing that in the next few days.
>
> Regardless, reviews / comments / feedback on [1] is appreciated!
>
> [1] https://gerrit.wikimedia.org/r/#/c/284750/
> [2] https://gerrit.wikimedia.org/r/#/c/288572/
> [3] https://gerrit.wikimedia.org/r/#/c/288674/
>
> -- Legoktm
>
> _______________________________________________
> Wikitech-l mailing list
> [email protected]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to