Re: [pmwiki-users] (:directive:) in (:mytext: this is a hidden PTV:)

2010-04-20 Thread Dominique Faure
On Tue, Apr 20, 2010 at 12:26, Hans  wrote:
> Tuesday, April 20, 2010, 11:07:32 AM, Dominique Faure wrote:
>
>> oops, the generic version should be more elaborated:
>
>> $MarkupExpr['directive'] = 'preg_replace("/\\n$/", "",
>>                                MarkupToHTML($pagename,
>>                                             "<:block>(:" .
>> trim(preg_replace($rpat, $rrep, $params)) . ":)",
>>                                             array("escape" => 0)))',
>
>> should do the trick
>
> this did not work, even with ';' at end instead of ','
> but your previous suggeastion works with thumb and thumblist.

Here's my full bench:

=8<- - - - - (Test.MarkupExpr wiki page) - - - - -
:PTV1: ptv1 (:mymarkup  :) ptv1
:PTV2: ptv2 {(directive mymarkup  )} ptv2
(:PTV3: ptv3 {(directive mymarkup  )} ptv3 :)

* {$:PTV1}
* {$:PTV2}
* {$:PTV3}

=8<- - - - - (Test.MarkupExpr.php) - - - - -
Markup('mymarkup', 'directives', "/\\(:mymarkup\\s+(.*?):\\)/sei",
  "MyMarkup(\$pagename, PSS('$1'))");

function MyMarkup($pagename, $args) {
  return "This is my markup...\"$args\"";
}

if(true) {
  $MarkupExpr['directive'] =
'"(:" . trim(preg_replace($rpat, $rrep, $params)) . ":)"';
} else {
  $MarkupExpr['directive'] =
'preg_replace("/\\n$/", "", MarkupToHTML($pagename,
  "<:block>(:" . trim(preg_replace($rpat, $rrep, $params)) . ":)",
  array("escape" => 0)))';
}
- - - - - - - - - - - - - - -

While having the 1st solution active, the page is rendered as below,
where you may see an evaluation artefact ("ptv3 :)") while rendering
PTV2 definition:

=8<- - - - -
PTV1
  ptv1 This is my markup..." " ptv1
PTV2
  ptv2 This is my markup..." " ptv2 ptv3 :)

* ptv1 This is my markup..." " ptv1
* ptv2 This is my markup..." " ptv2
* ptv3 This is my markup..." " ptv3

=8<- - - - -

Reversing the test to activate the other definition, let the markup
render without the offending "ptv3 :)"

> Is
> $MarkupExpr['directive'] = '"(:" . trim(preg_replace($rpat, $rrep, $params)) 
> . ":)"';
> restricted to directives without line breaks?

The MarkupExpr markup definition, ie. the {(...)} general processing
isn't designed to handle multiple lines.

-- 
Dominique

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] (:directive:) in (:mytext: this is a hidden PTV:)

2010-04-20 Thread Hans
Tuesday, April 20, 2010, 11:07:32 AM, Dominique Faure wrote:

> oops, the generic version should be more elaborated:

> $MarkupExpr['directive'] = 'preg_replace("/\\n$/", "",
>MarkupToHTML($pagename,
> "<:block>(:" .
> trim(preg_replace($rpat, $rrep, $params)) . ":)",
> array("escape" => 0)))',

> should do the trick

this did not work, even with ';' at end instead of ','
but your previous suggeastion works with thumb and thumblist.

Is
$MarkupExpr['directive'] = '"(:" . trim(preg_replace($rpat, $rrep, $params)) . 
":)"';
restricted to directives without line breaks?

tanks,
  ~Hans


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] (:directive:) in (:mytext: this is a hidden PTV:)

2010-04-20 Thread Dominique Faure
On Tue, Apr 20, 2010 at 11:42, Dominique Faure
 wrote:
> On Tue, Apr 20, 2010 at 11:19, Hans  wrote:
>> Tuesday, April 20, 2010, 1:26:45 AM, ABClf wrote:
>>
>>> I was in trouble for using (:thumblist:) in a large hidden PTV
>>> (:myptv: long text :).
>>> Here it is my problematic source:
>>
>>> (:text: some long text, where I want images (:thumblist:) some more text:)
>>
>>> doesn't work when showing {$:text} ; I guess it is because of the
>>> thumblist's « :) »
>>
>> you could define a markup expression for thumblist
>> and use that inside the PTV:
>>
>> in config:
>>
>> $MarkupExpr['thumb'] = $MarkupExpr['thumblist']
>>        = 'MXThumbList($pagename, $args, $argp)';
>> function MXThumbList($pagename, $args, $argp) {
>>  $suffix = (isset($args[0])) ? '' : 'list';
>>  unset($argp[''],$argp['#']);
>>  foreach($argp as $k => $v)
>>    $opt .= " ".$k."=".$v;
>>  foreach($args as $v)
>>    $opt .= " ".$v;
>>  return FmtThumbList($pagename, $opt, $suffix, '');
>> }
>>
>> PTV example in the page:
>>  (:text: some long text, where I want images {(thumblist)} some more text:)
>> or
>>  (:text: some text {(thumb myimage.jpg)} some more text:)
>>
>> thumblist parameters should work too.
>>
>>
>>  ~Hans
>>
>>
>> ___
>> pmwiki-users mailing list
>> pmwiki-users@pmichaud.com
>> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>>
>
> Then why not, the generic:
>
> $MarkupExpr['directive'] = '"(:" . trim(preg_replace($rpat, $rrep,
> $params)) . ":)"';
>
> with the wiki page syntax:
>
> (:text: some long text, where I want images {(directive thumblist)}
> some more text:)
>

oops, the generic version should be more elaborated:

$MarkupExpr['directive'] = 'preg_replace("/\\n$/", "",
   MarkupToHTML($pagename,
"<:block>(:" .
trim(preg_replace($rpat, $rrep, $params)) . ":)",
array("escape" => 0)))',

should do the trick
-- 
Dominique

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] (:directive:) in (:mytext: this is a hidden PTV:)

2010-04-20 Thread Dominique Faure
On Tue, Apr 20, 2010 at 11:19, Hans  wrote:
> Tuesday, April 20, 2010, 1:26:45 AM, ABClf wrote:
>
>> I was in trouble for using (:thumblist:) in a large hidden PTV
>> (:myptv: long text :).
>> Here it is my problematic source:
>
>> (:text: some long text, where I want images (:thumblist:) some more text:)
>
>> doesn't work when showing {$:text} ; I guess it is because of the
>> thumblist's « :) »
>
> you could define a markup expression for thumblist
> and use that inside the PTV:
>
> in config:
>
> $MarkupExpr['thumb'] = $MarkupExpr['thumblist']
>        = 'MXThumbList($pagename, $args, $argp)';
> function MXThumbList($pagename, $args, $argp) {
>  $suffix = (isset($args[0])) ? '' : 'list';
>  unset($argp[''],$argp['#']);
>  foreach($argp as $k => $v)
>    $opt .= " ".$k."=".$v;
>  foreach($args as $v)
>    $opt .= " ".$v;
>  return FmtThumbList($pagename, $opt, $suffix, '');
> }
>
> PTV example in the page:
>  (:text: some long text, where I want images {(thumblist)} some more text:)
> or
>  (:text: some text {(thumb myimage.jpg)} some more text:)
>
> thumblist parameters should work too.
>
>
>  ~Hans
>
>
> ___
> pmwiki-users mailing list
> pmwiki-users@pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>

Then why not, the generic:

$MarkupExpr['directive'] = '"(:" . trim(preg_replace($rpat, $rrep,
$params)) . ":)"';

with the wiki page syntax:

(:text: some long text, where I want images {(directive thumblist)}
some more text:)

-- 
Dominique

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] (:directive:) in (:mytext: this is a hidden PTV:)

2010-04-20 Thread Hans
Tuesday, April 20, 2010, 1:26:45 AM, ABClf wrote:

> I was in trouble for using (:thumblist:) in a large hidden PTV
> (:myptv: long text :).
> Here it is my problematic source:

> (:text: some long text, where I want images (:thumblist:) some more text:)

> doesn't work when showing {$:text} ; I guess it is because of the
> thumblist's « :) »

you could define a markup expression for thumblist
and use that inside the PTV:

in config:

$MarkupExpr['thumb'] = $MarkupExpr['thumblist']
= 'MXThumbList($pagename, $args, $argp)';
function MXThumbList($pagename, $args, $argp) {
  $suffix = (isset($args[0])) ? '' : 'list';
  unset($argp[''],$argp['#']);
  foreach($argp as $k => $v)
$opt .= " ".$k."=".$v;
  foreach($args as $v)
$opt .= " ".$v;
  return FmtThumbList($pagename, $opt, $suffix, '');
}

PTV example in the page:
 (:text: some long text, where I want images {(thumblist)} some more text:)
or
 (:text: some text {(thumb myimage.jpg)} some more text:)

thumblist parameters should work too.


  ~Hans


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] (:directive:) in (:mytext: this is a hidden PTV:)

2010-04-19 Thread DaveG



On 4/19/2010 8:26 PM, ABClf wrote:

Hi the list !

I was in trouble for using (:thumblist:) in a large hidden PTV
(:myptv: long text :).
Here it is my problematic source:

(:text: some long text, where I want images (:thumblist:) some more text:)

doesn't work when showing {$:text} ; I guess it is because of the
thumblist's « :) »
You might want to try defining a new markup to declare variables, and 
then use that as a wrapper for variable declarations that need to 
contain markup. You can see this in action in BlogIt, which stores blog 
entries as multi-line PTVs. The foundation is setting 
$PageTextVarPatterns. In BlogIt for example, this pattern allows this 
format [[#blogit_VARIABLE_NAME]]:...[[#blogit_VARIABLE_NAMEend]] to 
store a variable, in addition to the normal (:...:...:) pattern.


$PageTextVarPatterns['[[#anchor]]'] = '/(\[\[#blogit_(\w[_-\w]*)\]\](?: 
*\n)?)(.*?)(\[\[#blogit_\2end\]\])/s';



 ~ ~ Dave


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


[pmwiki-users] (:directive:) in (:mytext: this is a hidden PTV:)

2010-04-19 Thread ABClf
Hi the list !

I was in trouble for using (:thumblist:) in a large hidden PTV
(:myptv: long text :).
Here it is my problematic source:

(:text: some long text, where I want images (:thumblist:) some more text:)

doesn't work when showing {$:text} ; I guess it is because of the
thumblist's « :) »

Tricky (?) but working solution was to create a non hidden PTV for the
directive (included in a comment block to be hidden), then inject it
in hidden PTV, this way :

>>comment<<
images:(:thumblist:)
>><<
(:text: some long text, where I want images {$:images} some more text:)

does work when showing {$:text}

(in use there :
http://www.languefrancaise.net/Info/2008-10-27-Simonin-dans-les-collections-de-la-BNF)

As all is apparently working for me, I have no question ;)
But I would like to be informed :
-is that strategy the good one to make directive compatible with
hidden PTV (a way to avoid the breaking « :) » ?
-isn't there a possibility to make hidden PTV compatible with directive ?

Thank you,

Gilles.

-- 
---
| A | de la langue française
| B | http://www.languefrancaise.net/
| C | languefranca...@gmail.com
---

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users