Page MenuHomePhabricator

Allow the user to add an arbitrary blob of wikitext while using the visual editor
Closed, ResolvedPublic0 Estimated 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

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 22 2014, 2:04 AM
bzimport set Reference to bz51899.

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.

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.

(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

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?

(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.

nshahquinn-wmf renamed this task 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
nshahquinn-wmf updated the task description. (Show Details)
nshahquinn-wmf set Security to None.

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 subscribed.

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.

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

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.