I can't figure this one out and I am hoping that someone out there and can help me with this.
I have a template called BoxFile that will but the contents into it's own window. Here is the template.
{| width="95%" border="0" cellpadding="0" align="center" | style="background:#FFDEAD;" | <font size="-1"
http://www.hoganzoo.com/icons/file-text.png File:
'''{{{1}}}'''</font> |- | style="border: 1px dashed #C8C8DA;" | <div style="overflow: auto; max-height: 35em;"> <p style="white-space: pre; font-family: monospace;"><font size="-1">{{{2}}}</font></p> </div> |}
Now, the problem that I am having is when I go to a wiki page and use this template like so;
{{BoxFile|/home/testfile|<nowiki>line1 line2 line3 </nowiki>}}
the wiki page correctly displays a box with three lines in it. But when I highlight those three lines, copy them, and then paste them somewhere else, like a terminal window or notepad screen I get;
line1line2line3
What happened to the line breaks????
Thanks for any help on this.
Tim
Tim Hogan wrote:
{| width="95%" border="0" cellpadding="0" align="center" | style="background:#FFDEAD;" | <font size="-1">
I can't help but comment on your using two different ways of specifying style. You should probably just use style="..." to be consistent and avoid any deprecated or out-of-favour stuff.
<nowiki>line1 line2 line3 </nowiki>}}
This is the same as
<nowiki>line1line2line3</nowiki>
There are no line breaks. If you want line breaks, you have to put them in explicitly.
Mike
Mike,
I see what you mean about the nowiki stripping out the line feeds. Any idea on how you display a piece of source code for example and may have characters that could be interpreted as wiki text?
Tim
Michael Daly wrote:
Tim Hogan wrote:
{| width="95%" border="0" cellpadding="0" align="center" | style="background:#FFDEAD;" | <font size="-1">
I can't help but comment on your using two different ways of specifying style. You should probably just use style="..." to be consistent and avoid any deprecated or out-of-favour stuff.
<nowiki>line1 line2 line3 </nowiki>}}
This is the same as
<nowiki>line1line2line3</nowiki>
There are no line breaks. If you want line breaks, you have to put them in explicitly.
Mike
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Tim Hogan wrote:
Mike,
I see what you mean about the nowiki stripping out the line feeds. Any idea on how you display a piece of source code for example and may have characters that could be interpreted as wiki text?
Tim
<pre>? <source> of GeSHI extension?
The <pre> tag is a good start. I have played around with that a little and came up with this;
<br /> {| width="95%" border="0" cellpadding="0" cellspacing="0" align="center" |- style="background: #DDDDFF;" | http://www.hoganzoo.com/icons/file-text.png '''Source Code:''' |- | <pre style="border:0; overflow:auto; max-height:35em;">....example text here... .... example text here.... </pre> |}
It works pretty much that way that I would like but I don't seem to be able to turn this into a template. I think what is happening is that the {{{1}}} variable does not like being inside the <pre> </pre> tags. Any way around that?
Getting closer though :)
Tim
Platonides wrote:
Tim Hogan wrote:
Mike,
I see what you mean about the nowiki stripping out the line feeds. Any idea on how you display a piece of source code for example and may have characters that could be interpreted as wiki text?
Tim
<pre>? <source> of GeSHI extension? _______________________________________________ MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Tim Hogan wrote:
The <pre> tag is a good start. I have played around with that a little and came up with this;
<br /> {| width="95%" border="0" cellpadding="0" cellspacing="0" align="center" |- style="background: #DDDDFF;" | http://www.hoganzoo.com/icons/file-text.png '''Source Code:''' |- | <pre style="border:0; overflow:auto; max-height:35em;">....example text here... .... example text here.... </pre> |}
It works pretty much that way that I would like but I don't seem to be able to turn this into a template. I think what is happening is that the {{{1}}} variable does not like being inside the <pre> </pre> tags. Any way around that?
Getting closer though :)
Tim
Yes, pre doesn't seem to like template parameters, which is probably a bug. The following code workarounds it:
<br /> {| width="95%" border="0" cellpadding="0" cellspacing="0" align="center" |- style="background: #DDDDFF;" | http://www.hoganzoo.com/icons/file-text.png '''Source Code:''' |- | {{{PRE|<pre}}} style="border:0; overflow:auto; max-height:35em;">....example text here... {{{1}}} .... example text here.... </pre> |}
Wow, Nice trick! Not sure I understand it fully, ant I had to remove the trailing </pre> from the code :) but I works great. The finial pice of code that I ended up with is
| {{{PRE|<pre}}} style="border:0; overflow:auto; max-height:35em;">{{{1}}} |}
Correct?
Tim
Platonides wrote:
Tim Hogan wrote:
The <pre> tag is a good start. I have played around with that a little and came up with this;
<br /> {| width="95%" border="0" cellpadding="0" cellspacing="0" align="center" |- style="background: #DDDDFF;" | http://www.hoganzoo.com/icons/file-text.png '''Source Code:''' |- | <pre style="border:0; overflow:auto; max-height:35em;">....example text here... .... example text here.... </pre> |}
It works pretty much that way that I would like but I don't seem to be able to turn this into a template. I think what is happening is that the {{{1}}} variable does not like being inside the <pre> </pre> tags. Any way around that?
Getting closer though :)
Tim
Yes, pre doesn't seem to like template parameters, which is probably a bug. The following code workarounds it:
<br /> {| width="95%" border="0" cellpadding="0" cellspacing="0" align="center" |- style="background: #DDDDFF;" | http://www.hoganzoo.com/icons/file-text.png '''Source Code:''' |- | {{{PRE|<pre}}} style="border:0; overflow:auto; max-height:35em;">....example text here... {{{1}}} .... example text here.... </pre> |}
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Spoke too soon. I can't seem to get you modification to work like I was hoping. Help.
Tim
Platonides wrote:
Tim Hogan wrote:
The <pre> tag is a good start. I have played around with that a little and came up with this;
<br /> {| width="95%" border="0" cellpadding="0" cellspacing="0" align="center" |- style="background: #DDDDFF;" | http://www.hoganzoo.com/icons/file-text.png '''Source Code:''' |- | <pre style="border:0; overflow:auto; max-height:35em;">....example text here... .... example text here.... </pre> |}
It works pretty much that way that I would like but I don't seem to be able to turn this into a template. I think what is happening is that the {{{1}}} variable does not like being inside the <pre> </pre> tags. Any way around that?
Getting closer though :)
Tim
Yes, pre doesn't seem to like template parameters, which is probably a bug. The following code workarounds it:
<br /> {| width="95%" border="0" cellpadding="0" cellspacing="0" align="center" |- style="background: #DDDDFF;" | http://www.hoganzoo.com/icons/file-text.png '''Source Code:''' |- | {{{PRE|<pre}}} style="border:0; overflow:auto; max-height:35em;">....example text here... {{{1}}} .... example text here.... </pre> |}
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Wow, Nice trick! Not sure I understand it fully, ant I had to remove the trailing </pre> from the code :) but I works great. The finial pice of code that I ended up with is
| {{{PRE|<pre}}} style="border:0; overflow:auto; max-height:35em;">{{{1}}} |}
The trick is that i'm not giving the parser a <pre tag until after template transclusion. The </pre> shouldn't need to be removed, as it closes the opening <pre> (and you would destroy the rest of wikicode). It works both on Wikipedia (which has TidyHTML) as in my test wiki. So i don't know where's the problem. Try using something like {{{PRE2|</pre>}}}.
mediawiki-l@lists.wikimedia.org