Page MenuHomePhabricator

VE: Allow commenting out and uncommenting of wikitext
Closed, ResolvedPublic1 Story Points

Description

Comments in wikitext are often used to hide content, that is not yet ready. Common examples include

<!--
== References ==
<references />
-->

for an article that doesn't have references yet, or content in another language that has to be translated yet, etc.

In source code you just add or remove the comment tags, but while VE does allow to work with comments, it is not possible to work with comments this way.

To make this possible in VE, the following should be implemented:

  • When you have something selected and then insert a comment, the selection should be converted to wikitext (HTML for core VE) and used as content of the comment. Currently it is just removed, the comment starts with empty content.
  • The flyout for comments should have a button "Uncomment" (or something similar), that will parse the content of the comment as wikitext and replace the comment with the result.

Event Timeline

Schnark created this task.Jan 7 2017, 9:27 AM
Restricted Application added a project: VisualEditor. · View Herald TranscriptJan 7 2017, 9:27 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Jdforrester-WMF closed this task as Declined.Jan 9 2017, 7:53 PM
Jdforrester-WMF added a subscriber: Jdforrester-WMF.

This (adding a button) seems like a really heavyweight and confusing addition for a very edge use case. Right now, you can:

  1. Select comment.
  2. Click edit.
  3. Select contents.
  4. Click out and delete the comment.
  5. Paste contents, have the wikitext auto-converted into HTML.

I think that's sufficient.

Schnark reopened this task as Open.Jan 10 2017, 8:58 AM

I think that's sufficient.

IMHO not. The content of the comment is not always recognized as wikitext (e.g. bold/italic syntax, HTML tags, etc.). If an additional button is bad, then at least the contents from a comment should always be recognized as wikitext on pasting by setting the type to text/x-wiki instead of relying on the heuristic to recognize wikitext.

Also the feature request to comment out existing content can be implemented without any additional button. (Yes, I should have created different tasks for these two things ...)

Change 331535 had a related patch set uploaded (by DLynch):
Override ui.CommentInspector so that copying from it sets text/x-wiki

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

DLynch added a subscriber: DLynch.Jan 10 2017, 9:15 PM

I liked the text/x-wiki idea, so I set that up. It takes a bit of infrastructure work, because text/x-wiki isn't currently one of our considered string types for paste, and certain hoops need to be jumped through to let VE core continue to think it's wiki-agnostic.

(This is, of course, limited to working in browsers which support custom clipboard mime types. Basically, not-IE, even Edge.)

Change 331535 merged by jenkins-bot:
Override ui.CommentInspector so that copying from it sets text/x-wiki

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

I think that's sufficient.

IMHO not. The content of the comment is not always recognized as wikitext (e.g. bold/italic syntax, HTML tags, etc.). If an additional button is bad, then at least the contents from a comment should always be recognized as wikitext on pasting by setting the type to text/x-wiki instead of relying on the heuristic to recognize wikitext.

That bit's now done; resolving.

Also the feature request to comment out existing content can be implemented without any additional button. (Yes, I should have created different tasks for these two things ...)

You can if you wish, but I'll probably decline it unless you can point to this kind of functionality anywhere else – WordPress, Google Docs, Drupal, Word, …

Jdforrester-WMF closed this task as Resolved.Jan 27 2017, 4:26 PM
Jdforrester-WMF triaged this task as Normal priority.
Jdforrester-WMF set the point value for this task to 1.
Jdforrester-WMF assigned this task to DLynch.
Jdforrester-WMF removed a project: Patch-For-Review.
Jdforrester-WMF moved this task from To Triage to TR1: Releases on the VisualEditor board.