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