Jump to content

Topic on Talk:Talk pages project/Replying/Flow

Should be more like VE

11
RoySmith (talkcontribs)

This should act more like the Visual Editor used for articles. In other uses of VE (say, what I'm using now), if I type {{, it recognizes that I want to enter a template and opens the template editor tool. If I do that in the reply tool, I get the "Wikitext not allowed here". There should be a uniform VE UX across all uses of it.

Ferien (talkcontribs)

That'd be great. The talk page project is designed to help new editors reply. Greeting them with a "Wikitext not allowed here" message could just confuse them.

Frostly (talkcontribs)

Yeah, that'd be great.

Tol (talkcontribs)

Agreed. Interestingly, copy-pasting templates works perfectly fine (and you can then edit the template like in VE) — there's already the functionality to do this.

Matma Rex (talkcontribs)

Some templates break the list item syntax used for replying (* or :), and it is difficult to determine programatically which ones (templates like {{done}} are obviously okay, templates like infoboxes are obviously not okay, but there's a lot of grey area), so we opted to just discourage using templates until a multi-line list item syntax can be introduced to MediaWiki. Task T247421 has some context.

You can still use templates in wikitext mode (and we trust you not to do anything that messes up the syntax).

Pelagic (talkcontribs)

Despite the grey areas, would it be possible to look at TemplateData and infer that a template is safe if it has format: inline and no parameters with type: UnbalancedWikitext ?

Matma Rex (talkcontribs)

No, neither of those cause the problem with list syntax.

Problems occur when the wikitext output generated by the template contains line break characters, except if those line breaks introduce nested lists, or XML-style extension tags like <syntaxhighlight>, or tables in narrow circumstances (only valid if we're in a : list and at the start of a line).

The result is that part of the template (and your comment) is in the indented list item, and part of it (and your comment) is un-indented outside the list item, and this is not apparent in the visual editor until you save.

(You can have line breaks in the template transclusion though, so block format is fine. But I guess unbalanced wikitext can also cause various issue that are not apparent in the visual editor… I did not really think about that before, but we should keep it in mind in the future.)

I guess my explanation above was not great, the problem is not in determining whether the template will break the list syntax (we can just run it through the wikitext parser and look at the HTML that comes out) – it is in determining this before the user spends the effort to fill in the template (since we can't know whether template output will include a line break until we know the template parameters), and in explaining to the user why this particular template isn't allowed (without teaching them everything there is to know about line breaks in wikitext).

Sdkb (talkcontribs)

I came here to suggest this same thing. We use templates on talk pages all the time, often simple ones like {{Tq}} or {{Tl}}; having to switch tabs to do that rather than just typing brackets makes it a lot less convenient.

Pelagic (talkcontribs)

Thanks for the explanation, Matma Rex! I only really understood after I tried to reply...

I was thinking that some is better than none. (E.g. some common templates like {{tq}}, {{xt}}, {{Noping}} could be available.) Adding a dedicated "list-safe: yes" flag to TemplateData would be the "proper" way, but might not be well received.

I now see what you mean about "wikitext output generated by the template contains line break characters" rather than linebreaks in the pre-transcluded template code itself. I was (incorrectly) considering behaviour when editing, not rendering. You're right that parsing after entry is the only completely correct test, but is not a good user experience – I don't think we'd want that.

Parameters that normally allow or expect multi-line input could also be troublesome: short of adding special mode in the template helper that treats all unknown, string, or content fields as if they were line. (For example, with w:en:Template:Tq, I was able to enter a line break that was invisible in VE but present in classic source mode.)

I agree with your point that there's an unenviable choice between saying "no templates for you" versus "w e l l, this template isn't allowed but that one is, because reasons". So maybe it's not the case that "some is better than none".

I guess we just wait until there is a new multi-line syntax, or we stop using <dl><dd> for indenting threads. Sigh.

Pelagic (talkcontribs)

P.S. for anyone reading along or who finds this thread later, the task where {{ was disabled for Reply Tool is phab:T253667 "Visual mode lets you insert multi-line templates using the sequence `{{`".

Whatamidoing (WMF) (talkcontribs)

There's a draft of the technical RFC at User:PPelberg (WMF)/sandbox. I don't know when the Editing team will get back to this, but if you're interested in this problem, it'd be helpful to have a couple of people read that draft and tell me whether it makes sense to people who haven't been talking about this problem for the last couple of years.