richter 01/09/14 04:06:26
Modified: . Tag: Embperl2c Embperl.pod epdat.h epparse.c
test.pl
Embperl/Syntax Tag: Embperl2c POD.pm
Added: test/html/pod Tag: Embperl2c pod.asc
Log:
Embperl POD syntax (pod2xml)
Revision Changes Path
No revision
No revision
1.56.4.9 +4 -1 embperl/Embperl.pod
Index: Embperl.pod
===================================================================
RCS file: /home/cvs/embperl/Embperl.pod,v
retrieving revision 1.56.4.8
retrieving revision 1.56.4.9
diff -u -r1.56.4.8 -r1.56.4.9
--- Embperl.pod 2001/09/13 07:29:43 1.56.4.8
+++ Embperl.pod 2001/09/14 11:06:25 1.56.4.9
@@ -1,3 +1,4 @@
+=pod
=head1 NAME
@@ -1535,7 +1536,7 @@
This is the same as using the Apache function
- [- $req_rec ->� header_out("Language" => "DE"); -]
+ [- $req_rec -> header_out("Language" => "DE"); -]
=item B<A>, B<EMBED>, B<IMG>, B<IFRAME>, B<FRAME>, B<LAYER>
@@ -2754,3 +2755,5 @@
=head1 See Also
perl(1), mod_perl, Apache httpd
+
+=cut
1.20.4.22 +2 -1 embperl/epdat.h
Index: epdat.h
===================================================================
RCS file: /home/cvs/embperl/epdat.h,v
retrieving revision 1.20.4.21
retrieving revision 1.20.4.22
diff -u -r1.20.4.21 -r1.20.4.22
--- epdat.h 2001/09/13 07:29:43 1.20.4.21
+++ epdat.h 2001/09/14 11:06:26 1.20.4.22
@@ -10,7 +10,7 @@
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: epdat.h,v 1.20.4.21 2001/09/13 07:29:43 richter Exp $
+# $Id: epdat.h,v 1.20.4.22 2001/09/14 11:06:26 richter Exp $
#
###################################################################################*/
@@ -132,6 +132,7 @@
struct tToken * pTokens ; /* table with all tokens */
int numTokens ; /* number of tokens in above table */
int bLSearch ; /* when set perform a linear, instead of a
binary search */
+ int nDefNodeType ; /* either ntypCDATA or ntypText */
struct tToken * pContainsToken ;/* pointer to the token that has a pContains
defined (could be only one per table) */
} ;
1.4.2.33 +25 -7 embperl/Attic/epparse.c
Index: epparse.c
===================================================================
RCS file: /home/cvs/embperl/Attic/epparse.c,v
retrieving revision 1.4.2.32
retrieving revision 1.4.2.33
diff -u -r1.4.2.32 -r1.4.2.33
--- epparse.c 2001/08/28 08:01:27 1.4.2.32
+++ epparse.c 2001/09/14 11:06:26 1.4.2.33
@@ -9,7 +9,7 @@
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: epparse.c,v 1.4.2.32 2001/08/28 08:01:27 richter Exp $
+# $Id: epparse.c,v 1.4.2.33 2001/09/14 11:06:26 richter Exp $
#
###################################################################################*/
@@ -234,6 +234,7 @@
memset (pStartChars, 0, sizeof (pTokenTable -> cStartChars)) ;
memset (pAllChars, 0, sizeof (pTokenTable -> cAllChars)) ;
pTokenTable -> bLSearch = 0 ;
+ pTokenTable -> nDefNodeType = ntypCDATA ;
pTokenTable -> pContainsToken = NULL ;
pTokenTable -> pCompilerInfo = NULL ;
pTokenTable -> sName = sName ;
@@ -269,8 +270,12 @@
if (*pKey == '-')
{ /* special key */
- if (strcmp (pKey, "-lsearch") == 0)
+ if (strcmp (pKey, "-defnodetype") == 0)
{
+ pTokenTable -> nDefNodeType = SvIV ((SV *)pToken) ;
+ }
+ else if (strcmp (pKey, "-lsearch") == 0)
+ {
pTokenTable -> bLSearch = SvIV ((SV *)pToken) ;
}
else if (strcmp (pKey, "-contains") == 0)
@@ -285,7 +290,20 @@
}
}
}
- else
+ }
+
+ n = 0 ;
+ hv_iterinit (pTokenHash) ;
+ while ((pEntry = hv_iternext (pTokenHash)))
+ {
+ HV * pHash ;
+ struct tTokenTable * pNewTokenTable ;
+ char * sContains ;
+ char * sC ;
+
+ pKey = hv_iterkey (pEntry, &l) ;
+ pToken = hv_iterval (pTokenHash, pEntry) ;
+ if (*pKey != '-')
{
if (!SvROK (pToken) || SvTYPE (SvRV (pToken)) != SVt_PVHV)
{
@@ -304,7 +322,7 @@
p -> nNodeType = GetHashValueInt (pHash, "nodetype", ntypTag) ;
p -> bUnescape = GetHashValueInt (pHash, "unescape", 0) ;
p -> bAddFlags = GetHashValueInt (pHash, "addflags", 0) ;
- p -> nCDataType = GetHashValueInt (pHash, "cdatatype", ntypCDATA) ;
+ p -> nCDataType = GetHashValueInt (pHash, "cdatatype", pTokenTable ->
nDefNodeType) ;
p -> nForceType = GetHashValueInt (pHash, "forcetype", 0) ;
p -> bRemoveSpaces = GetHashValueInt (pHash, "removespaces", p ->
nNodeType != ntypCDATA?2:0) ;
p -> bInsideMustExist = GetHashValueInt (pHash, "insidemustexist", 0) ;
@@ -798,7 +816,7 @@
}
/* add as cdata*/
- if (!(xNewNode = Node_appendChild (pDomTree, ntypCDATA, 0,
pCurrStart, pCurr - pCurrStart, xParentNode, level, GetLineNoOf (r, pCurrStart),
NULL)))
+ if (!(xNewNode = Node_appendChild (pDomTree, pTokenTable
-> nDefNodeType, 0, pCurrStart, pCurr - pCurrStart, xParentNode, level, GetLineNoOf
(r, pCurrStart), NULL)))
return 1 ;
}
else if (rc != rcNotFound)
@@ -882,7 +900,7 @@
{
level++ ;
xParentNode = xNewNode ;
- nCDataType = ntypCDATA ;
+ nCDataType = pTokenTable -> nDefNodeType ;
}
}
pCurrStart = pCurr ;
@@ -970,7 +988,7 @@
pTokenTableSave = r -> pTokenTable ;
- if ((rc = ParseTokens (r, &pStart, pEnd, r -> pTokenTable, "", NULL, ntypCDATA,
0, 0, 0, String2Ndx("root", 4), xDocNode, 0, NULL, NULL)) != ok)
+ if ((rc = ParseTokens (r, &pStart, pEnd, r -> pTokenTable, "", NULL, r ->
pTokenTable -> nDefNodeType, 0, 0, 0, String2Ndx("root", 4), xDocNode, 0, NULL, NULL))
!= ok)
return rc ;
/* Add one child node end the end to catch loops that end at the very last node
*/
1.70.4.69 +5 -1 embperl/test.pl
Index: test.pl
===================================================================
RCS file: /home/cvs/embperl/test.pl,v
retrieving revision 1.70.4.68
retrieving revision 1.70.4.69
diff -u -r1.70.4.68 -r1.70.4.69
--- test.pl 2001/09/13 07:29:43 1.70.4.68
+++ test.pl 2001/09/14 11:06:26 1.70.4.69
@@ -11,7 +11,7 @@
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: test.pl,v 1.70.4.68 2001/09/13 07:29:43 richter Exp $
+# $Id: test.pl,v 1.70.4.69 2001/09/14 11:06:26 richter Exp $
#
###################################################################################
@@ -695,6 +695,10 @@
},
'crypto.htm' => {
'condition' => '$EPC_ENABLE',
+ },
+ 'pod/pod.asc' => {
+ 'version' => 2,
+ 'syntax' => 'POD',
},
) ;
No revision
No revision
1.1.2.2 +76 -51 embperl/Embperl/Syntax/Attic/POD.pm
Index: POD.pm
===================================================================
RCS file: /home/cvs/embperl/Embperl/Syntax/Attic/POD.pm,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- POD.pm 2001/07/25 04:05:48 1.1.2.1
+++ POD.pm 2001/09/14 11:06:26 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: POD.pm,v 1.1.2.1 2001/07/25 04:05:48 richter Exp $
+# $Id: POD.pm,v 1.1.2.2 2001/09/14 11:06:26 richter Exp $
#
###################################################################################
@@ -22,7 +22,7 @@
use HTML::Embperl::Syntax::EmbperlBlocks ;
use strict ;
-use vars qw{@ISA %Tags} ;
+use vars qw{@ISA %Tags %Format %Escape} ;
@@ -46,13 +46,16 @@
{
my $self = shift ;
- $self = HTML::Embperl::Syntax::EmbperlBlocks::new ($self, 1) ;
+ #$self = HTML::Embperl::Syntax::EmbperlBlocks::new ($self, 1) ;
+ $self = HTML::Embperl::Syntax::new ($self, 1) ;
if (!$self -> {-PODTags})
{
$self -> {-PODTags} = $self -> CloneHash (\%Tags) ;
$self -> AddToRoot ($self -> {-PODTags}) ;
+ $self -> AddToRoot ({'-defnodetype' => ntypText,}) ;
+
$self -> {-PODCmds} = $self -> {-PODTags}{'POD Command'}{'follow'} ;
Init ($self) ;
@@ -78,8 +81,9 @@
my $tag = $ttfollow -> {$cmdname} = {
'text' => $cmdname,
'nodetype' => ntypStartEndTag,
- 'cdatatype' => ntypCDATA,
+ 'cdatatype' => ntypText,
'removespaces' => 8,
+ 'inside' => \%Format,
} ;
$tag -> {nodename} = $name if ($name) ;
@@ -136,17 +140,45 @@
}
+%Escape = (
+ '-lsearch' => 1,
+ 'POD Escape' => {
+ 'text' => '<',
+ 'end' => '>',
+ 'nodename' => ':::>:<',
+ 'nodetype' => ntypStartEndTag,
+ },
+ 'POD Escape &' => {
+ 'text' => '&',
+ 'nodename' => ':::&',
+ 'nodetype' => ntypTag,
+ },
+) ;
+
+my %Escape2 = (
+ 'POD Escape <' => {
+ 'text' => '<',
+ 'nodename' => ':::<',
+ 'nodetype' => ntypTag,
+ },
+ 'POD Escape >' => {
+ 'text' => '>',
+ 'nodename' => ':::>',
+ 'nodetype' => ntypTag,
+ },
+ 'POD Escape &' => {
+ 'text' => '&',
+ 'nodename' => ':::&',
+ 'nodetype' => ntypTag,
+ },
+ ) ;
-%Tags = (
+
+%Format = (
'-lsearch' => 1,
- 'POD Command' => {
- 'text' => '=',
- 'end' => "\n",
- 'cdatatype' => ntypAttrValue,
- 'follow' => {'-lsearch' => 1},
- },
+ '-defnodetype' => ntypText,
'POD Format B' => {
'text' => 'B<',
'end' => '>',
@@ -171,11 +203,42 @@
'nodename' => 'U',
'nodetype' => ntypStartEndTag,
},
+ 'POD Format L' => {
+ 'text' => 'L<',
+ 'end' => '>',
+ 'nodename' => 'L',
+ 'nodetype' => ntypStartEndTag,
+ },
+ ) ;
+%Tags = (
+ '-lsearch' => 1,
+ '-defnodetype' => ntypText,
+ 'POD Command' => {
+ 'text' => '=',
+ 'end' => "\n",
+ 'cdatatype' => ntypAttrValue,
+ 'follow' => {'-lsearch' => 1},
+ },
+ 'POD Emptyline' => {
+ 'text' => "\n\n",
+ 'nodename' => 'BR/',
+ 'nodetype' => ntypTag,
+ },
+ 'POD Code' => {
+ 'text' => "\n ",
+ 'end' => "\n",
+ 'nodename' => 'PRE',
+ 'cdatatype' => ntypText,
+ 'nodetype' => ntypStartEndTag,
+ 'inside' => \%Format,
+ },
+ %Format,
) ;
+
1;
@@ -191,41 +254,10 @@
=head1 DESCRIPTION
-
-Class derived from HTML::Embperl::Syntax to define the syntax for
-POD files. POD files can be read and written by various word processing
-programms. This allows you to create dynamic wordprocessing documents or
-let process serial letters thru Embperl.
-Currently Embperl regocnices the fields C<DOCVARIABLE>, C<MERGEFIELD> and
-C<NEXT>. Variablenames are resolved as hash keys to $param[0] e.g. C<foo.bar>
-referes to C<$param[0]{foo}{bar}>, the C<@param> Array can by set via the
-C<param> parameter of the C<Execute> function. C<NEXT> moves to the next element
-of the @param array. If the end of the document is reached, Embperl repeats
-the document until all element of @param are processed. This can for example
-be use to tie a database table to @param and generate a serial letter.
+Documenation is still not written!!!!!!!
-NOTE: Extenting this syntax to support full Embperl support (like embedding Perl
-into POD file is planned, but not implemented yet)
-=head1 Example for generating a serial letter from a database
-
-
- use DBIx::Recordset ;
- use HTML::Embperl ;
-
- *set = DBIx::Recordset -> Search({'!DataSource' => $db, '!Table' => 'address',
'!WriteMode' => 0}) ;
-
- die DBIx::Recordset -> LastError if (DBIx::Recordset -> LastError) ;
-
- HTML::Embperl::Execute ({'inputfile' => 'address.POD', param => \@set, syntax =>
'POD'}) ;
-
-
- # if your database table contains fields 'name' and 'street' you can now simply
insert a
- # fields call 'name' and 'street' in your POD file and Embperl will repeat the
document
- # until all records are outputed
-
-
=head1 Methods
I<HTML::Embperl::Syntax::POD> defines the following methods:
@@ -241,18 +273,11 @@
Add a new POD command with name C<$cmdname> and use processor info from
C<$procinfo>. See I<HTML::Embperl::Syntax> for a definition of procinfo.
-=head2 AddPODCmdWithEnd ($cmdname, $endname, $procinfo)
+=head2 AddPODCmdStartEnd ($cmdname, $endname, $procinfo)
Add a new POD command with name C<$cmdname> and use processor info from
C<$procinfo>. Addtionaly specify that a matching C<$endname> POD command
must be found to end the block, that is started by this POD command.
-See I<HTML::Embperl::Syntax> for a definition of procinfo.
-
-=head2 AddPODCmdBlock ($cmdname, $endname, $procinfostart, $procinfoend)
-
-Add a new POD command with name C<$cmdname> and and a second POD command
-C<$endname> which ends the block that is started by C<$cmdname>.
-Use processor info from C<$procinfo>.
See I<HTML::Embperl::Syntax> for a definition of procinfo.
No revision
No revision
1.1.2.1 +46 -0 embperl/test/html/pod/Attic/pod.asc
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]