It seems to me that "File" is a good candidate for a new SMW property type, whether defined in SMW itself or another extension - the display of this type would be a link to that file, eliminating the need for extensions like FileProtocolLinks.

Matheus - as you suspected, the fact that FileProtocolLinks uses tags, as opposed to parser functions, makes it (I think) impossible for FileProtocolLinks as currently written and SMW to work together.

Since you're talking about developing extensions, this might be a good opportunity for a new extension that defined a "File" type, maybe called "Semantic Local Files" (I'd say "Semantic Files", but I'd like the "SF" acronym to be reserved for Semantic Forms :) ). See the latest version of the Semantic Maps extension for an example of an extension defining its own property type, "Geographic coordinate" (the long-term plan, as I understand it, is to move handling of coordinates completely out of SMW and into Semantic Maps).


On Thu, Dec 24, 2009 at 10:47 PM, CNIT <> wrote:
23.12.2009 18:38, Matheus Garcia Barbosa de Figueiredo пишет:
I´ve created a template which has a property called "path", which is intended to store a string that represents a path to a file in a network file system. I´d like to show this property inside <file> and </file> tags, which are used by the FileProtocolLinks extension to create a link using file protocol.

Unfortunatelly, the semantic property is not "resolved",  the link is incorrectly created to the literal "[[path::{{{path}}}]]", instead of eg. "c:\whateverdir\foo.txt".

The text in my template is:

If I remove the tags the content is show correctly, but I do need to envolve it in the tags to use the extension.

I´m pretty sure it is not a problem with SMW, but with the FileProtocolLinks extension, which seems to be processed first than SMW markup and not parsing it´s contents. I´d like the extension to call the mediawiki parser on it´s contents, but I don't know how to do it yet. The same may occur also with another tag based extensions.
The relevant part of this extension is:

function renderFileProtocolLink($input)
    $exploded = explode('|', $input);
    $uri = htmlentities($exploded[0], ENT_COMPAT, "UTF-8");
    if (!isset($exploded[1]) || empty($exploded[1])) {
        // no linktext has been specified ==> use the URI as linktext
        $linktext = $uri;
    else {
        $linktext = htmlentities($exploded[1], ENT_COMPAT, "UTF-8");
    return sprintf('<a style="color:green" href="file:///%s">%s</a>', 
        $uri, $linktext);
So, do any of you guys cold help me fix this issue? Or at least point me where could I look for that? I´m doing my first steps in developing SMW extensions

Try to use $input = Parser->recursiveTagParse( $input ) The extension should recieve an instance of Parser object upon the hook call.

This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
Semediawiki-devel mailing list