2 .Os Metatemplate-vERSIOn
5 metatemplate \- metatemplate compiler
7 .Nm metatemplate Ar filename
10 create template and dynamic pieces of php code from a uniq
13 To use metatemplate you need a tree like this:
26 somedir/metatempl1.html
28 somedir/metatempl2.html
38 .Nm metatemplate Ar metatempl1.html
40 .Nm metatemplate Ar metatempl2.html
45 .Sy METATAGS DESCRIPTION
50 .Sy "#<!--MINCL:" Ns Ar "includename" Ns Sy "-->#"
51 #-\ Open include maker#
54 #-\ Close include maker#
56 .Sy "#<!--MIGTO:" Ns Ar "includename" Ns Sy "-->#"
59 .Sy "#<!--MIOBJ:" Ns Ar "objectname" Ns Sy "-->#"
65 .Sy "#<!--MI:" Ns Ar "elementname" Ns Sy "-->#"
71 .Sy "#<!--MO:" Ns Ar "virtelename" Ns Sy "-->#"
72 #-\ Open virtual element#
75 #-\ Close virtual element#
78 .ta .8i 1.6i 2.4i 3.2i 4i 4.8i 5.6i 6.4i 7.2i 8i
82 You can make an include file named
86 .Sy "\ <!--MINCL:" Ns Ar "myinc" Ns Sy "-->"
88 before the first line that you want into the include
99 You can include file named
103 .Sy "\ <!--MIGTO:" Ns Ar "myinc" Ns Sy "-->"
108 You can define an include definition into another include definition nesting
112 .Sy NESTIFIED INCLUDES DEFINITION EXAMPLE
114 When compiling this example with
136 you create 2 files named
159 .Sy INCLUDE FILES EXAMPLE
161 If you want to include the file
163 into your metatemplate file you must use:
169 .Sy CREATE OBJECTS AND ELEMENTS
171 An object is a collection of elements.
173 Objects aren't nestable.
175 Every object produces a php include file (Pho directory).
177 An element is a piece of the metatemplate file the is enclosed between
178 the open and close elements tags, it is put into an element of a
179 php associative array named like the parent object, indexed with the
180 name of the element perfixed eventually with the names of the parent
181 elements and placed into the object-related php include file.
183 If the element is not virtual the element is replaced into the parent
184 (template or element) with a tag that is the name of the element prefixed
185 with the name of parent object + (eventually) the names of all parents
186 elements "_" separated.
188 If the element is virtual it isn't replaced with a tag.
190 Elements are nestable.
193 .Sy OBJECTS AND ELEMENTS EXAMPLE
195 When compiling this example name
201 begin of metatemplate
210 <tr><td>#COL1#</td><td>#COL2#</td>
223 this piece of code is visualized when some test is true
236 elsewhere this piece of code is visualized
258 produces this output on the console:
261 \-------- includes creation --------
262 \-------- objects creation --------
264 #MYOBJ_TBROW# ele:[tbrow]
268 #MYOBJ_IFBRANCH# ele:[ifbranch]
271 ele:[elsebranch] virtual
273 #ELSEBRANCH_ELSUBELE# ele:[elsebranch_elsubele]
280 this php include named
284 <?php /* generated from file "example.html" */
287 <tr><td>#COL1#</td><td>#COL2#</td>
289 $myobj['ifbranch'] = '
291 this piece of code is visualized when some test is true
295 $myobj['elsebranch_elsubele'] = '
298 $myobj['elsebranch'] = '
300 elsewhere this piece of code is visualized
301 #SOMETAG##ELSEBRANCH_ELSUBELE#ilb ilb
306 and this template named
307 .Pa Template/example.tmpl
310 begin of metatemplate
312 <table>#MYOBJ_TBROW#</table>
314 bla bla #MYOBJ_IFBRANCH#
319 .\" The following requests should be uncommented and
320 .\" used where appropriate. This next request is
321 .\" for sections 2 and 3 function return values only.
322 .\" .Sh RETURN VALUES
323 .\" This next request is for sections 1, 6, 7 & 8 only
327 .\" This next request is for sections 1, 6, 7 & 8 only
328 .\" (command return values (to shell) and
329 .\" fprintf/stderr type diagnostics)
331 .\" The next request is for sections 2 and 3 error
332 .\" and signal handling only.
338 Matteo Nastasi, (http://www.alternativeoutput.it)
340 nastasi@alternativeoutput.it
342 matteo.nastasi@milug.org