Topic on Extension talk:CharInsert

Subfader (talkcontribs)

Previously (<=MW 1.25) we could add code that adds linebreaks on insert with &#13;.

E.g.

<charinsert label="Foo Bar"><nowiki>Foo&#13;Bar</charinsert></nowiki>

inserts

Foo
Bar

In MW 1.27.1 these are returned as �.

Quiddity (WMF) (talkcontribs)

Hmm, does this work?

#x0A; instead of #13;

(Note: I am not a dev. I just poked around on google a bit, and also noticed that roundtripping #13; in parsoid resulted in #x0A;...)

Subfader (talkcontribs)

Tried it before. It's also not working, but differently:

&#13;:

&#x0A; does the linebreak in the links (but we want them in the inserted text):

Can't you try on mediawiki.org?

<charinsert label="Foo Bar"><nowiki>Foo&#13;Bar</charinsert></nowiki>
Quiddity (WMF) (talkcontribs)

I assume you've tried a raw linebreak, too?

(I'm not comfortable with personally testing things on such a prominent interface element on mediawiki.org, and the CharInsert doesn't appear to be functional at Testwiki: or https://en.wikipedia.beta.wmflabs.org ... so I can't do testing there... :/ )

I'll try to find a dev to take a look...

Bawolff (talkcontribs)

&#x0a (newline) is much more correct than #13 (carriage return)

I cant really reproduce what you are describing. It sounds almost like you are running into doBlockLevels() (aka pre formatting when you start a line with a space). Can you paste the exact code you are using?

The syntax you are using is a bit odd. Nowiki is misnested, and you have a label attribute which isnt part of the extension...

As an aside you can test charinsert on any page during preview. You do not need to edit mediawiki ns to test.

Subfader (talkcontribs)
Bawolff (talkcontribs)

Try killing the space between the &#10; and the |:

<charinsert>{{Infobox&#10;|&#10;}}</charinsert>

Perhaps the extension should be changed so that charInsertHook() returns an array with first parameter the current return value and a 'markerType' => 'nowiki' parameter.

Subfader (talkcontribs)

Fixed it already using the labels, thanks.

Reply to "Insert linebreaks?"