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/03/28 14:58:26 UTC
cvs commit: embperl/test/html mail.htm
richter 01/03/28 04:58:26
Modified: . Tag: Embperl2c DOM.xs README.v2 epcomp.c epdom.c
epdom.h
Embperl Tag: Embperl2c Syntax.pm
Embperl/Syntax Tag: Embperl2c Mail.pm
test/html Tag: Embperl2c mail.htm
Log:
Embperl 2 - mail taglib & docs
Revision Changes Path
No revision
No revision
1.1.2.9 +15 -1 embperl/DOM.xs
Index: DOM.xs
===================================================================
RCS file: /home/cvs/embperl/DOM.xs,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -r1.1.2.8 -r1.1.2.9
--- DOM.xs 2001/03/28 10:07:30 1.1.2.8
+++ DOM.xs 2001/03/28 12:58:18 1.1.2.9
@@ -10,7 +10,7 @@
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: DOM.xs,v 1.1.2.8 2001/03/28 10:07:30 richter Exp $
+# $Id: DOM.xs,v 1.1.2.9 2001/03/28 12:58:18 richter Exp $
#
###################################################################################
@@ -186,6 +186,20 @@
xNewParent = Node_cloneNode (pDomTree, xParent, 1) ;
DomTree_selfCheckpoint (pDomTree, xParent, xNewParent) ;
Node_appendChild (pDomTree, nType, 0, sT, nText, xNewParent, 0, 0) ;
+
+
+char *
+embperl_Node_iChildsText (xDomTree, xChild)
+ int xDomTree
+ int xChild
+CODE:
+ char * sText = Node_childsText (DomTree_self (xDomTree), xChild) ;
+ RETVAL = sText?sText:"" ;
+OUTPUT:
+ RETVAL
+CLEANUP:
+ StringFree (&sText) ;
+
################################################################################
1.1.4.9 +36 -10 embperl/Attic/README.v2
Index: README.v2
===================================================================
RCS file: /home/cvs/embperl/Attic/README.v2,v
retrieving revision 1.1.4.8
retrieving revision 1.1.4.9
diff -u -r1.1.4.8 -r1.1.4.9
--- README.v2 2001/03/28 11:03:49 1.1.4.8
+++ README.v2 2001/03/28 12:58:19 1.1.4.9
@@ -9,7 +9,7 @@
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-$Id: README.v2,v 1.1.4.8 2001/03/28 11:03:49 richter Exp $
+$Id: README.v2,v 1.1.4.9 2001/03/28 12:58:19 richter Exp $
### !! IMPORTANT !! IMPORTANT !! IMPORTANT !! IMPORTANT !! IMPORTANT !!
@@ -193,20 +193,46 @@
Used to tell Embperl which syntax to use inside a page. Embperl comes with
the following syntaxes:
-- EmbperlHTML
-- EmbperlBlocks
-- Embperl (default; contains EmbperlHtml and EmbperlBlocks)
-- ASP
-- SSI
-- Perl
-- Text
-- Mail
+ - EmbperlHTML # all the HTML tag that Embperl recognizes by default
+ - EmbperlBlocks # all the [ ] blocks that Embperl supports
+ - Embperl # (default; contains EmbperlHtml and EmbperlBlocks)
+ - ASP # <% %> and <%= %>, see perldoc HTML::Embperl::Syntax::ASP
+ - SSI # Server Side Includes, see perldoc HTML::Embperl::Syntax::SSI
+ - Perl # File contains pure Perl (similar to Apache::Registry), but
+ # can be used inside EmbperlObject
+ - Text # File contains only Text, no actions is taken on the Text
+ - Mail # Defines the <mail:send> tag, for sending mail. This is an
+ # example for a taglib, which could be a base for writing
+ # your own taglib to extent the number of available tags
You can get a description for each syntax if you type
-perldoc HTML::Embperl::Syntax::xxx
+ perldoc HTML::Embperl::Syntax::xxx
where xxx is the name of the syntax.
+
+You can also specify multiple syntaxes e.g.
+
+ PerlSetEnv EMBPERL_SYNTAX "Embperl SSI"
+
+ Execute ({inputfile => '*', syntax => 'Embperl ASP'}) ;
+
+The syntax metacommand allows to switch the syntax or to
+add or subtract syntaxes e.g.
+
+ [$ syntax + Mail $]
+
+will add the Mail taglib so the <mail:send> tag is available after
+this line.
+
+ [$ syntax - Mail $]
+
+now the <mail:send> tag is unknown again
+
+ [$ syntax SSI $]
+
+now you can only use SSI commands inside your page.
+
-------------------
1.4.2.43 +5 -2 embperl/Attic/epcomp.c
Index: epcomp.c
===================================================================
RCS file: /home/cvs/embperl/Attic/epcomp.c,v
retrieving revision 1.4.2.42
retrieving revision 1.4.2.43
diff -u -r1.4.2.42 -r1.4.2.43
--- epcomp.c 2001/03/28 10:07:30 1.4.2.42
+++ epcomp.c 2001/03/28 12:58:19 1.4.2.43
@@ -9,7 +9,7 @@
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: epcomp.c,v 1.4.2.42 2001/03/28 10:07:30 richter Exp $
+# $Id: epcomp.c,v 1.4.2.43 2001/03/28 12:58:19 richter Exp $
#
###################################################################################*/
@@ -1001,11 +1001,14 @@
lprintf (pCurrReq, "[%d]EPCOMP: #%d L%d Set Checkpoint pending\n", pCurrReq -> nPid, pNode -> xNdx, pNode -> nLinenumber) ;
}
+ if (pCmd -> bRemoveNode & 64)
+ pNode -> bFlags |= nflgIgnoreChilds ;
+
if (pCmd -> bRemoveNode & 1)
pNode -> bFlags = 0 ;
else if (pCmd -> bRemoveNode & 8)
pNode -> bFlags |= nflgIgnore ;
- else if (pCmd -> bRemoveNode & 16)
+ if (pCmd -> bRemoveNode & 16)
{
tNodeData * pChild ;
while (pChild = Node_selfFirstChild (pDomTree, pNode))
1.4.2.28 +41 -3 embperl/Attic/epdom.c
Index: epdom.c
===================================================================
RCS file: /home/cvs/embperl/Attic/epdom.c,v
retrieving revision 1.4.2.27
retrieving revision 1.4.2.28
diff -u -r1.4.2.27 -r1.4.2.28
--- epdom.c 2001/03/28 10:07:31 1.4.2.27
+++ epdom.c 2001/03/28 12:58:20 1.4.2.28
@@ -9,7 +9,7 @@
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: epdom.c,v 1.4.2.27 2001/03/28 10:07:31 richter Exp $
+# $Id: epdom.c,v 1.4.2.28 2001/03/28 12:58:20 richter Exp $
#
###################################################################################*/
@@ -584,9 +584,11 @@
SvREFCNT_dec (pSVNdx) ;
+ /*
if (nNdx < 6 || nNdx == 92)
lprintf (pCurrReq, "free string %s (#%d) refcnt=%d\n", Ndx2String (nNdx), nNdx, SvREFCNT(pSVNdx)) ;
-
+ */
+
if (SvREFCNT(pSVNdx) == 1)
{
int n ;
@@ -2037,6 +2039,42 @@
}
+/* ------------------------------------------------------------------------ */
+/* */
+/* Node_childsText (xNode) ; */
+/* */
+/* Get the text of all child nodes in one string */
+/* */
+/* ------------------------------------------------------------------------ */
+
+
+char * Node_childsText (/*in*/ tDomTree * pDomTree,
+ /*in*/ tNode xNode)
+
+ {
+ tNodeData * pParent = Node_self (pDomTree, xNode) ;
+ tNodeData * pNode ;
+ char * sNodeText ;
+ char * sText = NULL ;
+
+ if (pParent)
+ {
+ StringNew (&sText, 1024) ;
+ pNode = Node_selfFirstChild (pDomTree, pParent) ;
+ while (pNode)
+ {
+ sNodeText = Node_selfNodeName(pNode) ;
+ StringAdd (&sText, sNodeText, 0) ;
+
+ pNode = Node_selfNextSibling (pDomTree, pNode) ;
+ }
+
+ }
+ return sText ;
+ }
+
+
+
/* ------------------------------------------------------------------------ */
/* */
@@ -2239,7 +2277,7 @@
if (nOrderNdx == nOrderIndexNode)
nOrderNdx++ ;
- if (pNode -> nType == ntypDocumentFraq)
+ if (pNode -> nType == ntypDocumentFraq || (pNode -> bFlags & nflgIgnoreChilds))
pNextNode = NULL ;
else
pNextNode = Node_selfFirstChild (pDomTree, pNode) ;
1.4.2.13 +4 -1 embperl/Attic/epdom.h
Index: epdom.h
===================================================================
RCS file: /home/cvs/embperl/Attic/epdom.h,v
retrieving revision 1.4.2.12
retrieving revision 1.4.2.13
diff -u -r1.4.2.12 -r1.4.2.13
--- epdom.h 2001/03/28 10:07:31 1.4.2.12
+++ epdom.h 2001/03/28 12:58:20 1.4.2.13
@@ -9,7 +9,7 @@
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: epdom.h,v 1.4.2.12 2001/03/28 10:07:31 richter Exp $
+# $Id: epdom.h,v 1.4.2.13 2001/03/28 12:58:20 richter Exp $
#
###################################################################################*/
@@ -136,6 +136,7 @@
nflgModified = 16,
nflgCheckpoint = 32,
nflgReturn = 64,
+ nflgIgnoreChilds= 128,
} ;
enum tAttrFlags
@@ -332,6 +333,8 @@
/*in*/ int nEscMode,
/*in*/ int bFlags) ;
+char * Node_childsText (/*in*/ tDomTree * pDomTree,
+ /*in*/ tNode xNode) ;
No revision
No revision
1.1.4.30 +59 -750 embperl/Embperl/Attic/Syntax.pm
Index: Syntax.pm
===================================================================
RCS file: /home/cvs/embperl/Embperl/Attic/Syntax.pm,v
retrieving revision 1.1.4.29
retrieving revision 1.1.4.30
diff -u -r1.1.4.29 -r1.1.4.30
--- Syntax.pm 2001/03/27 07:09:28 1.1.4.29
+++ Syntax.pm 2001/03/28 12:58:22 1.1.4.30
@@ -10,7 +10,7 @@
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: Syntax.pm,v 1.1.4.29 2001/03/27 07:09:28 richter Exp $
+# $Id: Syntax.pm,v 1.1.4.30 2001/03/28 12:58:22 richter Exp $
#
###################################################################################
@@ -361,806 +361,115 @@
__END__
-###################################################################################
-#
-# Default Syntax
-#
-###################################################################################
+=pod
+=head1 NAME
+Embperl base class for defining custom syntaxes
+=head1 SYNOPSIS
-%Attr = (
- '-lsearch' => 1,
- 'Attribut ""' =>
- {
- 'text' => '"',
- 'end' => '"',
- 'inside' => \%Cmds,
- 'nodetype' => ntypAttr,
- #'cdatatype' => ntypAttrValue,
- },
- 'Attribut \'\'' =>
- {
- 'text' => '\'',
- 'end' => '\'',
- 'inside' => \%Cmds,
- 'nodetype' => ntypAttr,
- #'cdatatype' => ntypAttrValue,
- },
- 'Attribut alphanum' =>
- {
- 'contains' => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789',
- 'inside' => \%Cmds,
- 'nodetype' => ntypAttr,
- #'cdatatype' => ntypAttrValue,
- }
- ) ;
+=head1 DESCRIPTION
-%AssignAttr = (
- 'Assign' =>
- {
- 'text' => '=',
- 'follow' => \%Attr,
- }
- ) ;
-
-
-%AssignAttrLink = (
- 'Assign' =>
- {
- 'text' => '=',
- 'follow' => \%AttrLink,
- }
- ) ;
+HTML::Embperl::Syntax provides a base class from which all custom syntaxes
+should be derived. Currently Embperl comes with the following derived syntaxes:
+=over 4
-%Cmds = (
- '-lsearch' => 1,
- 'Embperl command escape' => {
- 'text' => '[[',
- 'nodename' => '[',
- 'nodetype' => ntypCDATA,
- },
- 'Embperl meta command' => {
- 'text' => '[$',
- 'end' => '$]',
- 'follow' => \%MetaCmds,
- 'unescape' => 1,
- },
- 'Embperl output code' => {
- 'text' => '[+',
- 'end' => '+]',
- 'unescape' => 1,
- 'procinfo' => {
- embperl => {
- perlcode =>
- [
- #'if (!defined (_ep_rp(%$n%,scalar(do{%#~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(%$n%,scalar(do{%#~0:$col%})))) { _ep_dcp (%$t%,%^*htmlrow%) ; last l%^*htmlrow% ; }',
- #'if (!defined (_ep_rp(%$n%,scalar(do{%#~0:$row%})))) { _ep_dcp (%$t%,%^*htmltable%) ; last l%^*htmltable% ; }',
- #'_ep_rp(%$n%,scalar(do{%#0%}));',
- #'_ep_rp(%$n%,scalar (%#0%));',
- '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,
- }
- },
- },
- 'Embperl code' => {
- 'text' => '[-',
- 'end' => '-]',
- 'unescape' => 1,
- 'procinfo' => {
- embperl => {
- perlcode => [
- #'$_ep_node=%$l%;if (!defined (scalar(do{%#~0:$col%}))) %#~-0:$row% { if ($col == 0) { _ep_dcp (%$t%,%^*htmltable%) ; last l%^*htmltable% ; } else { _ep_dcp (%$t%,%^*htmlrow%) ; last l%^*htmlrow% ; }}',
- #'$_ep_node=%$l%;if (!defined (scalar(do{%#~0:$col%}))) { _ep_dcp (%$t%,%^*htmlrow%) ; last l%^*htmlrow% ; }',
- #'$_ep_node=%$l%;if (!defined (scalar(do{%#~0:$row%}))) { _ep_dcp (%$t%,%^*htmltable%) ; last l%^*htmltable% ; }',
- #'$_ep_node=%$l%;{%#0%;}',
- '%$c%if (!defined (scalar(do{%#~0:$col%}))) %#~-0:$row% { if ($col == 0) { _ep_dcp (%$t%,%^*htmltable%) ; last l%^*htmltable% ; } else { _ep_dcp (%$t%,%^*htmlrow%) ; last l%^*htmlrow% ; }}',
- '%$c%if (!defined (scalar(do{%#~0:$col%}))) { _ep_dcp (%$t%,%^*htmlrow%) ; last l%^*htmlrow% ; }',
- '%$c%if (!defined (scalar(do{%#~0:$row%}))) { _ep_dcp (%$t%,%^*htmltable%) ; last l%^*htmltable% ; }',
- '%$c%{%#0%;}',
- ],
- removenode => 3,
- #removenode => 10,
- mayjump => 1,
- compilechilds => 0,
- },
- },
- },
- 'Embperl global code' => {
- 'text' => '[*',
- 'end' => '*]',
- 'unescape' => 1,
- 'procinfo' => {
- embperl => {
- perlcode => '%$c%%#0%',
- removenode => 3,
- mayjump => 1,
- compilechilds => 0,
- },
- },
- },
- 'Embperl startup code' => {
- 'text' => '[!',
- 'end' => '!]',
- 'unescape' => 1,
- 'procinfo' => {
- embperl => {
- compiletimeperlcode => '%#0%;',
- removenode => 3,
- compilechilds => 0,
- }
- },
- },
- 'Embperl comment' => {
- 'text' => '[#',
- 'end' => '#]',
-# 'inside' => \%MetaComment,
- 'procinfo' => {
- embperl => {
- compilechilds => 0,
- removenode => 3,
- },
- },
- },
- ) ;
-
-%MetaComment = (
- '-lsearch' => 1,
- 'Embperl comment' => {
- 'text' => '[#',
- 'end' => '#]',
- 'inside' => \%MetaComment
- },
-) ;
+=item EmbperlHTML
+all the HTML tag that Embperl recognizes by default
-%HtmlTagsStd = (
- #'cdatatype' => ntypAttrValue,
- 'inside' => \%Cmds,
- ) ;
+=item EmbperlBlocks
+all the [ ] blocks that Embperl supports
-%ProcInfoTable = (
- embperl => {
- perlcode => 'l%$x%: for (my $row = 0; $row < $maxrow; $row++) {' ,
- perlcodeend => '} %?*-htmltable%' ,
- perlcoderemove => 1,
- stackname => 'htmltable',
- 'push' => '%$x%',
- mayjump => 1,
- }
- ) ;
+=item Embperl
+The default syntax; is derived from C<EmbperlHtml> and C<EmbperlBlocks>
-%HtmlTags = (
- 'input' => {
- 'text' => 'input',
- #'cdatatype' => ntypAttrValue,
- 'inside' =>
- {
- 'type' => { 'text' => 'type', 'nodename' => 'type', follow => \%AssignAttr },
- 'name' => { 'text' => 'name', 'nodename' => 'name', follow => \%AssignAttr },
- 'value' => { 'text' => 'value', 'nodename' => 'value', follow => \%AssignAttr },
- 'checked' => { 'text' => 'checked', 'nodetype' => ntypAttr, },
- %Cmds,
- },
- 'procinfo' => {
- embperl => {
- perlcode =>
- [
- 'HTML::Embperl::Cmd::InputCheck (%$n%, %&*\'name%, %&*\'value%) ; %&=-type:radio|checkbox% ',
- '$idat{%&*\'name%}=$fdat{%&*\'name%} ; _ep_sa(%$n%, \'value\', $fdat{%&*\'name%} || \'\') ; %&!-value%',
- '$idat{%&*\'name%}=%&*\'value% ; ',
- ]
- }
- },
- },
- 'textarea' => {
- 'text' => 'textarea',
- 'nodetype' => ntypStartTag,
- #'cdatatype' => ntypAttrValue,
- 'inside' =>
- {
- 'name' => { 'text' => 'name', 'nodename' => 'name', follow => \%AssignAttr },
- %Cmds,
- },
- 'procinfo' => {
- embperl => {
- perlcode =>
- [
- '$idat{%&*\'name%}=$fdat{%&*\'name%};_ep_ac(%$n%, HTML::Embperl::Syntax::ntypText, $fdat{%&*\'name%}) ; %#!-0%',
- '$idat{%&*\'name%}=\'%#*0%\' ; ',
- ]
- }
- },
- },
- '/textarea' => {
- 'text' => '/textarea',
- 'nodetype' => ntypEndTag,
- 'cdatatype' => 0,
- 'starttag' => 'textarea',
- },
- 'tr' => {
- 'text' => 'tr',
- 'nodetype' => ntypStartTag,
- %HtmlTagsStd,
- 'procinfo' => {
- embperl => {
- perlcode => 'l%$x%: for (my $col = 0; $col < $maxcol; $col++) {' ,
- perlcodeend => '} %?*-htmlrow%' ,
- perlcoderemove => 1,
- stackname => 'htmlrow',
- 'push' => '%$x%',
- mayjump => 1,
- }
- },
- },
- '/tr' => {
- 'text' => '/tr',
- 'nodetype' => ntypEndTag,
- 'cdatatype' => 0,
- 'starttag' => 'tr',
- },
- 'table' => {
- 'text' => 'table',
- 'nodetype' => ntypStartTag,
- %HtmlTagsStd,
- 'procinfo' => \%ProcInfoTable,
- },
- '/table' => {
- 'text' => '/table',
- 'nodetype' => ntypEndTag,
- 'cdatatype' => 0,
- 'starttag' => 'table',
- },
- 'ol' => {
- 'text' => 'ol',
- 'nodetype' => ntypStartTag,
- %HtmlTagsStd,
- 'procinfo' => \%ProcInfoTable,
- },
- '/ol' => {
- 'text' => '/ol',
- 'nodetype' => ntypEndTag,
- 'cdatatype' => 0,
- 'starttag' => 'ol',
- },
- 'ul' => {
- 'text' => 'ul',
- 'nodetype' => ntypStartTag,
- %HtmlTagsStd,
- 'procinfo' => \%ProcInfoTable,
- },
- '/ul' => {
- 'text' => '/ul',
- 'nodetype' => ntypEndTag,
- 'cdatatype' => 0,
- 'starttag' => 'ul',
- },
- 'dl' => {
- 'text' => 'dl',
- 'nodetype' => ntypStartTag,
- %HtmlTagsStd,
- 'procinfo' => \%ProcInfoTable,
- },
- '/dl' => {
- 'text' => '/dl',
- 'nodetype' => ntypEndTag,
- 'cdatatype' => 0,
- 'starttag' => 'dl',
- },
- 'menu' => {
- 'text' => 'menu',
- 'nodetype' => ntypStartTag,
- %HtmlTagsStd,
- 'procinfo' => \%ProcInfoTable,
- },
- '/menu' => {
- 'text' => '/menu',
- 'nodetype' => ntypEndTag,
- 'cdatatype' => 0,
- 'starttag' => 'menu',
- },
- 'dir' => {
- 'text' => 'dir',
- 'nodetype' => ntypStartTag,
- %HtmlTagsStd,
- 'procinfo' => \%ProcInfoTable,
- },
- '/dir' => {
- 'text' => '/dir',
- 'nodetype' => ntypEndTag,
- 'cdatatype' => 0,
- 'starttag' => 'dir',
- },
-# 'th' => {
-# 'text' => 'th',
-# 'nodetype' => ntypStartTag,
-# %HtmlTagsStd,
-# },
-# '/th' => {
-# 'text' => '/th',
-# 'nodetype' => ntypEndTag,
-# 'cdatatype' => 0,
-# 'starttag' => 'th',
-# },
- 'select' => {
- 'text' => 'select',
- 'nodetype' => ntypStartTag,
- 'inside' =>
- {
- 'name' => { 'text' => 'name', 'nodename' => 'name', follow => \%AssignAttr },
- %Cmds,
- },
- 'procinfo' => {
- embperl => {
- stackname2 => 'htmlselect',
- push2 => '%&*name%',
-
- perlcode => 'l%$x%: for (my $row = 0; $row < $maxrow; $row++) {' ,
- perlcodeend => '} %?*-htmltable%' ,
- perlcoderemove => 1,
- stackname => 'htmltable',
- 'push' => '%$x%',
- mayjump => 1,
- }
- },
- },
- 'option' => {
- 'text' => 'option',
- 'nodetype' => ntypTag,
- %HtmlTagsStd,
- 'inside' =>
- {
- 'value' => { 'text' => 'value', 'nodename' => 'value', follow => \%AssignAttr },
- 'selected' => { 'text' => 'selected', 'nodetype' => ntypAttr, },
- %Cmds,
- },
- 'procinfo' => {
- embperl => {
- perlcode =>
- [
- '_ep_opt (%$n%, %^*\'htmlselect%, %&*\'value%);',
- '_ep_opt (%$n%, %^*\'htmlselect%, %>*\'0%);',
- ]
- }
- },
- },
- '/option' => {
- 'text' => '/option',
- 'nodetype' => ntypTag,
- 'cdatatype' => 0,
- 'starttag' => 'option',
- },
- '/select' => {
- 'text' => '/select',
- 'nodetype' => ntypEndTag,
- 'cdatatype' => 0,
- 'starttag' => 'select',
- },
- 'body' => {
- 'text' => 'body',
- %HtmlTagsStd,
- },
- 'a' => {
- 'text' => 'a',
- #'cdatatype' => ntypAttrValue,
- 'inside' => \%HrefLink,
- },
- 'frame' => {
- 'text' => 'frame',
- 'inside' => \%SrcLink,
- #'cdatatype' => ntypAttrValue,
- },
- 'iframe' => {
- 'text' => 'iframe',
- 'inside' => \%SrcLink,
- #'cdatatype' => ntypAttrValue,
- },
- 'embed' => {
- 'text' => 'embed',
- #'cdatatype' => ntypAttrValue,
- 'inside' => \%SrcLink,
- },
- 'layer' => {
- 'text' => 'layer',
- #'cdatatype' => ntypAttrValue,
- 'inside' => \%SrcLink,
- },
- 'img' => {
- 'text' => 'img',
- #'cdatatype' => ntypAttrValue,
- 'inside' => \%SrcLink,
- },
- 'form' => {
- 'text' => 'form',
- #'cdatatype' => ntypAttrValue,
- 'inside' => \%ActionLink,
- },
-
- ) ;
-
-
-%MetaCmds = (
- 'if' => {
- 'text' => 'if',
- 'nodetype' => ntypTag,
- 'forcetype' => 1,
- 'cdatatype' => ntypAttrValue,
- 'unescape' => 1,
- 'endtag' => 'endif',
- 'procinfo' => {
- embperl => {
- perlcode => 'if (%&<noname>%) { ',
- removenode => 10,
- mayjump => 1,
- stackname => 'metacmd',
- 'push' => 'if',
- }
- },
- },
- 'else' => {
- 'text' => 'else',
- 'nodetype' => ntypTag,
- 'forcetype' => 1,
- 'unescape' => 1,
- 'endtag' => 'endif',
- 'procinfo' => {
- embperl => {
- perlcode => '} else {',
- removenode => 10,
- mayjump => 1,
- stackname => 'metacmd',
- stackmatch => 'if',
- 'push' => 'if',
- }
- },
- },
- 'endif' => {
- 'text' => 'endif',
- 'nodetype' => ntypTag,
- 'forcetype' => 1,
- 'cdatatype' => 0,
- 'procinfo' => {
- embperl => {
- perlcode => '}',
- removenode => 10,
- mayjump => 1,
- stackname => 'metacmd',
- stackmatch => 'if',
- }
- },
- },
- 'elsif' => {
- 'text' => 'elsif',
- 'nodetype' => ntypTag,
- 'forcetype' => 1,
- 'cdatatype' => ntypAttrValue,
- 'unescape' => 1,
- 'endtag' => 'endif',
- 'procinfo' => {
- embperl => {
- perlcode => '} elsif (%&<noname>%) { ',
- removenode => 10,
- mayjump => 1,
- stackname => 'metacmd',
- stackmatch => 'if',
- 'push' => 'if',
- }
- },
- },
- 'while' => {
- 'text' => 'while',
- 'nodetype' => ntypTag,
- 'cdatatype' => ntypAttrValue,
- 'forcetype' => 1,
- 'unescape' => 1,
- 'endtag' => 'endwhile',
- 'procinfo' => {
- embperl => {
- perlcode => 'while (%&<noname>%) { ',
- removenode => 10,
- mayjump => 1,
- stackname => 'metacmd',
- 'push' => 'while',
- }
- },
- },
- 'endwhile' => {
- 'text' => 'endwhile',
- 'nodetype' => ntypTag,
- 'forcetype' => 1,
- 'cdatatype' => 0,
- 'procinfo' => {
- embperl => {
- perlcode => '};',
- removenode => 10,
- mayjump => 1,
- stackname => 'metacmd',
- stackmatch => 'while',
- }
- },
- },
- 'foreach' => {
- 'text' => 'foreach',
- 'nodetype' => ntypTag,
- 'cdatatype' => ntypAttrValue,
- 'forcetype' => 1,
- 'unescape' => 1,
- 'endtag' => 'endforeach',
- 'procinfo' => {
- embperl => {
- perlcode => 'foreach %&<noname>% { ',
- removenode => 10,
- mayjump => 1,
- stackname => 'metacmd',
- 'push' => 'foreach',
- }
- },
- },
- 'endforeach' => {
- 'text' => 'endforeach',
- 'nodetype' => ntypTag,
- 'forcetype' => 1,
- 'cdatatype' => 0,
- 'procinfo' => {
- embperl => {
- perlcode => '};',
- removenode => 10,
- mayjump => 1,
- stackname => 'metacmd',
- stackmatch => 'foreach',
- }
- },
- },
- 'do' => {
- 'text' => 'do',
- 'nodetype' => ntypTag,
- 'cdatatype' => 0,
- 'forcetype' => 1,
- 'unescape' => 1,
- 'endtag' => 'until',
- 'procinfo' => {
- embperl => {
- perlcode => 'do { ',
- removenode => 10,
- mayjump => 1,
- stackname => 'metacmd',
- 'push' => 'do',
- }
- },
- },
- 'until' => {
- 'text' => 'until',
- 'nodetype' => ntypTag,
- 'forcetype' => 1,
- 'cdatatype' => ntypAttrValue,
- 'unescape' => 1,
- 'procinfo' => {
- embperl => {
- perlcode => '} until (%&<noname>%) ; ',
- removenode => 10,
- mayjump => 1,
- stackname => 'metacmd',
- stackmatch => 'do',
- }
- },
- },
- 'var' => {
- 'text' => 'var',
- 'cdatatype' => ntypAttrValue,
- 'unescape' => 1,
- 'procinfo' => {
- embperl => {
- compiletimeperlcode => 'use strict ; use vars qw{%%CLEANUP %&<noname>%} ; map { $CLEANUP{substr($_,1)} = 1 } qw{%&<noname>%} ;',
- perlcode => 'use strict ;',
- removenode => 3,
- }
- },
- },
- 'hidden' => {
- 'text' => 'hidden',
- 'cdatatype' => ntypAttrValue,
- 'unescape' => 1,
- 'procinfo' => {
- embperl => {
- perlcode => '_ep_hid(%$n%,%&\'<noname>%);',
- removenode => 8,
- }
- },
- },
- 'sub' => {
- 'text' => 'sub',
- 'nodetype' => ntypTag,
- 'cdatatype' => ntypAttrValue,
- 'forcetype' => 1,
- 'unescape' => 1,
- 'endtag' => 'endsub',
- 'procinfo' => {
- embperl => {
- perlcode => 'sub _ep_sub_%&<noname>% { ',
- removenode => 10,
- mayjump => 1,
- stackname => 'metacmd',
- 'push' => 'sub',
- stackname2 => 'subname',
- push2 => '%&<noname>%',
- switchcodetype => 2,
- }
- },
- },
- 'endsub' => {
- 'text' => 'endsub',
- 'nodetype' => ntypTag,
- 'forcetype' => 1,
- 'cdatatype' => 0,
- 'procinfo' => {
- embperl => {
- perlcode => '}; sub %^subname% { my @_ep_save ; HTML::Embperl::Cmd::SubStart(\\$_ep_DomTree,%$q%,\\@_ep_save); my $_ep_ret = _ep_sub_%^subname% (@_); HTML::Embperl::Cmd::SubEnd(\\@_ep_save); return $_ep_ret } ; $_ep_req -> ExportHash -> {%^"subname%} = \&%^subname% ; ',
- removenode => 10,
- mayjump => 1,
- stackname => 'metacmd',
- stackmatch => 'sub',
- pop2 => 'subname',
- switchcodetype => 1,
- }
- },
- },
- ) ;
+=item ASP
+<% %> and <%= %>, see perldoc HTML::Embperl::Syntax::ASP
-%MetaCmdsDropTag = (
- 'br' => {
- 'text' => '<br>',
- 'follow' => \%MetaCmds,
- },
- 'p' => {
- 'text' => '<p>',
- 'follow' => \%MetaCmds,
- },
- %MetaCmds,
- ) ;
+=item SSI
+Server Side Includes, see perldoc HTML::Embperl::Syntax::SSI
+=item Perl
+File contains pure Perl (similar to Apache::Registry), but
+can be used inside EmbperlObject
+=item Text
-clonehash (\%Cmds, \%CmdsLink, { 'unescape' => 2 }) ;
+File contains only Text, no actions is taken on the Text
-$CmdsLink{'Embperl output code'}{'nodename'} = '[+url' ;
-$CmdsLink{'Embperl output code'}{'procinfo'}{'embperl'}{'perlcode'} =
- [
- 'if (!defined (_ep_rpurl(%$n%,scalar(do{%#~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(%$n%,scalar(do{%#~0:$col%})))) { _ep_dcp (%$t%,%^*htmlrow%) ; last l%^*htmlrow% ; }',
- 'if (!defined (_ep_rpurl(%$n%,scalar($val3=do{%#~0:$row%;})))) { _ep_dcp (%$t%,%^*htmltable%) ; last l%^*htmltable% ; }',
- '_ep_rpurl(%$n%,scalar(do{%#0%}));',
- ] ;
+=item Mail
+Defines the <mail:send> tag, for sending mail. This is an
+example for a taglib, which could be a base for writing
+your own taglib to extent the number of available tags
-clonehash (\%Attr, \%AttrLink, { inside => \%CmdsLink }) ;
+=back
+You can choose which syntax is used inside your page, either by
+the C<EMBPERL_SYNTAX> configuration directive, the C<syntax>,
+parameter to C<Execute> or the C<[$ syntax $]> metacommand.
-%HrefLink = (
- 'link' => { 'text' => 'href', 'nodename' => 'href', follow => \%AssignAttrLink },
- %Cmds,
-) ;
+You can also specify multiple syntaxes e.g.
-%SrcLink = (
- 'link' => { 'text' => 'src', 'nodename' => 'src', follow => \%AssignAttrLink },
- %Cmds,
-) ;
+ PerlSetEnv EMBPERL_SYNTAX "Embperl SSI"
-%ActionLink = (
- 'link' => { 'text' => 'action', 'nodename' => 'action', follow => \%AssignAttrLink },
- %Cmds,
-) ;
+ Execute ({inputfile => '*', syntax => 'Embperl ASP'}) ;
+The syntax metacommand allows to switch the syntax or to
+add or subtract syntaxes e.g.
+ [$ syntax + Mail $]
-%Default = (
- '-lsearch' => 1,
+will add the Mail taglib so the <mail:send> tag is available after
+this line.
- # The document node is generated always and is not parserd, but can be used to include code
- 'Document' => {
- 'nodename' => 'Document',
- 'nodetype' => ntypDocument,
- 'procinfo' => {
- embperl => {
- perlcode => q{
-# any initialisation could be put here
-$DB::single = 1 ;
-},
- compiletimeperlcode => q{
-use vars ('$_ep_DomTree') ;
-*_ep_rp=\\&XML::Embperl::DOM::Node::iReplaceChildWithCDATA;
-*_ep_rpurl=\\&XML::Embperl::DOM::Node::iReplaceChildWithUrlDATA;
-*_ep_cp=\\&XML::Embperl::DOM::Tree::iCheckpoint;
-*_ep_dcp=\\&XML::Embperl::DOM::Tree::iDiscardAfterCheckpoint;
-*_ep_opt=\\&HTML::Embperl::Cmd::Option;
-*_ep_hid=\\&HTML::Embperl::Cmd::Hidden;
-*_ep_ac=\\&XML::Embperl::DOM::Node::iAppendChild;
-*_ep_sa=\\&XML::Embperl::DOM::Element::iSetAttribut;
-},
- perlcodeend => q{# Include here any cleanup code
- $DB::single = 0 ;
- },
- stackname => 'metacmd',
- stackmatch => 'Document',
- 'push' => 'Document',
- mayjump => 1,
- }
- },
- },
- # The document fraq node is generated always and is not parserd, but can be used to include code
- 'DocumentFraq' => {
- 'nodename' => 'DocumentFraq',
- 'nodetype' => ntypDocumentFraq,
- 'procinfo' => {
- embperl => {
- perlcode => q{
-# any initialisation could be put here
-},
- compiletimeperlcode => q{
-use vars ('$_ep_DomTree') ;
-*_ep_rp=\\&XML::Embperl::DOM::Node::iReplaceChildWithCDATA;
-*_ep_rpurl=\\&XML::Embperl::DOM::Node::iReplaceChildWithUrlDATA;
-*_ep_cp=\\&XML::Embperl::DOM::Tree::iCheckpoint;
-*_ep_dcp=\\&XML::Embperl::DOM::Tree::iDiscardAfterCheckpoint;
-*_ep_opt=\\&HTML::Embperl::Cmd::Option;
-*_ep_hid=\\&HTML::Embperl::Cmd::Hidden;
-*_ep_ac=\\&XML::Embperl::DOM::Node::iAppendChild;
-*_ep_sa=\\&XML::Embperl::DOM::Element::iSetAttribut;
-},
- perlcodeend => '# Include here any cleanup code',
- stackname => 'metacmd',
- stackmatch => 'DocumentFraq',
- 'push' => 'DocumentFraq',
- mayjump => 1,
- }
- },
- },
- 'HTML Tag' => {
- 'text' => '<',
- 'end' => '>',
- 'follow' => \%HtmlTags,
- },
- 'HTML Comment' => {
- 'text' => '<!--',
- 'end' => '-->',
- },
- %Cmds,
+ [$ syntax - Mail $]
- ) ;
+now the <mail:send> tag is unknown again
+ [$ syntax SSI $]
+now you can only use SSI commands inside your page.
-__END__
+=head1 Defining your own Syntax
-=pod
=head2 sub new
+ my $class = shift ;
=head2 sub AddToRoot
+ my ($self, $elements) = @_ ;
=head2 sub AddInitCode
+sub AddInitCode
+
+ {
+ my ($self, $compiletimecode, $initcode, $termcode, $procinfo) = @_ ;
=head2 sub GetRoot
=head2 sub GetSyntax
+ my ($name, $oldname) = @_ ;
+
+
+=head2 sub CloneHash
+ {
+ my ($self, $old, $replace) = @_ ;
+
+=head1 Parameter
=over 4
No revision
No revision
1.1.2.2 +21 -7 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.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- Mail.pm 2001/03/27 19:07:56 1.1.2.1
+++ Mail.pm 2001/03/28 12:58:23 1.1.2.2
@@ -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.1 2001/03/27 19:07:56 richter Exp $
+# $Id: Mail.pm,v 1.1.2.2 2001/03/28 12:58:23 richter Exp $
#
###################################################################################
@@ -70,15 +70,17 @@
$self -> AddTagBlock ('mail:send', ['from', 'to', 'cc', 'bcc', 'subject', 'reply-to',
'mailhost', 'mailhelo', 'maildebug'], undef, undef,
{
+ removenode => 42,
perlcodeend => q{
{
use HTML::Embperl::Mail ;
- my $txt = q{ %#0% } ;
- HTML::Embperl::Mail::Execute (
+ my $txt = XML::Embperl::DOM::Node::iChildsText (%$n%) ;
+ $? = HTML::Embperl::Mail::Execute (
{
'input' => \$txt,
'inputfile' => 'mail',
+ 'syntax' => 'Text',
'from' => %&'from%,
'to' => %&'to%,
'cc' => %&'cc%,
@@ -90,7 +92,9 @@
'maildebug' => %&'maildebug%,
}) ;
}
- }
+ },
+ stackname => 'mail_send',
+ 'push' => '%$x%',
}) ;
}
@@ -115,13 +119,20 @@
=head1 SYNOPSIS
- [$syntax + Mail $]
+ [$ syntax + Mail $]
<mail:send to="richter@ecos.de" subject="Testmail">
- Hi, this is a
- test for a new mail tag
+ Hi,
+ this is a test for a new mail tag
+ it is send at [+ scalar(localtime) +]
+ from Embperl's Mail taglib.
</mail:send>
+ [$ if $? $]
+ <h2>Sorry, there was an error, your mail couldn't be send</h2>
+ [$else$]
+ <h2>Your mail was successfully delivered</h2>
+ [$endif$]
=head1 DESCRIPTION
@@ -153,6 +164,9 @@
=item maildebug
=back
+
+
+On success it sets C<$?> to zero, otherwise to a value other then zero.
=head1 Author
No revision
No revision
1.1.2.2 +9 -3 embperl/test/html/Attic/mail.htm
Index: mail.htm
===================================================================
RCS file: /home/cvs/embperl/test/html/Attic/mail.htm,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- mail.htm 2001/03/27 19:07:56 1.1.2.1
+++ mail.htm 2001/03/28 12:58:24 1.1.2.2
@@ -10,11 +10,17 @@
[$ syntax + Mail $]
<mail:send to="richter@ecos.de" subject="Testmail" mailhost="mail.i.ecos.de">
- Hi, this is a
- test for a new mail tag
+ Hi,
+ this is a test for a new mail tag
+ it is send at [+ scalar(localtime) +]
+ from Embperl's Mail taglib.
</mail:send>
-
+ [$ if $? $]
+ <h2>Sorry, there was an error, your mail couldn't be send</h2>
+ [$else$]
+ <h2>Your mail was successfully delivered</h2>
+ [$endif$]
</body>
</html>
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-cvs-help@perl.apache.org