Hi Patrick,
Yeh, hacks aren't much fun, but I've tried that, though using
{{#multireplace:<query>|/\[\[SMW::off\]\]\r\n/=|/\[\[SMW::on\]\]/=}}.
I wanted to use #replace but SMW for some crazy reason
generates x0D0A after /\[\[SMW::off\]\]/ so I'd end up after the
#replace action with "Industry::[[\r\n ..." which makes SMW barf.

(Really, SMW SHOULD allow whitespace there....)

What burns me is that the #multireplace is NOT removing
the \r\n as it should, so I'm having to hack the code to remove
the offensive characters (that is, of course, instead of fixing
Extension:Multireplace's bug which I'm using to fix SMW's bug...)

So I'm still asking what harm there is hacking the  SMW_QueryPrinter.php  code
as I've done.
Best regards,
John

>-----Original Message-----
>From: Patrick Nagel [mailto:m...@patrick-nagel.net]
>Sent: Thursday, February 04, 2010 7:10 PM
>To: semediawiki-devel@lists.sourceforge.net
>Subject: Re: [SMW-devel] (SMW_QueryPrinter.php) SMW::on & SMW::off
>
>
>Hi John
>
>On 2010-02-05 09:37, John McClure wrote:
>> I've changed L154 of SMW_QueryPrinter.php to:
>> --------------
>> # $result = '[[SMW::off]]' . $wgParser->replaceVariables($result) .
>> '[[SMW::on]]'; //old line
>> $result  = $wgParser->replaceVariables($result);
>> if( chr(13) == substr($result,0,1) )         //if there is an initial \r
>>     $result = substr($result,2);                //skip over the initial \r\n
>> --------------
>> and it seems to work fine, giving my exactly as expected, that is, after
>> adjusting the initial query to:
>> {{#ask: [[Business:+]]
>>
>[[Industry::{{FULLPAGENAME}}||<q>[[:Category:+]][[{{#var:industries|+}}
>]]</q>]]}
>> }
>>
>> Could someone tell me whether this change to SMW_QueryPrinter.php  is a BAD
>> IDEA? What is the impact on SMW::parsePropertiesCallback where these
>tags seem
>> (most) operative, via SMW::smwgStoreAnnotations?
>
>I don't know, but I'd like to :)
>
>Currently I use an ugly hack to remove those markers via StringFunctions:
>
>{{#replace:{{#replace: <query> |[[SMW::off]]|}}|[[SMW::on]]|}}
>
>Patrick.


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to