typo fixed
[metatemplate.git] / metatemplate.1
1 .Dd 2002 April 10
2 .Os Metatemplate-vERSIOn
3 .Dt METATEMPLATE 1
4 .Sh NAME
5 metatemplate \- metatemplate compiler
6 .Sh SYNOPSIS
7 .Nm metatemplate Ar filename
8 .Sh DESCRIPTION
9 .Nm metatemplate
10 create template and dynamic pieces of php code from a uniq
11 html metatemplate.
12 .br
13 To use metatemplate you need a tree like this:
14 .br
15 .ft C
16    somedir/
17 .br
18    somedir/Obj/
19 .br
20    somedir/Pho/
21 .br
22    somedir/Preview/
23 .br
24    somedir/Template/
25 .br
26    somedir/metatempl1.html
27 .br
28    somedir/metatempl2.html
29 .br
30    somedir/......
31 .br
32 .ft R
33
34 .Nm cd Ar somedir
35 .br
36 and run
37 .br
38 .Nm metatemplate Ar metatempl1.html
39 .br
40 .Nm metatemplate Ar metatempl2.html
41 .br
42 .Nm metatemplate
43 .No ...............
44
45 .Sy METATAGS DESCRIPTION
46 .br
47 .fc # ^
48 .ta 2.5i 5i
49
50 .Sy "#<!--MINCL:" Ns Ar "includename" Ns Sy "-->#"
51 #-\  Open include maker#
52 .br
53 .Sy "#<!--/MINCL-->#"
54 #-\  Close include maker#
55 .br
56 .Sy "#<!--MIGTO:" Ns Ar "includename" Ns Sy "-->#"
57 #-\  Insert include#
58 .br
59 .Sy "#<!--MIOBJ:" Ns Ar "objectname" Ns Sy "-->#"
60 #-\  Open object#
61 .br
62 .Sy "#<!--/MIOBJ-->#"
63 #-\  Close object#
64 .br
65 .Sy "#<!--MI:" Ns Ar "elementname" Ns Sy "-->#"
66 #-\  Open element#
67 .br
68 .Sy "#<!--/MI-->#"
69 #-\  Close element#
70 .br
71 .Sy "#<!--MO:" Ns Ar "virtelename" Ns Sy "-->#"
72 #-\  Open virtual element#
73 .br
74 .Sy "#<!--/MO-->#"
75 #-\  Close virtual element#
76 .br
77
78 .ta .8i 1.6i 2.4i 3.2i 4i 4.8i 5.6i 6.4i 7.2i 8i
79 .fc
80 .Sy CREATE INCLUDES
81 .br
82 You can make an include file named
83 .Pa myinc
84 putting a: 
85 .br
86 .Sy "\   <!--MINCL:" Ns Ar "myinc" Ns Sy "-->"
87 .br
88 before the first line that you want into the include
89 .br
90 and a:
91 .br
92 .Sy "\   <!--/MINCL-->"
93 .br
94 after the last.
95 .br
96
97 .Sy INCLUDE FILES
98 .br
99 You can include file named
100 .Pa myinc
101 putting a: 
102 .br
103 .Sy "\   <!--MIGTO:" Ns Ar "myinc" Ns Sy "-->"
104 .br
105
106 .Sy INCLUDES NOTE
107 .br
108 You can define an include definition into another include definition nesting 
109 .Sy 'MINCL' '/MINCL' 
110 tags.
111 .bp
112 .Sy NESTIFIED INCLUDES DEFINITION EXAMPLE
113 .br
114 When compiling this example with 
115 .Sy metatemplate
116 .ft C
117    <!--MINCL:big-->
118 .br
119    bla bla
120 .br
121    bla bla
122 .br
123    <!--MINCL:little-->
124 .br
125    ble ble
126 .br
127    <!--/MINCL-->
128 .br
129    blo blo
130 .br
131    blo blo
132 .br
133    <!--/MINCL-->
134 .br
135 .ft R
136 you create 2 files named
137 .Pa big No :
138 .br
139 .ft C
140    bla bla
141 .br
142    bla bla
143 .br
144    ble ble
145 .br
146    blo blo
147 .br
148    blo blo
149 .br
150 .ft R
151 and
152 .Pa little Ns No :
153 .br
154 .ft C
155    ble ble
156 .br
157 .ft R
158
159 .Sy INCLUDE FILES EXAMPLE
160 .br
161 If you want to include the file
162 .Ar big
163 into your metatemplate file you must use:
164 .br
165 .ft C
166    <!--MIGTO:big-->
167 .ft R
168
169 .Sy CREATE OBJECTS AND ELEMENTS
170 .br
171 An object is a collection of elements.
172 .br
173 Objects aren't nestable.
174 .br
175 Every object produces a php include file (Pho directory).
176 .br
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.
182 .br
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.
187 .br
188 If the element is virtual it isn't replaced with a tag.
189 .br
190 Elements are nestable.
191 .br
192
193 .Sy OBJECTS AND ELEMENTS EXAMPLE
194 .br
195 When compiling this example name 
196 .Pa example.html 
197 with 
198 .Sy metatemplate
199 .br
200 .ft C
201    begin of metatemplate
202 .br
203
204    <!--MIOBJ:myobj-->
205 .br
206    <table>
207 .br
208    <!--MI:tbrow-->
209 .br
210    <tr><td>#COL1#</td><td>#COL2#</td>
211 .br
212    <!--/MI-->
213 .br
214    </table>
215 .br
216
217    bla bla 
218 .br
219    <!--MI:ifbranch-->
220 .br
221    bli bli
222 .br
223    this piece of code is visualized when some test is true
224 .br
225    #SOMETAG#
226 .br
227    blo blo
228 .br
229    <!--/MI-->
230 .br
231
232    <!--MO:elsebranch-->
233 .br
234    olb olb
235 .br
236    elsewhere this piece of code is visualized
237 .br
238    #SOMETAG#
239 .br
240    <!--MI:elsubele-->
241 .br
242    bli bli #SUBTAG#
243 .br
244    <!--/MI-->
245 .br
246    ilb ilb
247 .br
248    <!--/MO-->
249 .br
250    <!--/MIOBJ-->
251 .br
252
253    end of metatemplate
254 .br
255
256 .ft R
257 .Sy metatemplate
258 produces this output on the console:
259 .br
260 .ft C
261    \-------- includes creation --------
262    \-------- objects creation  --------
263    obj: myobj
264    #MYOBJ_TBROW# ele:[tbrow]
265       #COL1#
266       #COL2#
267    ele close
268    #MYOBJ_IFBRANCH# ele:[ifbranch]
269       #SOMETAG#
270    ele close
271    ele:[elsebranch] virtual
272       #SOMETAG#
273       #ELSEBRANCH_ELSUBELE# ele:[elsebranch_elsubele]
274          #SUBTAG#
275       ele close
276    ele close
277    obj close
278 .ft R
279
280 this php include named 
281 .Pa myobj.pho
282 :
283 .ft C
284    <?php /* generated from file "example.html" */
285      $myobj = array();
286      $myobj['tbrow'] = '
287    <tr><td>#COL1#</td><td>#COL2#</td>
288    ';
289      $myobj['ifbranch'] = '
290    bli bli
291    this piece of code is visualized when some test is true
292    #SOMETAG#
293    blo blo
294    ';
295      $myobj['elsebranch_elsubele'] = '
296    bli bli #SUBTAG#
297    ';
298      $myobj['elsebranch'] = '
299    olb olb
300    elsewhere this piece of code is visualized
301    #SOMETAG##ELSEBRANCH_ELSUBELE#ilb ilb
302    ';
303    ?>
304 .ft R
305
306 and this template named  
307 .Pa Template/example.tmpl
308 :
309 .ft C
310    begin of metatemplate
311
312    <table>#MYOBJ_TBROW#</table>
313
314    bla bla #MYOBJ_IFBRANCH#
315    end of metatemplate
316 .ft R
317
318
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
324 .\" .Sh ENVIRONMENT
325 .\" .Sh FILES
326 .\" .Sh EXAMPLES
327 .\" This next request is for sections 1, 6, 7 & 8 only
328 .\"     (command return values (to shell) and
329 .\"       fprintf/stderr type diagnostics)
330 .\" .Sh DIAGNOSTICS
331 .\" The next request is for sections 2 and 3 error
332 .\" and signal handling only.
333 .\" .Sh ERRORS
334 .\" .Sh SEE ALSO
335 .\" .Sh STANDARDS
336 .\" .Sh HISTORY
337 .Sh AUTHORS
338 Matteo Nastasi, (http://www.alternativeoutput.it)
339 .br
340 nastasi@alternativeoutput.it
341 .br
342 matteo.nastasi@milug.org
343 .\" .Sh BUGS
344