From: Markus <ma...@ai...> - 2007-12-20 08:57:02
|
On Dienstag, 4. Dezember 2007, Yaron Koren wrote: > I don't know why exactly this is failing, but if you split up the "#switc= h" > call and the SMW call into two separate parts, it should work. The templa= te > > could look more like this: > |{{#switch: {{{works|}}} > | > | yes > > ...plus all the rest, and then this: > > [[Does it work::{{{works|}}}]] > > You can refer to a value more than once in the same template. Yes, such issues unfortunately tend to appear in MediaWiki when combining=20 different extensions ... it basically is a question of the order in which=20 extension syntax is processed -- if switch gets to see SMW's syntax it will= =20 be slightly confused, and after processing it just removes that part so tha= t=20 SMW cannot see it. Yaron's solution is probably best. Note that you can hide the second=20 occurrence of {{{works|}}} by writing "[[Does it work::{{{works|}}}| ]]".=20 Also note that the default empty value in {{{works|}}} is not very helpful = =2D-=20 you will get an annotation error when this case occurs. An alternative is t= o=20 use {{#if to check whether {{{works}}} is given and annotate only in that=20 case. Something like "{{#if:{{{works|}}}|[[Does it work::{{{works|}}}| ]]|}= }"=20 should do that (yes, MediaWiki coding is sometimes ugly ...). =2D- Markus > > -Yaron > > On Nov 30, 2007 10:53 PM, <di...@gm...> wrote: > > I'm afraid I'm not too knowledgeable on the technical aspects of this, > > but here goes. > > > > I have a template which I want to convert for use with Semantic MediaWi= ki > > (already set up on a local testing server, 1.0RC2). However, it makes u= se > > of the {{#switch}} function contained in the ParserFunctions extensions. > > > > What it does is colour the background of a table cell a different colour > > depending on the value in the argument/variable. > > > > So currently it looks like: > > |{{#switch: {{{works|}}} > > | > > | yes > > | YES > > | Yes =3D style=3D"background:palegreen" > > | no > > | NO > > | No =3D style=3D"background:salmon" > > | partial > > | PARTIAL > > | Partial =3D style=3D"background:skyblue" > > > > }}|{{{celltext|}}} > > > > Converted to be property-based for use with SMW it looks like this: > > |{{#switch: [[Does it work::{{{works|}}}]] > > | > > | yes > > | YES > > | Yes =3D style=3D"background:palegreen" > > | no > > | NO > > | No =3D style=3D"background:salmon" > > | partial > > | PARTIAL > > | Partial =3D style=3D"background:skyblue" > > > > }}|[[Cell text::{{{50note|}}}]] > > > > The function obviously doesn't recognize the argument since it's not > > formatted for correct use with it. > > > > I'm sure there's something missing here, but information seems to be all > > over the place and not so easy to find what you're looking for, or to > > understand it (or maybe I'm just useless). > > > > -----------------------------------------------------------------------= =2D- > > SF.Net email is sponsored by: The Future of Linux Business White Paper > > from Novell. From the desktop to the data center, Linux is going > > mainstream. Let it simplify your IT future. > > http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 > > _______________________________________________ > > Semediawiki-user mailing list > > Sem...@li... > > https://lists.sourceforge.net/lists/listinfo/semediawiki-user =2D-=20 Markus Kr=F6tzsch Institut AIFB, Univers=E4t Karlsruhe (TH), 76128 Karlsruhe phone +49 (0)721 608 7362 fax +49 (0)721 608 5998 ma...@ai... www http://korrekt.org |