Debian Codegraph @

Embperl/Syntax/EmbperlHTML.pm

raw
1
2 ###################################################################################
3 #
4 # Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh www.ecos.de
5 # Embperl - Copyright (c) 2008-2014 Gerald Richter
6 #
7 # You may distribute under the terms of either the GNU General Public
8 # License or the Artistic License, as specified in the Perl README file.
9 #
10 # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
11 # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
12 # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 #
14 # $Id: EmbperlHTML.pm 1578075 2014-03-16 14:01:14Z richter $
15 #
16 ###################################################################################
17
18
19
20 package Embperl::Syntax::EmbperlHTML ;
21
22 use Embperl::Syntax qw{:types} ;
23 use Embperl::Syntax::HTML ;
24
25 use strict ;
26 use vars qw{@ISA} ;
27
28 @ISA = qw(Embperl::Syntax::HTML) ;
29
30
31 ###################################################################################
32 #
33 # Methods
34 #
35 ###################################################################################
36
37 # ---------------------------------------------------------------------------------
38 #
39 # Create new Syntax Object
40 #
41 # ---------------------------------------------------------------------------------
42
43 sub new
44
45 {
46 my $class = shift ;
47
48 my $self = Embperl::Syntax::HTML::new ($class) ;
49
50 Init ($self) ;
51
52 return $self ;
53 }
54
55
56
57 ###################################################################################
58 #
59 # Definitions for Embperl HTML tags
60 #
61 ###################################################################################
62
63 sub Init
64
65 {
66 my ($self) = @_ ;
67
68 $self -> AddInitCode ('use vars qw{$_ep_selectname};') ;
69
70 $self -> AddTag ('input', ['type', 'name', 'value'], ['src'], ['checked'],
71 {
72 perlcode =>
73 [
74 'Embperl::Cmd::InputCheck (%$n%, %&*\'name%, %&*\'value%, %&\'checked%) ; %&=-type:radio|checkbox% ',
75 '$idat{%&*\'name%}=$fdat{%&*\'name%} ; _ep_sa(%$n%, \'value\', exists ($fdat{%&*\'name%})?$fdat{%&*\'name%}:\'\') ; %&!-value%',
76 '$idat{%&*\'name%}=%&*\'value% ; ',
77 ]
78 }) ;
79 $self -> AddTagBlock ('textarea', ['name'], undef, undef,
80 {
81 perlcode =>
82 [
83 '$idat{%&*\'name%}=$fdat{%&*\'name%};_ep_ac(%$n%, Embperl::Syntax::ntypText + 0x20, $fdat{%&*\'name%}) ; %#!-0%',
84 '$idat{%&*\'name%}=%#*\'0% ; ',
85 ]
86 }) ;
87
88 $self -> AddTagBlock ('tr', undef, undef, undef,
89 {
90 perlcode => 'l%$p%: for (my $col = 0; $col < $maxcol; $col++) {' ,
91 perlcodeend => '} %?*-htmlrow%' ,
92 perlcoderemove => 1,
93 stackname => 'htmlrow',
94 'push' => '%$p%',
95 mayjump => 1,
96 }) ;
97
98 my %ProcInfoTable = (
99 perlcode => 'l%$p%: for (my $row = 0; $row < $maxrow; $row++) {' ,
100 perlcodeend => '} %?*-htmltable%' ,
101 perlcoderemove => 1,
102 stackname => 'htmltable',
103 'push' => '%$p%',
104 mayjump => 1,
105 ) ;
106
107 $self -> AddTagBlock ('table', undef, undef, undef, \%ProcInfoTable) ;
108 $self -> AddTagBlock ('ol', undef, undef, undef, \%ProcInfoTable) ;
109 $self -> AddTagBlock ('ul', undef, undef, undef, \%ProcInfoTable) ;
110 $self -> AddTagBlock ('dl', undef, undef, undef, \%ProcInfoTable) ;
111 $self -> AddTagBlock ('menu', undef, undef, undef, \%ProcInfoTable) ;
112 $self -> AddTagBlock ('dir', undef, undef, undef, \%ProcInfoTable) ;
113
114
115 $self -> AddTagBlock ('select', ['name'], undef, undef,
116 {
117 stackname2 => 'htmlselect',
118 push2 => '%&*\'name%',
119
120 perlcode => 'l%$p%: for (my $row = 0; $row < $maxrow; $row++) {' ,
121 perlcodeend => '} %?*-htmltable%' ,
122 perlcoderemove => 1,
123 stackname => 'htmltable',
124 'push' => '%$p%',
125 mayjump => 1,
126 },
127 {
128 procinfo =>
129 {
130 'embperl#2' =>
131 {
132 perlcode => '{ my $_ep_selectname=%&*\'name%;',
133 perlcodeend => '} %&*-name%',
134 # push/pop is not (yet) supported in secondary entry, so don't use it!!
135 #stackname => 'htmltable',
136 #'push' => '%$p%',
137 }
138 }
139 }
140 ) ;
141 # option tag are _not_ added as block, to allow <option> without </option>
142 # which are interpreted correct by most browsers
143 $self -> AddTag ('option', ['value'], undef, ['selected'],
144 {
145 perlcode =>
146 [
147 '_ep_opt (%$n%, $_ep_selectname, %&*\'value%, %&\'selected%);',
148 '_ep_opt (%$n%, $_ep_selectname, %>*\'1%, %&\'selected%);',
149 #'_ep_opt (%$n%, %^*htmlselect%, %&*\'value%, %&\'selected%);',
150 #'_ep_opt (%$n%, %^*htmlselect%, %>*\'1%, %&\'selected%);',
151 ]
152 },
153 { 'nodename' => ':<:>:option:', 'cdatatype' => ntypAttrValue, procinfo => {} }) ;
154
155 $self -> AddTagWithStart ('/option', 'option', undef, undef, undef, undef,
156 { 'nodename' => ':</:>:option:', 'cdatatype' => ntypAttrValue, procinfo => {} } ) ;
157
158 $self -> AddTag ('a', undef, ['href'], undef, undef, { 'nodename' => ':<:>:a:', 'cdatatype' => ntypAttrValue, procinfo => {} }, 1) ;
159 $self -> AddTag ('area', undef, ['href'], undef, undef, undef, 1) ;
160 $self -> AddTag ('frame', undef, ['src'], undef, undef, undef, 1) ;
161 $self -> AddTag ('iframe', undef, ['src'], undef, undef, undef, 1) ;
162 $self -> AddTag ('embed', undef, ['src'], undef, undef) ;
163 $self -> AddTag ('layer', undef, ['src'], undef, undef) ;
164 $self -> AddTag ('img', undef, ['src'], undef, undef) ;
165 $self -> AddTag ('form', undef, ['action'], undef, undef, { 'nodename' => ':<:>:form:', 'cdatatype' => ntypAttrValue, procinfo => {} }, 2) ;
166
167 }
168
169
170
171
172
173
174 1;
175
176
177
178 __END__
179
180 =pod
181
182 =head1 NAME
183
184 Embperl::Syntax::EmbperlHTML - syntax for HTML tags that Embperl processes
185
186 =head1 SYNOPSIS
187
188
189 =head1 DESCRIPTION
190
191 Class derived from Embperl::Syntax::HTML to define the syntax for
192 HTML tags that Embperl processes.
193
194 =head1 Methods
195
196 I<Embperl::Syntax::EmbperlHTML> does not defines any methods.
197
198 =head1 Author
199
200 G. Richter (richter at embperl dot org)
201
202 =head1 See Also
203
204 Embperl::Syntax, Embperl::Syntax::HTML
205
206