• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

lib/HTML/H28-Mar-2017-521234

t/H28-Mar-2017-12384

ChangesH A D28-Mar-2017600 1813

LICENSEH A D28-Mar-201717.9 KiB380292

MANIFESTH A D28-Mar-2017247 1514

META.jsonH A D28-Mar-20171.5 KiB6260

META.ymlH A D28-Mar-2017750 2827

Makefile.PLH A D28-Mar-20171.3 KiB5847

READMEH A D28-Mar-20172.6 KiB253140

dist.iniH A D28-Mar-2017299 1913

README

1NAME
2
3    HTML::Declare - For When Template Systems Are Too Huge And Heredocs Too
4    Messy
5
6VERSION
7
8    version 2.6
9
10SYNOPSIS
11
12        # Import all constructors
13        use HTML::Declare ':all';
14
15        # A simple hello world
16        print HTML {
17            _ => [
18                HEAD { _ => TITLE { _ => 'Hello World!' } },
19                BODY { _ => 'Hello World!' }
20            ]
21        };
22
23        # Import specific constructors
24        use HTML::Declare qw/DIV A/;
25
26        # A simple anchor nested in a div
27        my $tree = DIV {
28            _ => [
29                A {
30                    href => 'http://127.0.0.1',
31                    _    => '<< Home Sweet Home!'
32                }
33            ]
34        };
35        print "$tree";
36
37DESCRIPTION
38
39    A very simple micro language to generate HTML.
40
41    This is not a real template system like Template or HTML::Mason, it's
42    just a simple (and fun) way to avoid those messy heredocs. ;)
43
44METHODS
45
46    HTML::Declare instances have the following methods.
47
48 new
49
50 as_html
51
52 attributes
53
54 children
55
56 tag
57
58FUNCTIONS
59
60    All exported functions work the same, they expect a hashref as first
61    argument which contains attributes for the tag to generate.
62
63    The special attribute _ contains the content for the tag. The content
64    may be a single string (in this case entities are auto encoded), a
65    arrayref containing strings that shouldn't be encoded or HTML::Declare
66    instances.
67
68        <TAG> { attribute => 'value' }
69        DIV { id => 'foo', _ => 'lalala<<encode me>>' }
70        DIV { id => 'link' _ => [ '<b>Don't encode me!</b>' ] }
71        DIV { _ => [ A { href => 'http://127.0.0.1', _ => 'Home!' } ] }
72        DIV { _ => [ A { href => 'http://host', _ => H1 { _ => 'Test' } } ] }
73
74 A
75
76 ABBR
77
78 ACRONYM
79
80 ADDRESS
81
82 AREA
83
84 B
85
86 BASE
87
88 BDO
89
90 BIG
91
92 BLOCKQUOTE
93
94 BODY
95
96 BR
97
98 BUTTON
99
100 CAPTION
101
102 CITE
103
104 CODE
105
106 COL
107
108 COLGROUP
109
110 DD
111
112 DEL
113
114 DIV
115
116 DFN
117
118 DL
119
120 DT
121
122 EM
123
124 FIELDSET
125
126 FORM
127
128 FRAME
129
130 FRAMESET
131
132 H1
133
134 H2
135
136 H3
137
138 H4
139
140 H5
141
142 H6
143
144 HEAD
145
146 HR
147
148 HTML
149
150 I
151
152 IFRAME
153
154 IMG
155
156 INPUT
157
158 INS
159
160 KBD
161
162 LABEL
163
164 LEGEND
165
166 LI
167
168 LINK
169
170 MAP
171
172 META
173
174 NOFRAMES
175
176 NOSCRIPT
177
178 OBJECT
179
180 OL
181
182 OPTGROUP
183
184 OPTION
185
186 P
187
188 PARAM
189
190 PRE
191
192 Q
193
194 SAMP
195
196 SCRIPT
197
198 SELECT
199
200 SMALL
201
202 SPAN
203
204 STRONG
205
206 STYLE
207
208 SUB
209
210 SUP
211
212 TABLE
213
214 TAG
215
216 TBODY
217
218 TD
219
220 TEXTAREA
221
222 TFOOT
223
224 TH
225
226 THEAD
227
228 TITLE
229
230 TR
231
232 TT
233
234 UL
235
236 VAR
237
238THANK YOU
239
240    Tatsuhiko Miyagawa
241
242AUTHOR
243
244    Sebastian Riedel, sri@oook.de
245
246COPYRIGHT AND LICENSE
247
248    This software is copyright (c) 2017 by Sebastian Riedel, C.
249
250    This is free software; you can redistribute it and/or modify it under
251    the same terms as the Perl 5 programming language system itself.
252
253