Currently you can pretty much use <pre> anywhere with weird, unpredictable results:
[[foo|Here's some <pre>text</pre>. Blah.]]
The result isn't terribly useful. This case is slightly more useful:
---- [[image:foo.jpg|thumb|Some <pre> Pre
formatted
text. </pre>]] ----
Would it be reasonable to restrict the use of <pre> to: - General paragraph texts, but not internal or external link captions - Image captions
Perhaps anywhere else it could be either treated as equivalent to <nowikI>, ignored, or rendered literally?
Thoughts?
Steve
Steve Bennett wrote:
Would it be reasonable to restrict the use of <pre> to:
- General paragraph texts, but not internal or external link captions
- Image captions
Perhaps anywhere else it could be either treated as equivalent to <nowikI>, ignored, or rendered literally?
Thoughts?
Steve
IMHO we should differentiate between inline tags and block tags. As we're translating wikitext into xhtml, using its same type of restriction makes sense.
So an image caption would onmly be allowed to contain inline tags. <pre> is a block tag.
We could: a) Render <pre> literally [blinking] in red so the user perceives there's a syntax error. b) Refuse to save (bad). c) Use a <span with pre-like format (is it really useful? It means a different ) d) Move the <pre> to the next position where it makes sense.
c: means different behaviours in inline and block contexts. But in some contexts that tag changes from inline to block. d: Is not too deterministic for other implementations, but i think is the method that Tidy would use.
From: "Platonides" platonides@gmail.com
Steve Bennett wrote:
Would it be reasonable to restrict the use of <pre> to:
- General paragraph texts, but not internal or external link captions
- Image captions
Perhaps anywhere else it could be either treated as equivalent to <nowikI>, ignored, or rendered literally?
IMHO we should differentiate between inline tags and block tags. As we're translating wikitext into xhtml, using its same type of restriction makes sense.
So an image caption would onmly be allowed to contain inline tags. <pre> is a block tag.
We could: a) Render <pre> literally [blinking] in red so the user perceives there's a syntax error. b) Refuse to save (bad). c) Use a <span with pre-like format (is it really useful? It means a different ) d) Move the <pre> to the next position where it makes sense.
Or of course: e) Render it literally without making it look ridiculous.
Here's my thoughts on the above options: a) No - use (e) instead. b) Never refuse to save c) This is a possibility. However we would need to make this behaviour consistent across the whole parser, e.g. <pre> tags inside a paragraph should be treated as in-line as well. This would possibly be quite useful, but would no doubt break existing pages. It is also conceptually a bit confusing and may cause problems with the default styling rules (which add padding and borders etc. which may look pretty bad for in-line elements). d) I don't think this is a good idea - it almost certainly isn't what was wanted and makes the problem harder to track down. e) The one I would choose if (c) is not viable.
- Mark Clements (HappyDog)
-----Original Message----- From: wikitext-l-bounces@lists.wikimedia.org [mailto:wikitext-l-bounces@lists.wikimedia.org] On Behalf Of Mark Clements Sent: 07 December 2007 12:57 To: Wikitext-l Subject: Re: [Wikitext-l] The <pre> tag
From: "Platonides" platonides@gmail.com
Steve Bennett wrote:
Would it be reasonable to restrict the use of <pre> to:
- General paragraph texts, but not internal or external link
captions
- Image captions
Perhaps anywhere else it could be either treated as equivalent to <nowikI>, ignored, or rendered literally?
IMHO we should differentiate between inline tags and block tags. As we're translating wikitext into xhtml, using its same type of restriction makes sense.
So an image caption would onmly be allowed to contain inline tags.
<pre> is a block tag. We could: a) Render <pre> literally [blinking] in red so the user perceives there's a syntax error. b) Refuse to save (bad). c) Use a <span with pre-like format (is it really useful?
It means a
different ) d) Move the <pre> to the next position where it makes sense.
Or of course: e) Render it literally without making it look ridiculous.
Here's my thoughts on the above options: a) No - use (e) instead. b) Never refuse to save c) This is a possibility. However we would need to make this behaviour consistent across the whole parser, e.g. <pre> tags inside a paragraph should be treated as in-line as well. This would possibly be quite useful, but would no doubt break existing pages. It is also conceptually a bit confusing and may cause problems with the default styling rules (which add padding and borders etc. which may look pretty bad for in-line elements).
WikiCreole uses <tt> in xhtml for inline preformatted text. If the preformatted token ({{{ in creole's case) is on the start of the line, its considered a block, otherwise inline. Seems fine to me, but not sure if can apply the same ruling to mw <pre>.
d) I don't think this is a good idea - it almost certainly isn't what was wanted and makes the problem harder to track down.
This is what I currently do.
e) The one I would choose if (c) is not viable.
- Mark Clements (HappyDog)
Wikitext-l mailing list Wikitext-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitext-l
On 12/7/07, Mark Clements gmane@kennel17.co.uk wrote:
b) Never refuse to save
Let's just rule this out once and for all. We're talking about how the parser renders code, so "refusing to save" never comes into it. The code is already there, saved, so how do we render it?
c) This is a possibility. However we would need to make this behaviour consistent across the whole parser, e.g. <pre> tags inside a paragraph should be treated as in-line as well. This would possibly be quite useful, but would no doubt break existing pages. It is also conceptually a bit confusing and may cause problems with the default styling rules (which add padding and borders etc. which may look pretty bad for in-line elements).
The trouble with pretending that an in-line <pre> is actually an inline text is this:
---- Some text<pre>foo
blah
blah</pre> whatever. ----
I'm going to have to read up on the fine points between "inline" tags and "block" tags, but that one strikes me as a bit of both.
A quick note on how I see <pre>: * <nowiki> turns off parsing, but renders normally * A space-indented block renders as <pre> but parses normally (at the mediawiki level) * <pre> renders as <pre> *and* turns off parsing. * <tt> renders sort of like <pre>, but the browser parses it normally (I think)
So if inline <pre> is weird from a rendering point of view, how should it parse? Just like <nowiki>?
e) Render it literally without making it look ridiculous.
Hmm. So are we saying that <pre> has to be at the start of a line, or just not in a caption, or what? It would seem reasonable to me that [[foo|<pre>blah</pre>]] render as a literal ...<pre>blah.... Is any useful behaviour likely to be lost?
Steve
On Sat, Dec 08, 2007 at 01:16:10AM +1100, Steve Bennett wrote:
The trouble with pretending that an in-line <pre> is actually an inline text is this:
Some text<pre>foo
blah
blah</pre> whatever.
I'm going to have to read up on the fine points between "inline" tags and "block" tags, but that one strikes me as a bit of both.
A quick note on how I see <pre>:
- <nowiki> turns off parsing, but renders normally
- A space-indented block renders as <pre> but parses normally (at the
mediawiki level)
<pre> renders as <pre> *and* turns off parsing.
- <tt> renders sort of like <pre>, but the browser parses it normally (I think)
So if inline <pre> is weird from a rendering point of view, how should it parse? Just like <nowiki>?
That was my perception, yes: "they really meant "nowiki"."
Cheers, -- jra
wikitext-l@lists.wikimedia.org