Allow the user to add an arbitrary blob of wikitext while using the visual editor
Closed, ResolvedPublic0 Story Points

Description

Sometime, there is a piece of wikicode I get from elsewhere and want to add to the page.

More often than not, this comes in the form of pre-filled template: e.g., in hewiki we developed tools (in the form of bookmarklets) that generate external-link templates from popular sites (the user activate the bookmarklet on some on-line news site, and the tool generates the appropriate template for this site, with article name, author name, date etc. already filled).

Another example is the "coord" template: we created a bookmarklet that allows the users to generate pre-filled "coord" templates from Google Maps.

REQUESTED ACTION
Create a button/hotkey that will open a "enter wikicode" form. It's ok to require it to be legal wikicode and ask the parser to test it, and it's ok not to do so. The important thing is that it allows insertion of raw wikicode through VE, rather than requiring that I save and switch to the source code editor.

peace.

See Also:
T51686: VisualEditor: automagically convert wikitext (e.g. [[link]]) to VE-compatible elements

Details

Reference
bz51899
bzimport set Reference to bz51899.
Kipod created this task.Jul 23 2013, 6:27 PM

From a comment I posted on bug 49686:

The desire [for VE to understand wikimarkup] stems from people wanting the best of both worlds - they want to be able to have the structure and layout of the visual editor with the low-level control they are used to in the source editor all in one place.

Long term something like this really ought to be possible, but I don't think [VE automatically converting wikitext to visual elements at save or on the fly] is the way. Rather there should be some way for the visual editor to include non-visual blobs that it sends to the parser as is without doing anything to it (other than word wrapping in the editing window); and someway for the editor to mark the start and end of such blobs.

TTO added a comment.Jul 25 2013, 12:55 AM

This is already possible using the transclusion editor: instead of inserting a new template, insert a "content" section instead with your wikitext

But that workflow is not ideal - particularly because the VE doesn't convert the added wikitext to regular VE content on the fly - and it also seems a bit buggy from my quick tests.

Kipod added a comment.Jul 25 2013, 1:39 PM

(In reply to comment #1)

From a comment I posted on bug 49686:

The desire [for VE to understand wikimarkup] stems from people wanting the
best
of both worlds - they want to be able to have the structure and layout of the
visual editor with the low-level control they are used to in the source
editor
all in one place.

Long term something like this really ought to be possible, but I don't think
[VE automatically converting wikitext to visual elements at save or on the
fly]
is the way. Rather there should be some way for the visual editor to include
non-visual blobs that it sends to the parser as is without doing anything to
it
(other than word wrapping in the editing window); and someway for the editor
to
mark the start and end of such blobs.

i am not sure this is required. once you inject a blob, ve can "pretend" that it found it there when it originally opened the page for editing (i.e., do "unparse for the whole content, inject the blob into the right place in the "unparsed" page, and then "reparse", to integrate the blob into the page). marking the beginning and end of blob will not be necessary if this approach is taken. this may not be a cheap or quick operation, but it's much better to have an expensive "inject" than no inject at all, which basically force the user to use "edit source".

i never investigated what VE does exactly when the user uses Copy/Paste between two pages (i.e., open one page in VE, mark part of it, "Copy", open another page for editing, and "Paste"). maybe we can take a page from that book, no?.

peace.

The National Library of Australia provides Wikipedia citation wikicode in their digitised newspaper system.
http://trove.nla.gov.au/general/using-digitised-newspapers-faq/#using_cite

Vssun added a comment.Aug 12 2013, 1:31 AM

This tool is very much required.

Some use cases:

  • Copy-pasting some regularly used references (containing cite template)
  • Putting wiki signature

At present I am using a dummy template with subst for these purposes.

Does this request duplicate bug 43133 or 47742?

sorry bug 47742

Kipod added a comment.Aug 13 2013, 2:11 PM

(In reply to comment #6)

Does this request duplicate bug 43133 or 47742?

not really: as far as i was able to understand, those are about wikitext _editing_, while this one asks to be able to "inject" wikitext (usually something you obtained externally, either from some tool/app that generates wikitext, or via copy/paste etc.)

i believe it's significantly simpler to implement than either bug 43133 or bug 47742, and the use-case is different (much more limited).

peace.

Another request for this today on en.wp, this time from Rezonansowy

As mentioned several times, there are a number of major issues that this would cause; we'll have to investigate if they're things we can work around.

Neil_P._Quinn_WMF changed the title from "VisualEditor: Please add an "Add wikicode" tool" to "Allow the user to add an arbitrary blob of wikitext while using the visual editor".Jul 24 2015, 8:48 PM
Neil_P._Quinn_WMF edited the task description. (Show Details)
Neil_P._Quinn_WMF set Security to None.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 24 2015, 8:48 PM
cscott added a subscriber: cscott.Sep 21 2015, 8:13 PM

Copy-pasting a template invocation is fixed; that case is handled by T109449: Convert pasted fragments of basic wikitext into rich content.

I believe the plan for the rest of this use case is T49779: Provide a way for the user to switch between VisualEditor and wikitext source editor modes without saving, and this bug should be closed as a duplicate of that one.

Esanders closed this task as "Resolved".Feb 29 2016, 6:31 PM
Esanders added a subscriber: Esanders.

Both bugs mentioned above are resolved: pasted wikitext is converted automatically, and it is now possible to switch between the editors.

edsanders, the former may be true for some templates (like infoboxes AFAICT), and links, but it's not true for references or cite templates.
See also T107441.

Esanders added a comment.EditedMar 3 2016, 1:14 PM

Currently it only runs if it detects a pair of [[]],{{}} or == on a single line.

Elitre added a comment.Mar 3 2016, 2:53 PM

Cite templates are usually pretty long, even when they only provide basic info :/

Yeah we should file a bug for that. {{ is rare enough in normal text that we can match that on its own.

Jdforrester-WMF set the point value for this task to 0.Tue, May 10, 1:14 AM

Add Comment