You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl-cvs@perl.apache.org by ri...@apache.org on 2001/09/10 15:44:26 UTC

cvs commit: embperl/test/html asp.htm

richter     01/09/10 06:44:26

  Modified:    .        Tag: Embperl2c Changes.pod
               Embperl/Syntax Tag: Embperl2c ASP.pm Mail.pm
               test/cmp Tag: Embperl2c asp.htm
               test/html Tag: Embperl2c asp.htm
  Log:
  Embperl - enhance ASP syntax
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.129.4.27 +3 -0      embperl/Changes.pod
  
  Index: Changes.pod
  ===================================================================
  RCS file: /home/cvs/embperl/Changes.pod,v
  retrieving revision 1.129.4.26
  retrieving revision 1.129.4.27
  diff -u -r1.129.4.26 -r1.129.4.27
  --- Changes.pod	2001/07/09 07:49:01	1.129.4.26
  +++ Changes.pod	2001/09/10 13:44:25	1.129.4.27
  @@ -32,6 +32,9 @@
      - Added RTF syntax. This allows you for example to create serial letters
        with your favorite word processing program, save them as RTF and process 
        them with Embperl. See HTML::Embperl::Syntax::RTF for docs.
  +   - Fixed problem when loading syntax. Spotted by Michael Stevens.
  +   - Allow Perl code inside of HTML attributes in ASP syntax, together with
  +     EmbperlHTML syntax. SPotted by Ivan G. Shevchenko.
   
   =head1 2.0b2 (BETA)  29. Mar 2001
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.3   +163 -36   embperl/Embperl/Syntax/Attic/ASP.pm
  
  Index: ASP.pm
  ===================================================================
  RCS file: /home/cvs/embperl/Embperl/Syntax/Attic/ASP.pm,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- ASP.pm	2001/03/28 19:15:32	1.1.2.2
  +++ ASP.pm	2001/09/10 13:44:26	1.1.2.3
  @@ -10,7 +10,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: ASP.pm,v 1.1.2.2 2001/03/28 19:15:32 richter Exp $
  +#   $Id: ASP.pm,v 1.1.2.3 2001/09/10 13:44:26 richter Exp $
   #
   ###################################################################################
    
  @@ -20,7 +20,7 @@
   use HTML::Embperl::Syntax::HTML ;
   
   use strict ;
  -use vars qw{@ISA} ;
  +use vars qw{@ISA %Cmds %CmdsOutput %CmdsOutputLink} ;
   
   @ISA = qw(HTML::Embperl::Syntax::HTML) ;
   
  @@ -68,51 +68,178 @@
       my ($self) = @_ ;
   
   
  -    $self -> AddToRoot ({
  -                        'ASP Code' => {
  -                            'text' => '<%',
  -                            'end'  => '%>',
  -                            'procinfo' => 
  -                                {
  -                                embperl => 
  -                                    { 
  -                                    perlcode    => '%$c%%#0%',
  -                                    removenode  => 3,
  -                                    mayjump     => 1,
  -                                    compilechilds => 0,
  -                                    },
  -                                },
  -                            }
  -                        }) ;
  +    $self -> {-aspCmds}     = $self -> CloneHash ({ %Cmds, %CmdsOutput }) ;
  +    $self -> {-aspCmdsLink} = $self -> CloneHash ({ %Cmds, %CmdsOutputLink }, { 'unescape' => 2 }) ;
  +
  +    $self -> AddToRoot ($self -> {-aspCmds}) ;
   
       $self -> AddToRoot ({
  -                        'ASP Output' => {
  -                            'text' => '<%=',
  -                            'end'  => '%>',
  -                            'procinfo' => {
  -                                embperl => { 
  -                                        perlcode => 
  -                                            [
  -                                            'if (!defined (_ep_rp(%$x%,scalar(%#~0:$col%)))) %#~-0:$row% { if ($col == 0) { _ep_dcp (%$t%,%^*htmltable%) ; last l%^*htmltable% ; } else { _ep_dcp (%$t%,%^*htmlrow%) ; last l%^*htmlrow% ; }}',
  -                                            'if (!defined (_ep_rp(%$x%,scalar(%#~0:$col%)))) { _ep_dcp (%$t%,%^*htmlrow%) ; last l%^*htmlrow% ; }',
  -                                            'if (!defined (_ep_rp(%$x%,scalar(%#~0:$row%)))) { _ep_dcp (%$t%,%^*htmltable%) ; last l%^*htmltable% ; }',
  -                                            '_ep_rp(%$x%,scalar(%#0%));', 
  -			                    ],
  -                                        removenode  => 4,
  -                                        mayjump => '%#~0:$col|$row|$cnt% %?*htmlrow% %?*htmltable%',
  -                                        compilechilds => 0,
  -                                        }
  +        'ASP Syntax' => {
  +            'text' => '<%?syntax',
  +            'end'  => '?%>',
  +            'procinfo' => {
  +                embperl => { 
  +                        compiletimeperlcode => '$_[0] -> Syntax (HTML::Embperl::Syntax::GetSyntax(%#\'0%, $_[0] -> SyntaxName));', 
  +                        parsetimeperlcode   => '$_[0] -> Syntax (HTML::Embperl::Syntax::GetSyntax(\'%%\', $_[0] -> SyntaxName)) ;',
  +                        removenode => 3,
  +                        }
  +                    }
  +                }
  +        }) ;
  +
  +
  +
  +    }
  +
  +# ---------------------------------------------------------------------------------
  +#
  +#   Add new simple html tag (override to add asp commands inside html tags)
  +#
  +# ---------------------------------------------------------------------------------
  +
  +
  +sub AddTag
  +
  +    {
  +    my $self = shift ;
  +
  +    my $tag = $self -> HTML::Embperl::Syntax::HTML::AddTag (@_) ;
  +
  +    #### add the ASP cmd inside the new HTML Tag ####
  +
  +    $tag -> {inside} ||= {} ;
  +    my $inside = $tag -> {inside} ;    
  +
  +    while (my ($k, $v) = each (%{$self -> {-aspCmds}}))
  +        {
  +        $inside -> {$k} = $v ;
  +        }
  +
  +    if (!$self -> {-aspHTMLInit})
  +        {
  +        #### if not already done add the ASP cmds inside the HTML Attributes ####
  +
  +        $self -> {-aspHTMLInit} = 1 ;
  +
  +        my $unescape = 0 ;
  +        foreach ('', 'Link')
  +            {
  +            my $attr   = $self -> {"-htmlAssignAttr$_"} ;
  +            my $blocks = $self -> {"-aspCmds$_"} ;
  +            while (my ($k1, $v1) = each %$attr)
  +                {
  +                if (!($k1 =~ /^-/) && ref ($v1) eq 'HASH')
  +                    {
  +                    my $follow = $v1 -> {follow} ;
  +                    if (ref($follow) eq 'HASH')
  +                        {
  +                        while (my ($k2, $v2) = each %$follow)
  +                            {
  +                            if (ref($v2) eq 'HASH')
  +				{	  
  +				$v2 -> {inside} ||= {} ;
  +                            	my $inside = $v2 -> {inside} ;
  +
  +	                        while (my ($k, $v) = each (%$blocks))
  +                                    {
  +                                    $inside -> {$k} = $v ;
                                       }
  +				}
                               }
  -                        }) ;
  +                        }
  +                    }
  +                }
  +            }
  +
  +        my $quotes = $self -> {"-htmlQuotes"} ;
  +        my $blocks = $self -> {"-aspCmds"} ;
  +        while (my ($k2, $v2) = each %$quotes)
  +            {
  +            if (ref($v2) eq 'HASH')
  +		{	  
  +		$v2 -> {inside} ||= {} ;
  +                my $inside = $v2 -> {inside} ;
  +
  +	        while (my ($k, $v) = each (%$blocks))
  +                    {
  +                    $inside -> {$k} = $v ;
  +                    }
  +		}
  +            }
  +        }
  +    return $tag ;
       }
   
  -
   ###################################################################################
   #
   #   ASP Implementation
   #
   ###################################################################################
  +
  +
  +
  +
  +%Cmds = (
  +    '-lsearch' => 1,
  +    'ASP Code' => {
  +        'text' => '<%',
  +        'end'  => '%>',
  +        'procinfo' => 
  +            {
  +            embperl => 
  +                { 
  +                perlcode    => '%$c%%#0%',
  +                removenode  => 3,
  +                mayjump     => 1,
  +                compilechilds => 0,
  +                },
  +            },
  +        }
  +    ) ;
  +
  +%CmdsOutput = (
  +    'ASP Output' => {
  +        'text' => '<%=',
  +        'end'  => '%>',
  +        'procinfo' => {
  +            embperl => { 
  +                    perlcode => 
  +                        [
  +                        'if (!defined (_ep_rp(%$x%,scalar(%#~0:$col%)))) %#~-0:$row% { if ($col == 0) { _ep_dcp (%$t%,%^*htmltable%) ; last l%^*htmltable% ; } else { _ep_dcp (%$t%,%^*htmlrow%) ; last l%^*htmlrow% ; }}',
  +                        'if (!defined (_ep_rp(%$x%,scalar(%#~0:$col%)))) { _ep_dcp (%$t%,%^*htmlrow%) ; last l%^*htmlrow% ; }',
  +                        'if (!defined (_ep_rp(%$x%,scalar(%#~0:$row%)))) { _ep_dcp (%$t%,%^*htmltable%) ; last l%^*htmltable% ; }',
  +                        '_ep_rp(%$x%,scalar(%#0%));', 
  +			],
  +                    removenode  => 4,
  +                    mayjump => '%#~0:$col|$row|$cnt% %?*htmlrow% %?*htmltable%',
  +                    compilechilds => 0,
  +                    }
  +                }
  +        }
  +    ) ;
  +
  +%CmdsOutputLink = (
  +    'ASP Output Link' => {
  +        'text' => '<%=',
  +        'end'  => '%>',
  +        'nodename' => '<%=url',
  +        'unescape' => 2,
  +       'procinfo' => {
  +            embperl => { 
  +                    perlcode => 
  +                        [
  +                        'if (!defined (_ep_rpurl(%$x%,scalar(%#~0:$col%)))) %#~-0:$row% { if ($col == 0) { _ep_dcp (%$t%,%^*htmltable%) ; last l%^*htmltable% ; } else { _ep_dcp (%$t%,%^*htmlrow%) ; last l%^*htmlrow% ; }}',
  +                        'if (!defined (_ep_rpurl(%$x%,scalar(%#~0:$col%)))) { _ep_dcp (%$t%,%^*htmlrow%) ; last l%^*htmlrow% ; }',
  +                        'if (!defined (_ep_rpurl(%$x%,scalar(%#~0:$row%)))) { _ep_dcp (%$t%,%^*htmltable%) ; last l%^*htmltable% ; }',
  +                        '_ep_rpurl(%$x%,scalar(%#0%));', 
  +			],
  +                    removenode  => 4,
  +                    mayjump => '%#~0:$col|$row|$cnt% %?*htmlrow% %?*htmltable%',
  +                    compilechilds => 0,
  +                    }
  +                }
  +        }
  +    ) ;
   
   
   1; 
  
  
  
  1.1.2.4   +2 -1      embperl/Embperl/Syntax/Attic/Mail.pm
  
  Index: Mail.pm
  ===================================================================
  RCS file: /home/cvs/embperl/Embperl/Syntax/Attic/Mail.pm,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- Mail.pm	2001/03/28 19:15:33	1.1.2.3
  +++ Mail.pm	2001/09/10 13:44:26	1.1.2.4
  @@ -10,7 +10,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: Mail.pm,v 1.1.2.3 2001/03/28 19:15:33 richter Exp $
  +#   $Id: Mail.pm,v 1.1.2.4 2001/09/10 13:44:26 richter Exp $
   #
   ###################################################################################
    
  @@ -71,6 +71,7 @@
                                           'mailhost', 'mailhelo', 'maildebug'], undef, undef, 
                   { 
                   removenode  =>  42,
  +                perlcode =>  {},
                   perlcodeend =>  q{
                       {
                       use HTML::Embperl::Mail ;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +4 -2      embperl/test/cmp/Attic/asp.htm
  
  Index: asp.htm
  ===================================================================
  RCS file: /home/cvs/embperl/test/cmp/Attic/asp.htm,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- asp.htm	2001/03/27 19:07:56	1.1.2.1
  +++ asp.htm	2001/09/10 13:44:26	1.1.2.2
  @@ -6,7 +6,6 @@
   
   <body>
   
  -
   <table border=1>
       <tr>
               <td>1</td>
  @@ -29,8 +28,11 @@
               <td>11</td>
           </tr>
       </table>
  -
   
  +<a href="11">
  +<a href="p%25u%26g%3D���">
  +<a p%u&amp;g=&auml;&ouml;&uuml; href="xxx">
  +esc = p%u&amp;g=&auml;&ouml;&uuml;
   </body>
   </html>
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +7 -2      embperl/test/html/Attic/asp.htm
  
  Index: asp.htm
  ===================================================================
  RCS file: /home/cvs/embperl/test/html/Attic/asp.htm,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- asp.htm	2001/03/27 19:07:56	1.1.2.1
  +++ asp.htm	2001/09/10 13:44:26	1.1.2.2
  @@ -6,9 +6,8 @@
   
   <body>
   
  +[$ syntax ASP EmbperlHTML $]
   
  -[$ syntax ASP $]
  -
   <% $a = 1 ; %>
   <table border=<%= $a %>>
       <% foreach (1..5) { %>
  @@ -18,6 +17,12 @@
           </tr>
       <% } %>
   </table>
  +
  +<a href="<%= $a %>">
  +<% $esc = 'p%u&g=���' ; %>
  +<a href="<%= $esc %>">
  +<a <%= $esc %> href="xxx">
  +esc = <%= $esc %>
   
   
   </body>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-cvs-help@perl.apache.org