Hi,
I try to display just a part of the content in an article, by using attributes within a tag extension.
The non-matched content isn't displayed indeed, but it leeds to empty space in the middle of the article. Is it maybe possible to cut of the matched content in some way, so that these gaps disappear?
greets...demagggus
On 28/10/2007, demagggus magggus@gmx.de wrote:
Hi,
I try to display just a part of the content in an article, by using attributes within a tag extension.
The non-matched content isn't displayed indeed, but it leeds to empty space in the middle of the article. Is it maybe possible to cut of the matched content in some way, so that these gaps disappear?
greets...demagggus
What method are you using to stop the non-matched content being displayed?
How much empty space? A blank line or two, or the entire space the non-matched content would take up were it displayed?
What method are you using to stop the non-matched content being displayed?
How much empty space? A blank line or two, or the entire space the non-matched content would take up were it displayed?
I match the wanted tags by using following syntax...
function wfRenderArticleSectionCheck($input, $args, &$parser) { global $wgTitle, $wgArticle, $wgParser, $wgLang, $wgLanguageCode; $lan = $wgLang->getCode(); if($args[lan] == $lan) { return $input; } else { return ''; } }
The empty space is conform with the entire space the non-matched content would take up...
I match the wanted tags by using following syntax...
function wfRenderArticleSectionCheck($input, $args, &$parser) { global $wgTitle, $wgArticle, $wgParser, $wgLang, $wgLanguageCode;
$lan = $wgLang->getCode(); if($args[lan] == $lan) { return $input; } else { return ''; }
}
The empty space is conform with the entire space the non-matched content would take up...
So you have tags around all the content saying what language it's in, and only the correct language should be displayed?
I can't see why there would be blank space, your code looks correct to me. Do you have a demo website where I can see it running?
On 28/10/2007, Thomas Dalton thomas.dalton@gmail.com wrote:
I match the wanted tags by using following syntax...
function wfRenderArticleSectionCheck($input, $args, &$parser) { global $wgTitle, $wgArticle, $wgParser, $wgLang, $wgLanguageCode;
$lan = $wgLang->getCode(); if($args[lan] == $lan) { return $input; } else { return ''; }
}
The empty space is conform with the entire space the non-matched content would take up...
So you have tags around all the content saying what language it's in, and only the correct language should be displayed?
I can't see why there would be blank space, your code looks correct to me. Do you have a demo website where I can see it running?
Actually, I say it looks correct - what hook are you using? I've never written a tag extension, but the method described on [[Manual:Tag extensions]] (on mediawiki.org) looks like it expects HTML to be returned, and it looks like you're returning wikitext, which ought to cause problems. It should only cause problems with the displayed text, though, the non-displayed text shouldn't be there at all, even as blank space.
So you have tags around all the content saying what language it's in, and only the correct language should be displayed?
I can't see why there would be blank space, your code looks correct to me. Do you have a demo website where I can see it running?
Unfortunately the wiki is running local at the moment.
This is the wikitext I want to display, depending on the language-setting.
This is displayed every time.
<section lan=lux>Only luxembourgian language.</section> <section lan=en>Only english language.</section> <section lan=de>Only german language.</section> <section lan=de>Only german language.</section> <section lan=en>Only english language.</section>
<section lan=lux>Only luxembourgian language.</section> <section lan=en>Only english language.</section> <section lan=de>Only german language.</section> <section lan=de>Only german language.</section> <section lan=en>Only english language.</section>
This is displayed every time.
<section lan=de>Only german language.</section> <section lan=de>Only german language.</section> <section lan=en>Only english language.</section> <section lan=de>Only german language.</section>
If luxembourgian language is setted up, just the first and fifth line are displayed. But there's a lot of space between the first and fifth line, between the fifth line and the second line without tag, and afterward this line.
demagggus wrote:
If luxembourgian language is setted up, just the first and fifth line are displayed. But there's a lot of space between the first and fifth line, between the fifth line and the second line without tag, and afterward this line.
The empty lines might have to be with the new lines between </section> and the next <section> Try setting everything on one line.
The empty lines might have to be with the new lines between </section> and the next <section> Try setting everything on one line.
Seems you're right. Although I can't really follow the way the content is parsed and rendered. Somebody who can explain it to me maybe?
Because another problem I figured out is to label single table-lines with tags like this.
{| border="1" |align = "center"|'''ID''' |align = "center"|'''Vorname''' |align = "center"|'''Nachname''' |- |1 |Stefan |Schmitt |- <section lan=de> |2 |Michael |Turner |- |3 |John |Foaley |- |4 |Max |Teofanis |- </section> |5 |Horst |Giggler |- |6 |Julius |van Horden |- |}
But what I get if I try this is the following...
|2 |Michael |Turner |- |3 |John |Foaley |- |4 |Max |Teofanis |- ID Vorname Nachname 1 Stefan Schmitt 5 Horst Giggler 6 Julius van Horden
demagggus wrote:
But what I get if I try this is the following...
|2 |Michael |Turner |- |3 |John |Foaley |- |4 |Max |Teofanis |- ID Vorname Nachname 1 Stefan Schmitt 5 Horst Giggler 6 Julius van Horden
The tamble contains an opaque tag. The table is rendered and the tag content put back at the corresponding place. Not what you wanted. For doing that a parserfunction would have been better as would be called before.
Platonides <Platonides@...> writes:
demagggus wrote:
But what I get if I try this is the following...
|2 |Michael |Turner |- |3 |John |Foaley |- |4 |Max |Teofanis |- ID Vorname Nachname 1 Stefan Schmitt 5 Horst Giggler 6 Julius van Horden
The tamble contains an opaque tag. The table is rendered and the tag content put back at the corresponding place. Not what you wanted. For doing that a parserfunction would have been better as would be called before.
OK. I had a look for parser functions. But at the moment I'm not really sure, how to realise this item via a parser function. Is it possible to use tags even in parser functions, or any other syntax which I can use to label sections? And how to identificate these sections in a parser function? Via regex?
On 28/10/2007, demagggus magggus@gmx.de wrote:
The empty lines might have to be with the new lines between </section> and the next <section> Try setting everything on one line.
Seems you're right. Although I can't really follow the way the content is parsed and rendered. Somebody who can explain it to me maybe?
Your code tells the parser to replace the contents on the appropriate tags with the empty string, so it just displays everything that is outside the tags. The line breaks (which are, in effect, a character like any other) are outside the tags, so aren't replaced by your code.
<section lang=en>Foobar</section>(line break)
Parses to:
(line break)
Which displays as a blank line. You need the (line break) to be inside the section tag, so it doesn't display:
<section lang=en>Foobar(line break)</section>
ie. you need to write:
<section lang=en>Foobar </section>
Does that make more sense?
wikitech-l@lists.wikimedia.org