Last modified: 2006-08-29 11:51:13 UTC
I inadvertently pasted a multi line title parameter into {{tl|cite web}} which caused the external link to not render correctly. A bit of discussion on http://en.wikipedia.org/wiki/Template_talk:Cite_web led to the discovery of the problem being exhibited by external links in general, rather than that template. To recreate, enter an external link with a multiline text portion. e.g: [http://www.example.com link to example dot com] It will render the url as a bare target link followed by the text (not linked) and both surrounded by the single square braces. Another way to look at it is that the multiline made external link square braces non special. The result is functional, but ugly. Example of problem is also on cited Template talk page. Mediawiki version: 1.8alpha (r16137)
This is currently intended behavior, not a bug. Links are HTML <a> elements, and so can contain HTML line breaks (<br>s), but not <p>s. MediaWiki generally ignores a lone line break, and converts any two consecutive line breaks into a <p>. Having a lone line break in an external link's display text would therefore do nothing, and having more would create illegal <p>s. The same applies to internal links. Of course, the rules could always be changed for links if desired, making any line break into an HTML <br> and suppressing normal linebreak rendering (the same could be done for literal <h#> and <p> tags). Is that what you want? It seems unlikely to break anything.
(In reply to comment #1) > This is currently intended behavior, not a bug. Links are HTML <a> elements, > and so can contain HTML line breaks (<br>s), but not <p>s. ... As I understand it, the request by Jed is not to produce a line break in the html output. He wants the parser to ignore the line break found in the wiki source in this case. This would allow for more editorial freeness on the level of the wiki source and maybe help editors making less buggy wiki pages, because it is a difficult to track down error (an error in the wiki-source for the respective page). Whitespace is ignored by the parser in other circumstances too, so it might well be perceieved as odd by editors to have a line break as a semantic effect, which it is at the moment.
In general, fewer linebreaks should be ignored, IMO, not more. Ignoring linebreaks is confusing.
(In reply to comment #3) The parser already ignores linebreaks for example inside template call {{..}}. Example for a valid template call: {{ cite web | title = No nonsence | url = http://example.com | accessdate = 2006-08-22 }} Ignoring whitespace is also done for ParserFunctions ("#if:" & Co). Where it is helpful for readable wiki-code. So, for people accustomed to that, significant newlines inside [[ ]] -- which is only significant in so far as it leads to stupid output -- is more confusing.
Comment #1 is confusing, perhaps I didn't explain clearly. We are talking about a single line break, although that shouldn't be relevant as the line break isn't in the URL, but rather in the text. <pre> The problem is the output of [http://www.example.com link to example dot com] is not <a HREF="http://www.example.com">link to example dot com</a> but rather it comes out [<a href="http://www.example.com">http://www.example.com</a>link to example dot com] Note the square braces and URL are still visible to the reader, which they should not be when text is supplied after a URL in single brace wiki text. Compare this cite web to comment #4 for another example {{ cite web | title = No nonsence | url = http://example.com | accessdate = 2006-08-22 }} </pre>
Wiki markup is line-based, and [url text] is not a multiline construct, but an inline one.
Inefficient workarounds for some cases are http://en.wikipedia.org/wiki/Template:Link, http://en.wikipedia.org/wiki/Template:Wikilink, which do make the parser happy by feeding everything on the same line.