* Markus Krötzsch <[EMAIL PROTECTED]> [2007-12-18 16:32]:
> On Freitag, 14. Dezember 2007, Thomas Bleher wrote:
> > * Markus Krötzsch <[EMAIL PROTECTED]> [2007-12-12 21:07]:
> > > On Sonntag, 2. Dezember 2007, Thomas Bleher wrote:
> > > >  67         foreach($properties as $singleprop) {
> > > >  68                 $dv =
> > > > SMWFactbox::addProperty($singleprop,$value,$valueCaption); 69         }
> > > >
> > > > $dv is overwritten here on each iteration of the loop. This looks
> > > > fishy.
> > >
> > > Yes, but normally there is only one iteration anyway. What would you
> > > suggest instead?
> >
> > Hmm, should nested properties be allowed here?
> >
> > FWIW, the regexp is
> > $semanticLinkPattern = '/\[\[               # Beginning of the link
> >                         (([^:][^]]*):[=:])+ # Property name (can be
> > nested?) (                   # After that:
> >                           (?:[^|\[\]]       #   either normal text (without
> > |, [ or ])
> >
> >                           |\[\[[^]]*\]\]    #   or a [[link]]
> >                           |\[[^]]*\]        #   or an [external link]
> >
> >                         )*)                 # all this zero or more times
> >                         (\|([^]]*))?        # Display text (like "text" in
> > [[link|text]]), optional \]\]                # End of link
> >                         /x';
> >
> > (I took the liberty of modifying it to make it more readable)
> >
> >
> >
> > If nested properties should not be supported, all is fine, as $property
> > is just ([^:][^]]*), ie without the trailing :: or :=. Then the
> > preg_split and the for loop can be removed (OK, maybe the regexp could
> > be made more strict, but that's another issue).
> >
> > If nested properties should be supported, this code is buggy, but I do
> > not know what the correct semantics would be anyway.
> 
> There are no "nested properties", and indeed I do not see what this should be 
> either. What there is are (a) multiple properties per value, and (b) nested 
> links in values. So you can write
> 
> [[property1::property2::Some [[strange]] text]]
> 
> and it will have the same semantic effect as 
> 
> [[property1::Some [[strange]] text]]
> [[property2::Some [[strange]] text]]
> 
> while relieving you from repeating the value. Many use cases for that can now 
> be addressed with property hierarchies as well, but sometimes it may still be 
> useful (e.g. when annotating an email address as both URL and string).
> 
> The above works, so there should be no bug here.

Ah, OK :)

What got me confused was that $dv is overwritten, and I had somehow
thought that it was some value for the factbox. But as it is only the
text that is displayed inline, everything works fine.

Regards,
Thomas

Attachment: signature.asc
Description: Digital signature

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to