[pmwiki-users] ParseArgs problem with value containing spaces

Tony Colley frodo1990 at yahoo.com
Wed Sep 6 13:10:21 CDT 2006


I'm trying to add a style= key/value argument to a directive, and having a problem with ParseArgs not working as I expect.

I tried my sample syntax at Cookbook/ParseArgs#demo and it seemed to parse it just fine. However, it doesn't work in my code. I just updated my PmWiki from SVN (rev 1582) and it still doesn't work.

Specifically, I have a directive that I define as

   Markup( 'hrule', 'directives', '/\\(:hr (.*?):\\)/e', "Keep(Hrule('$1'))" );

   function Hrule( $args ) 
   {
       // debug output
       print "<pre>";
       print_r( $args );
       print "</pre>\n";
   
       $args = ParseArgs( $args );
   
       // debug output
       print "<pre>";
       print_r( $args );
       print "</pre>\n";

       ....

When I enter 

   (:hr style="height: 1px; width: 1px;":)

I see this debug output:

   style=\"height: 1px; width: 1px;\"

   Array
   (
    [#] => Array
        (
            [0] => style
            [1] => \"height:
            [2] => 
            [3] => 1px;
            [4] => width
            [5] => width:
            [6] => 
            [7] => 1px;\"
        )

    [style] => \"height:
    [] => Array
        (
            [0] => 1px;
            [1] => 1px;\"
        )

    [width] => width:
   )

However, when I enter

   style="height: 1px; width: 2px;"

into the ParseArgs field at http://www.pmwiki.org/wiki/Cookbook/ParseArgs#demo and click the ParseArgs button, I see:

  Key            Value(s)
  ---------      --------
  $arg['#']      (array) 'style' 'height: 1px; width: 2px;'
  $arg['style'] 'height: 1px; width: 2px;'

What am I doing wrong or differently than whatever the ParseArgs button on pmwiki.org is doing?

--Tony



~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Whenever a theory appears to you as the only possible one,
take this as a sign that you have neither understood the theory
nor the problem which it was intended to solve. -- Karl Popper
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
HOME PAGE: www.awcfamily.com

I have no control over anything that appears after this sentence.
 		
---------------------------------
How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-users/attachments/20060906/eeb9130c/attachment.html 


More information about the pmwiki-users mailing list