Jump to content

Topic on Extension talk:Spoilers/Flow

Inline button instead separate paragraph

8
Ovvldc (talkcontribs)

I would like to use this extension on my own wiki, but I'd prefer to put the spoiler warning inline. Unfortunately, I am not a Javascript programmer. I tried changing the return part of spoilerMagicTag to

return $parser->insertStripItem( $output, $parser->mStripState );

as suggested in

Manual:Parser functions#Controlling the parsing of output

but this did not work and all of the output was still in separate paragraphs, including two lines that I was separating with a <br /> tag at first.

How do I keep the parser from adding <p></p> containers around every line of output? :(.

Thanks for any hints

Ovvldc (talkcontribs)

The adding of <p> and </p> to every line in the text also stops me from starting a spoiler area with lists (start with * and #) and indented lines (start with:). Not as flexible as I had hoped :(.

Ovvldc (talkcontribs)

Actually, the bug seems to be that the <spoiler> tag assumes to end at the end of the line in wiki-format, if you are in a list. So

<spoiler>text
*more text</spoiler>

will work, but

*text <spoiler>
:more text</spoiler>

does not.

Clump (talkcontribs)

That's an (unfortunate) consequence of how wikitext lists are constructed and the improper nesting of tags that results in the generated HTML.

Your first example works because the unordered list is properly and entirely within the spoiler tags, and the "*" indicating a list is at the start of the line.

Your non-working example fails because the unordered list, and first list item too, are opened outside the spoiler tag, but become closed inside it.

Ovvldc (talkcontribs)
Clump (talkcontribs)

I don't think that would be easy. The spoiler region is identified by wrapping it in a tag (actually a nest of tags), and it is hard to ensure that is properly nested when you have only indirect control over the list tag construction. I suppose you could use explicit list html syntax to give some manual control, such as:

<ul><li>text <spoiler>
:more text</spoiler></li><li>outer list continues</li></ul>

or

*text <spoiler><dl><dd>more text</dd></dl></spoiler>
*outer list continues
C.Ezra.M (talkcontribs)

Oh, that's a good idea. I will ask the good old Buoysel (talk | contribs) from PokéWiki to upload the extension to MediaWiki.org, but you can ask as well (in English or German; email-confirmed account required to edit pages there). I checked that on this special page that Buoysel is indeed the author of the extension. This doesn't work now, even with the right code because there is no specified JavaScript for this on this site.

Ovvldc (talkcontribs)

If there is a spoiler extension that can work through tags, I would be very interested :)

Reply to "Inline button instead separate paragraph"