Page MenuHomePhabricator

CharInsert: Split displayed text from inserted code
Closed, ResolvedPublicFeature

Description

As the title says, the displayed text for CharInsert should be splitted from the inserted code.
E.g.: "includeonly" inserts <includeonly></includeonly>

It would also be awesome if multirow text could be inserted like templates and tables.

See also

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:03 PM
bzimport added a project: CharInsert.
bzimport set Reference to bz23354.
bzimport added a subscriber: Unknown Object (MLST).

proppy wrote:

add custom label on charinsert

Attached:

proppy wrote:

Feel free to review this patch for inclusion in CharInsert extensions, it allows to customized the link label by passing a "label" argument to charinsert tag, example:

<charinsert label="foo">bar</charinsert>

proppy wrote:

Please tell me if it needs additional work.

proppy wrote:

add custom label on charinsert test case

Here is a test case that validated submitted patch behaviour.

Attached:

Sorry, had not time back then and now remembered this. The patch works fine (without the test case). Cheers!

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

How can I add line breaks using your patch? E.g. to insert

Healine

Text.

Another Headline

sumanah wrote:

Johan, I'm sorry for the wait. I'm marking this bug with "need-review" to signal to developers that there's code here awaiting review. Thank you for your patch and test case.

sumanah wrote:

Johan, does your patch still apply?

I recommend that you get a developer access account https://www.mediawiki.org/wiki/Developer_access so that you can commit your patches directly into the source control system in the future -- in fact, you could update and submit this patch, and get it reviewed faster. I'm sorry for the delay.

This was requested again [1] so I guess the patch never made it to the official repo.

[1] https://www.mediawiki.org/wiki/Thread:Extension_talk:CharInsert/attributes

@Kghbln Yeah that was me. I am almost begging for someone to make it an official repo. I don't understand PHP well enough to do any tweaking of this extension myself, so please would someone do this.

5 years later and it's still not possible to create a one word button for multi-line code. E.g.

<charinsert label="Infobox"><nowiki>{{Infobox&#10; |&#10;}}</nowiki></charinsert>

CharInsert.body.php

12a13,17
> 		
> 		
>         global $charInsertArgs;
>         $charInsertArgs = $params;
> 		
51c56,61
< 		if ( $eend == '' ) {
---
> 		
> 		global $charInsertArgs;
> 		
> 		if( isset($charInsertArgs["label"]) && $charInsertArgs["label"] != "" ) {
> 			$inline = $charInsertArgs["label"];
> 		} elseif ( $eend == '' ) {

@Subfader: To get this moving, you are very welcome to use developer access to submit the proposed code changes as a Git branch directly into Gerrit which makes it easier to review them quickly and provide feedback. If you don't want to set up Git/Gerrit, you can also use the Gerrit Patch Uploader. Thanks again!

@AlexeiKopylov : You can, or anybody else. See my previous comment. :)

I never done this, so I wonder if someone more familiar with the process can do it. It's not my code, and I don't know how to test it. Or is it OK to submit patch without testing? Also there are two patches above, I don't know which one is better.

After submitting to Gerrit, you could add a separate comment explicitly saying that it's untested

Change 748823 had a related patch set uploaded (by Tacsipacsi; author: Tacsipacsi):

[mediawiki/extensions/CharInsert@master] Allow overriding the link text

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

Tacsipacsi changed the subtype of this task from "Task" to "Feature Request".

Change 748823 merged by jenkins-bot:

[mediawiki/extensions/CharInsert@master] Allow overriding the link text

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

The display text can be overridden since January, multiline inserts are still not supported. Can we close this task, considering that the latter is specified as just a nice-to-have?

matmarex subscribed.

The display text can be overridden since January, multiline inserts are still not supported. Can we close this task, considering that the latter is specified as just a nice-to-have?

I think we could.

However! multiline inserts actually also seem to work for me. The example from this comment works:

5 years later and it's still not possible to create a one word button for multi-line code. E.g.

<charinsert label="Infobox"><nowiki>{{Infobox&#10; |&#10;}}</nowiki></charinsert>

(It seems that you need both the nowiki and the entities to escape it correctly, which is awkward, but it works.)

I don't know who or when fixed that, but this is definitely resolved.

Nice! I tried it with nowiki but unescaped newlines, and it didn’t work that way.