Thread:Project:Support desk/Too early HTML expansion of wiki code returned by if

When you use something like:



the  /   parser functions incorrectly assume that their return value will be the full content to expand to HTML, the result is: |Some text to display for the link as if it was:

It should be: Some text to display for the link as if it was:

So they expand the leading  as if it was at the start of a newline, and generate an indented block (definition list: dl+dd), truncating the leading character from the link to generate here, and in fact breaking it completely.

Here this breaks the intent to generate an inline link to a category, but this could as well be an inline interwiki link to another language, or to a file or image (not to render in a thumbnail), for which we need the leading  in the return value.

The same happens when the return value of  starts by   (definition list: dl+dt), or   (unordered bulleted list: ul+li), or   (ordered numbered list: ol+li).

So the  parser function should not expand its return value out of its context, when it does not really know if it will be at the start of a wiki line, only the caller may do this where it knows that it follows a newline, or the caller should give instruction hints to #if about its current context of transclusion (i.e. if it is immediately after a newline; oatherwise the expansion should remain pending in the wiki code buffer and returned unchanged as a prefix to the caller that will perform the wiki code concatenation and expansion only when appropriate).

This may be caused by  returning a spurious leading newline in its return value.

The bug does not affect the first parameter of  and , but it also affects the return value of  ,  , and possibly of some other functions returning some wiki text not intended to be used alone for generation of HTML...

Note that these tricks also do not work to generate the intended links:
 * same problem as above.
 * no link generated, the brackets and pipe remain in visible text (even if this disables the generation of the definition list).
 * same result.
 * no link generated, the brackets and pipe remain in visible text (even if this disables the generation of the definition list).
 * same result.
 * same result.