A mediawiki question. At work, I have some text that looks something like:
*some text {{template}} *some text
etc. I would like to make this entire block of text turn grey. Ideally, I would do it like this:
{{grey| *some text {{template}} *some text }}
But this doesn't work - the parser doesn't like it (afaik). With various testing, I came up with a template like this:
{{grey(}} *some text {{template}} *some text {{)}}
where {{grey(}} opens a table with certain character formatting, creates a cell, and {{)}} closes the cell and table. Just applying the style directly to the text didn't work. Even using divs and spans didn't work.
Is there any remotely elegant way of doing all this?
Steve
On 8/9/06, Steve Bennett stevage@gmail.com wrote:
Even using divs and spans didn't work.
It works for me. http://en.wikipedia.org/w/index.php?title=User:Simetrical/Sandbox&oldid=...
On 8/10/06, Simetrical Simetrical+wikitech@gmail.com wrote:
On 8/9/06, Steve Bennett stevage@gmail.com wrote:
Even using divs and spans didn't work.
It works for me. http://en.wikipedia.org/w/index.php?title=User:Simetrical/Sandbox&oldid=...
But not using a template. If you do it this way: {{template| *foo {{template2}} }}
the parsing borks at the nested template.
If you do it this way:
Define {{opendiv}} as <div style="..."> Define {{closediv}} as </div>
and then: {{opendiv}} *foo {{template2}} {{closediv}}
then MediaWiki automatically closes the div tag for you, and it doesn't work.
Steve
On Thu, Aug 10, 2006 at 07:58:29AM +0200, Steve Bennett wrote:
and then: {{opendiv}} *foo {{template2}} {{closediv}}
then MediaWiki automatically closes the div tag for you, and it doesn't work.
That formatting which is opened in one included template and closed in a different one won't work was covered in depth here about 2 or 3 weeks ago; it's interrelated with whether tidy's turned on, I think; check the archives.
Cheers, -- jra
On 8/10/06, Jay R. Ashworth jra@baylink.com wrote:
On Thu, Aug 10, 2006 at 07:58:29AM +0200, Steve Bennett wrote:
and then: {{opendiv}} *foo {{template2}} {{closediv}}
then MediaWiki automatically closes the div tag for you, and it doesn't work.
That formatting which is opened in one included template and closed in a different one won't work was covered in depth here about 2 or 3 weeks ago; it's interrelated with whether tidy's turned on, I think; check the archives.
Yes, I know. My question is, is there any remotely elegant way I can achieve what seems like a perfectly reasonable thing to me: using a template to apply a character style to a block of text. Having to use a table (which is the only way I could find to do it) is not imho elegant.
Steve
On Thu, Aug 10, 2006 at 05:39:53PM +0200, Steve Bennett wrote:
Yes, I know. My question is, is there any remotely elegant way I can achieve what seems like a perfectly reasonable thing to me: using a template to apply a character style to a block of text. Having to use a table (which is the only way I could find to do it) is not imho elegant.
Well, I think the other guy's answer was "sure, you can use a div, you just can't open the div in one template and close it in a different one."
IOW: I think that elegant may be too much to ask at this point.
I don't like putting HTML in my wikitext either, but I think you're gonna have to.
Cheers, -- jra
On 8/10/06, Jay R. Ashworth jra@baylink.com wrote:
Well, I think the other guy's answer was "sure, you can use a div, you just can't open the div in one template and close it in a different one."
Yeah, and since nested templates apparently don't work, the end result is divs aren't going to work.
IOW: I think that elegant may be too much to ask at this point.
I don't like putting HTML in my wikitext either, but I think you're gonna have to.
It's not so much a question of not wanting to pollute my wikitext with HTML, it's more a question of actually wanting to reduce the amount of wikitext and wanting to gain some modularity. I really want to use a template to mark some text as having a certain attribute, then display that attribute some particular way (ie, grey, small text on a pale grey background or something).
I guess the most elegant way would be to define a CSS class somewhere, then just do <div class="...">.....</div>
This all makes me think that templates trying to be "clean" by refusing to leave dangling tags is probably going beyond what they were designed for - straight text substitution.
Steve
On Thu, Aug 10, 2006 at 08:10:00PM +0200, Steve Bennett wrote:
This all makes me think that templates trying to be "clean" by refusing to leave dangling tags is probably going beyond what they were designed for - straight text substitution.
The impression I acquired from following that thread was that yes, that's what TPTB feel as well, though I don't speak for them, even if paid to..
Cheers, -- jra
Steve Bennett wrote:
On 8/10/06, Jay R. Ashworth jra@baylink.com wrote:
On Thu, Aug 10, 2006 at 07:58:29AM +0200, Steve Bennett wrote:
and then: {{opendiv}} *foo {{template2}} {{closediv}}
then MediaWiki automatically closes the div tag for you, and it doesn't work.
That formatting which is opened in one included template and closed in a different one won't work was covered in depth here about 2 or 3 weeks ago; it's interrelated with whether tidy's turned on, I think; check the archives.
Yes, I know. My question is, is there any remotely elegant way I can achieve what seems like a perfectly reasonable thing to me: using a template to apply a character style to a block of text.
You do that using <div class='some_name'>. This allows you to specify the actual style (font, color, etc.) in the CSS, which is much more of a "template" in its literal meaning than {{...}} is.
{{...}} should be called "macros". :-p
Timwi
On 8/12/06, Timwi timwi@gmx.net wrote:
You do that using <div class='some_name'>. This allows you to specify the actual style (font, color, etc.) in the CSS, which is much more of a "template" in its literal meaning than {{...}} is.
What exactly do you mean by "the CSS". If one refers to a new class in a page, where does one define it? At the top of the page? In some other .css file?
Maybe something like this would work:
<div {{template}}> ... </div>
or even: <{{template open}}> <{{template close}}>
Haven't tried them though.
Steve
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Steve Bennett wrote:
On 8/12/06, Timwi timwi@gmx.net wrote:
You do that using <div class='some_name'>. This allows you to specify the actual style (font, color, etc.) in the CSS, which is much more of a "template" in its literal meaning than {{...}} is.
What exactly do you mean by "the CSS". If one refers to a new class in a page, where does one define it? At the top of the page? In some other .css file?
Maybe something like this would work:
<div {{template}}> ... </div>
or even: <{{template open}}> <{{template close}}>
Haven't tried them though.
Technically speaking, the gobs of style information we find in lots of infoboxes and stuff should be tucked away in Common.css, unfortunantely, the average editor is not well versed enough to do something like that.
The quick-n-dirty way is to do something like <div style="background:grey;">. The correct way would be to get an admin to define a contextually correct class name to use, like <div style="nameofblock"> that's independent of how it's going to be styled.
On 8/12/06, Edward Z. Yang edwardzyang@thewritingpot.com wrote:
Technically speaking, the gobs of style information we find in lots of infoboxes and stuff should be tucked away in Common.css, unfortunantely, the average editor is not well versed enough to do something like that.
The quick-n-dirty way is to do something like <div style="background:grey;">. The correct way would be to get an admin to define a contextually correct class name to use, like <div style="nameofblock"> that's independent of how it's going to be styled.
On en wikipedia at least, we're a hell of a long way away from having any kind of consistent look and feel across the project. Even the choice of colours for our maps seems to be totally up to the preference of the person making the map.
We kind of need a next level of hierarchy above wikiprojects. They're good at standardising appearance across a group of related articles. Next we need a meta-wikiproject: standardising, to a lower level, appearance across *all* articles.
Steve
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Steve Bennett wrote:
On en wikipedia at least, we're a hell of a long way away from having any kind of consistent look and feel across the project. Even the choice of colours for our maps seems to be totally up to the preference of the person making the map.
We kind of need a next level of hierarchy above wikiprojects. They're good at standardising appearance across a group of related articles. Next we need a meta-wikiproject: standardising, to a lower level, appearance across *all* articles.
Manual of Style?
On 8/12/06, Edward Z. Yang edwardzyang@thewritingpot.com wrote:
Manual of Style?
Nah, it doesn't cover much beyond the basics - certainly not layout, colours, etc. And these days most of what gets added to it is fairly equivocal - "sometimes you should do this, but this is ok too".
Steve
Steve Bennett wrote:
On 8/12/06, Edward Z. Yang edwardzyang@thewritingpot.com wrote:
Manual of Style?
Nah, it doesn't cover much beyond the basics - certainly not layout, colours, etc. And these days most of what gets added to it is fairly equivocal - "sometimes you should do this, but this is ok too".
There is no reason why this shouldn't change. The purpose of the manual of style is to prescribe a consistent style, and the proper way to do this on the web is to prescribe the use of semantic CSS classes.
On 8/14/06, Timwi timwi@gmx.net wrote:
There is no reason why this shouldn't change. The purpose of the manual of style is to prescribe a consistent style, and the proper way to do this on the web is to prescribe the use of semantic CSS classes.
Yes, the MoS should be prescriptive. I'm thinking it would actually be a good idea to split it in half, as it addresses the quite disparate topics of *style* (grammar, expression, naming...) and *layout* (headings, HTML, images etc).
Steve
Steve Bennett wrote:
On 8/12/06, Timwi timwi@gmx.net wrote:
You do that using <div class='some_name'>. This allows you to specify the actual style (font, color, etc.) in the CSS, which is much more of a "template" in its literal meaning than {{...}} is.
What exactly do you mean by "the CSS". If one refers to a new class in a page, where does one define it? At the top of the page? In some other .css file?
"The CSS" is the CSS that is included in any particular page view. Currently the only way to include CSS in a page view is to place it on [[MediaWiki:Monobook.css]], [[MediaWiki:Common.css]], or any page that is @import'ed from these. However, obviously, it is entirely possible to add a feature to MediaWiki that allows the inclusion of certain CSS on a specific page. One could even have the parser pick out all the 'class' attributes and include all the necessary CSS for those automatically. The only problem with things like this is that I'm the only one that seems to think it's a good idea, while most other people like to stay with old, limited and never-evolving systems.
Timwi
On 8/14/06, Timwi timwi@gmx.net wrote:
However, obviously, it is entirely possible to add a feature to MediaWiki that allows the inclusion of certain CSS on a specific page. One could even have the parser pick out all the 'class' attributes and include all the necessary CSS for those automatically.
Have you opened a bug on it? It sounds like an interesting project.
Simetrical wrote:
On 8/14/06, Timwi timwi@gmx.net wrote:
However, obviously, it is entirely possible to add a feature to MediaWiki that allows the inclusion of certain CSS on a specific page. One could even have the parser pick out all the 'class' attributes and include all the necessary CSS for those automatically.
Have you opened a bug on it? It sounds like an interesting project.
I don't need it, so no. If you want it, you do that.
wikitech-l@lists.wikimedia.org