Page MenuHomePhabricator

DiscussionTools doesn't work on featured article discussions on ko.wp
Open, MediumPublic


(originally reported here:위키백과:사랑방_(기술)/2020년_7월#Reply_tool_as_a_Beta_Feature)

DiscussionTools doesn't work on featured article discussions on ko.wp, e.g. on this page:위키백과:알찬_글_후보

Reply links appear, but the widget doesn't open, instead showing the error:

The "답변" link cannot be used to reply to this comment. To reply, please use the full page editor by clicking "원본 편집".

The reply links don't work because the subpages with discussions are transcluded using the template 알찬 글 토론 rather than directly (e.g. {{알찬 글 토론|로드 (가수)}} rather than {{위키백과:알찬 글 후보/로드 (가수)}}), in order to add the collapsible box around each discussion, so our tool isn't able to find the page where the comments are really written (and where the replies should be added).

We should investigate and see if we can add support for this case.

Ed: Example in English:

Hello world

The final page Test outputs Hello world:

<p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Discussion","href":"./Template:Discussion"},"params":{"1":{"wt":"Test"}},"i":0}}]}' id="mwAg">Hello world</p>

There is no mention of Discus/Test in the HTML output

HTML of the template page:

<p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":":Discus/{{{1}}}","href":"./Discus/"},"params":{},"i":0}}]}' id="mwAg">{{:Discus/{{{1}}}}}</p>

DiscussionTools needs to recurse into each transclusion level, one by one, in order to identify the "real" page holding a given reply or topic, but currently this only works when the transclusion does not have parameters. Although Parsoid generates mw:Param markup for parameters out in free text, there is no mw:Param markup in the mw:Transclusion above, just unparsed wikitext {{{1}}}.

Open questions

  • 1. Are there adjustments projects can make to the templates they are using to achieve the same result while also being compatible with how the Reply Tool currently works?

Event Timeline

Esanders updated the task description. (Show Details)

This is the 'nested data-mw' issue, where the outer template includes an inner template, but the data-mw for the inner template (which says which template *actually* got included). This is a case of T214241: data-mw info is clobbered by template annotations...

...but there's a second issue here, which is that generally speaking we strip parsoid markup in the inner templates, in order to avoid bloating the payload. So stripping the second level of indirection is "by design".

Here's a short parser test which demonstrates the issue, more or less:

!! article
!! text
This is the thing included:

{{ {{{1}}} }}
!! endarticle

!! test
Including an include
!! wikitext
{{Include|:Main Page}}
!! html/parsoid
<p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Include","href":"./Template:Include"},"params":{"1":{"wt":":Main Page"}},"i":0}}]}'>This is the thing included:</p>
<span> </span>
<p>blah blah</p>
!! end

Note that the Parsoid markup has lost all information about the fact that it is actually [[Main Page]] which is being included.

DiscussionTools currently does follow the chain of transclusions (up to ten deep) so if {{Foo}} is included it asks RESTBase for the parsoid HTML for Foo and then proceeds to work on that. But if the transclusion is {{Foo|Bar}} there's currently no way to ask RESTBase to render "Foo" with parameter "Bar", so there's no way to properly recurse.

Something like the following is present in the nested transclude:

<p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Discussion/{{{1}}}","href":"./Template:Discussion"},"i":0}}]}' id="mwAg">

So while it's pretty ugly, I think I'm suggesting that the short term strategy is to regexp-match parts[1] against {{{\d}}} and to substitute in the parameter (from the parts[1].template.params of the parent) in that case when DiscussionTools manually does the recursion.

The "proper" solution will be to add a params parameter to the RESTBase/ParserCache/Parsoid API to ask specifically for an expansion of [[Title]] with specific parameters X and Y etc. (Are X and Y specified in wikitext, HTML, ?) This would then get cached and bring us one step closer to our incremental parsing roadmap. But that's going to be a long term project to hammer out that API, especially given the state of flux of RESTBase/ParserCache, so the ugly approach above is probably best for now.

@Whatamidoing-WMF shared that her team hasn't found any templates they encounter regularly, asked village pump tech today and should have more information tomorrow. There has been a lot of innovation from that community.

@Whatamidoing-WMF shared that her team hasn't found any templates they encounter regularly, asked village pump tech today and should have more information tomorrow. There has been a lot of innovation from that community.

Sherry and I talked about this today. We have not yet received responses about this convention at's Village Pump Technical. [i]

Next, we'll reach out to to learn more about the convention.

From the Editing Team's perspective, we're going to wait on addressing this issue in software until we have evidence of the following:

  • The 알찬 글 토론 template is used widely at
  • The functionality the 알찬 글 토론 template achieves cannot be achieved in a way that is compatible with the Reply Tool.

Next steps

  • @Whatamidoing-WMF is going to ask volunteers at how widely this convention is used at and how it came to be used there.


AFAICT, from the end-user's perspective, this error, and the workaround, are the same as any page that uses open tags to create a colored background or other fancy formatting, e.g.,

Also, even if this technical problem were fixed, I think you still couldn't use the Reply tool, because you can't edit sections with {{collapse top}} and {{collapse bottom}} around them anyway.

That's a slightly different case, this one should be somewhat easier to solve, since the comments are written on a separate page without wrapper templates like that.

ppelberg removed a project: Editing-team (Tracking).

Next steps

  • @Whatamidoing-WMF is going to ask volunteers at how widely this convention is used at and how it came to be used there.

@Whatamidoing-WMF reached out to volunteers at [i]. We determined this is not high priority at this time.


Similar situation where a discussion page is transcluded using a template:ão:Feudalismo

Similar problem affects the comments sections of English Wikipedia's The Signpost, such as this one: (in this case the discussion is transcluded from the talk page: