How can you replace a newline with a line break? I tried {{#replace:{{{1}}}|\n|<br />}} but it doesn't seem to be picking up the '\n' at all. Is there a way, or even a workaround?
Waseem Sayegh wrote:
How can you replace a newline with a line break? I tried {{#replace:{{{1}}}|\n|<br />}} but it doesn't seem to be picking up the '\n' at all. Is there a way, or even a workaround?
\n are the characters '' and 'n'. To pass a newline as a parameter, you'd write a newline: {{#replace:{{{1}}}| |<br />}}
But you could as well introduce a couple of new lines in the text wherever you want to produce a new paragraph.
{{#replace:{{{1}}}|<nowiki> </nowiki>|<br />}}
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]
Platonides wrote:
Waseem Sayegh wrote:
How can you replace a newline with a line break? I tried {{#replace:{{{1}}}|\n|<br />}} but it doesn't seem to be picking up the '\n' at all. Is there a way, or even a workaround?
\n are the characters '' and 'n'. To pass a newline as a parameter, you'd write a newline: {{#replace:{{{1}}}| |<br />}}
But you could as well introduce a couple of new lines in the text wherever you want to produce a new paragraph.
I have also tried {{#replace:{{{1}}}| |<br />}}
Though this code ends up replacing "spaces" with <br />.
Any other suggestions? Thanks.
Hi,
2009/8/26 Waseem Sayegh wsayegh@gmail.com:
I have also tried {{#replace:{{{1}}}| |<br />}}
Though this code ends up replacing "spaces" with <br />.
Perhaps the reply from platonides got mangled in your email reader, but he advised you to try it with an actual newline in the code (put the second | character on a new line).
Platonides said:
\n are the characters '' and 'n'. To pass a newline as a parameter, you'd write a newline: {{#replace:{{{1}}}| |<br />}}
What are you trying to accomplish with these replacements? You might be able to get the same effect by making the padding between paragraphs less or something.
-----Original Message----- From: mediawiki-l-bounces@lists.wikimedia.org [mailto:mediawiki-l-bounces@lists.wikimedia.org] On Behalf Of Waseem Sayegh Sent: Wednesday, August 26, 2009 8:24 AM To: mediawiki-l@lists.wikimedia.org Subject: Re: [Mediawiki-l] Replacing Newline
I have also tried {{#replace:{{{1}}}| |<br />}}
Though this code ends up replacing "spaces" with <br />.
Any other suggestions? Thanks. _______________________________________________ MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Thanks for your suggestions. I found an extension called Poem, that does exactly what I was looking for. I'll be using it instead of replace.
On Wed, Aug 26, 2009 at 8:23 AM, Waseem Sayegh wsayegh@gmail.com wrote:
I have also tried {{#replace:{{{1}}}| |<br />}}
Though this code ends up replacing "spaces" with <br />.
Any other suggestions? Thanks.
Waseem etal,
I would like to modify Extension:StringFunctions to allow this.
This requested functionalit is useful in making it easier for users to edit/create information in infoblocks without having to remember to put in <br>
The end result would allow display (in a template) by using the extended parser function "replace"
Example:
{{#replace:{{{Input String}}}|\n|<br>}}
Details on how this would be done are at:
http://www.mediawiki.org/wiki/Extension_talk:StringFunctions#re:_Replacing_N ew_Lines.2C_Line_Breaks
Jack
-----Original Message----- From: mediawiki-l-bounces@lists.wikimedia.org [mailto:mediawiki-l-bounces@lists.wikimedia.org] On Behalf Of Waseem Sayegh Sent: Tuesday, August 25, 2009 8:15 AM To: mediawiki-l@lists.wikimedia.org Subject: [Mediawiki-l] Replacing Newline
How can you replace a newline with a line break? I tried {{#replace:{{{1}}}|\n|<br />}} but it doesn't seem to be picking up the '\n' at all. Is there a way, or even a workaround? _______________________________________________ MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Hi,
2009/8/31 Jack D. Pond jack.pond@psitex.com:
Waseem etal,
I would like to modify Extension:StringFunctions to allow this.
This requested functionalit is useful in making it easier for users to edit/create information in infoblocks without having to remember to put in
<br>
I may be dense, but why do you need this in mediawiki? Using two newlines results in a new paragraph when rendering; using a single newline collapses the text into a single paragraph AFAIK.
The following wiki text: -------- this is line 1 this is line 2
this is line 3 (extra newline) this is line 4
this is line 5 (two extra newlines) this is line 6 --------
renders as ------- <p>this is line 1 this is line 2 </p><p>this is line 3 (extra newline) this is line 4 </p><p><br /> this is line 5 (two extra newlines) this is line 6 </p> -------
Extra newline also means extra line in output. More importantly, if a user fills in either in infoblock or a textbox, they have to put the second newline in - teaching the users to do this is as counterintuitive as teaching them to put an html break (<br>).
However, escaping the escape (e.g., "\" instead of "") can be difficult too - but usually not an issue for those who would actually put one in - and the <nowiki> mechanism is already widely used for this.
Jack
-----Original Message----- From: mediawiki-l-bounces@lists.wikimedia.org [mailto:mediawiki-l-bounces@lists.wikimedia.org] On Behalf Of Jean-Marc van Leerdam Sent: Monday, August 31, 2009 4:39 PM To: MediaWiki announcements and site admin list Subject: Re: [Mediawiki-l] Replacing Newline using Extension:StringFunctions
Hi,
2009/8/31 Jack D. Pond jack.pond@psitex.com:
Waseem etal,
I would like to modify Extension:StringFunctions to allow this.
This requested functionalit is useful in making it easier
for users to
edit/create information in infoblocks without having to remember to put in <br>
I may be dense, but why do you need this in mediawiki? Using two newlines results in a new paragraph when rendering; using a single newline collapses the text into a single paragraph AFAIK.
The following wiki text:
this is line 1 this is line 2
this is line 3 (extra newline) this is line 4
this is line 5 (two extra newlines) this is line 6
renders as
<p>this is line 1 this is line 2 </p><p>this is line 3 (extra newline) this is line 4 </p><p><br /> this is line 5 (two extra newlines) this is line 6 </p> -------
-- Regards,
Jean-Marc
. ___ . @@ // \ "De Chelonian Mobile" . (_,/ _/ \ TortoiseSVN . \ _/__/> The coolest Interface to (Sub)Version Control . /_/ _\ http://tortoisesvn.net
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Hi Jack,
I'm not sure if I really understand the wherefor and why but the break in mediawiki is <br> not <br>.
Perhaps you could make an extra button to insert <br/>?
Greetings Katharina
Jack D. Pond schrieb am 01.09.2009 00:44:
Extra newline also means extra line in output. More importantly, if a user fills in either in infoblock or a textbox, they have to put the second newline in - teaching the users to do this is as counterintuitive as teaching them to put an html break (<br>).
However, escaping the escape (e.g., "\" instead of "") can be difficult too - but usually not an issue for those who would actually put one in - and the <nowiki> mechanism is already widely used for this.
Jack
-----Original Message----- From: mediawiki-l-bounces@lists.wikimedia.org [mailto:mediawiki-l-bounces@lists.wikimedia.org] On Behalf Of Jean-Marc van Leerdam Sent: Monday, August 31, 2009 4:39 PM To: MediaWiki announcements and site admin list Subject: Re: [Mediawiki-l] Replacing Newline using Extension:StringFunctions
Hi,
2009/8/31 Jack D. Pond jack.pond@psitex.com:
Waseem etal,
I would like to modify Extension:StringFunctions to allow this.
This requested functionalit is useful in making it easier
for users to
edit/create information in infoblocks without having to remember to put in <br>
I may be dense, but why do you need this in mediawiki? Using two newlines results in a new paragraph when rendering; using a single newline collapses the text into a single paragraph AFAIK.
The following wiki text:
this is line 1 this is line 2
this is line 3 (extra newline) this is line 4
this is line 5 (two extra newlines) this is line 6
renders as
<p>this is line 1 this is line 2 </p><p>this is line 3 (extra newline) this is line 4 </p><p><br /> this is line 5 (two extra newlines) this is line 6 </p> -------
Katharina Wolkwitz wrote:
Hi Jack,
I'm not sure if I really understand the wherefor and why but the break in mediawiki is <br> not <br>.
Perhaps you could make an extra button to insert <br/>?
Greetings Katharina
You break paragraphs in MediaWiki using *two* line breaks. <br /> or <br> force a line break just as it does in html, but you /shouldn't/ need it.
<br> is inserted by FCKEditor (which I guess many are using in their Wikis). Personally, I find these all over the place in oursi - and it irritaes me (even in level heading, and tables etc)
Jon.
"Platonides" Platonides@gmail.com Sent by: mediawiki-l-bounces@lists.wikimedia.org 01-Sep-2009 10:58 Please respond to "MediaWiki announcements and site admin list" mediawiki-l@lists.wikimedia.org
To mediawiki-l@lists.wikimedia.org cc
Subject Re: [Mediawiki-l] Replacing Newline using Extension:StringFunctions
Katharina Wolkwitz wrote:
Hi Jack,
I'm not sure if I really understand the wherefor and why but the break
in
mediawiki is <br> not <br>.
Perhaps you could make an extra button to insert <br/>?
Greetings Katharina
You break paragraphs in MediaWiki using *two* line breaks. <br /> or <br> force a line break just as it does in html, but you /shouldn't/ need it.
_______________________________________________ MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
----------------------------------------------------------- This e-mail was sent by GlaxoSmithKline Services Unlimited (registered in England and Wales No. 1047315), which is a member of the GlaxoSmithKline group of companies. The registered address of GlaxoSmithKline Services Unlimited is 980 Great West Road, Brentford, Middlesex TW8 9GS. -----------------------------------------------------------
I think part of the point of usability with a wiki is to reduce user complexity, not to increase it. Silly rules like adding a <br> or using two line feeds (which sometimes shows up as two line feeds), run contrary to that concept.
After seeing many responses (thank you all for the input), I've come to the conclusion that this is best implemented by creating a new extension, which I'm going to call ExtendedStringFunctions.
This will allow escaping characters (such as newline and others) and will be invoked with an extra "e" at the end of the parser function:
Example:
{{#replacee:{{{Input String}}}|\n|<br>}}
This way, the existing users of StringFunctions will not find their stuff unexpectedly escaped, and those who wish to do replacements and escaping can do so with the extended functions.
Again, thanks for all the input!
Jack
-----Original Message----- From: mediawiki-l-bounces@lists.wikimedia.org [mailto:mediawiki-l-bounces@lists.wikimedia.org] On Behalf Of Jon.G.Bartlett@gsk.com Sent: Tuesday, September 01, 2009 6:13 AM To: MediaWiki announcements and site admin list Subject: Re: [Mediawiki-l] Replacing Newline using Extension:StringFunctions
<br> is inserted by FCKEditor (which I guess many are using in their Wikis). Personally, I find these all over the place in oursi - and it irritaes me (even in level heading, and tables etc)
Jon.
"Platonides" Platonides@gmail.com Sent by: mediawiki-l-bounces@lists.wikimedia.org 01-Sep-2009 10:58 Please respond to "MediaWiki announcements and site admin list" mediawiki-l@lists.wikimedia.org
To mediawiki-l@lists.wikimedia.org cc
Subject Re: [Mediawiki-l] Replacing Newline using Extension:StringFunctions
Katharina Wolkwitz wrote:
Hi Jack,
I'm not sure if I really understand the wherefor and why
but the break in
mediawiki is <br> not <br>.
Perhaps you could make an extra button to insert <br/>?
Greetings Katharina
You break paragraphs in MediaWiki using *two* line breaks. <br /> or <br> force a line break just as it does in html, but you /shouldn't/ need it.
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
This e-mail was sent by GlaxoSmithKline Services Unlimited (registered in England and Wales No. 1047315), which is a member of the GlaxoSmithKline group of companies. The registered address of GlaxoSmithKline Services Unlimited is 980 Great West Road, Brentford, Middlesex TW8 9GS.
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org