/[svn]/web/site.cd
ViewVC logotype

Contents of /web/site.cd

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1422 - (hide annotations)
Tue Jul 10 18:48:24 2007 UTC (5 years, 10 months ago) by abate
File size: 18763 byte(s)
[r2005-01-14 06:32:35 by afrisch] Empty log message

Original author: afrisch
Date: 2005-01-14 06:32:36+00:00
1 abate 284 (* This CDuce script produces CDuce web site. *)
2    
3 abate 369 (** Command line **)
4    
5 abate 580 let input =
6 abate 1097 match argv [] with
7 abate 580 | [ s ] -> s
8 abate 709 | _ -> raise "Please use --arg to specify an input file on the command line"
9 abate 369
10 abate 343 (** Output types **)
11 abate 284
12 abate 713 using H = "xhtml"
13 abate 250
14 abate 343 (** Input types **)
15    
16 abate 1065 type Site = <site>[ <title>String Page ]
17 abate 1410 type Page = <page name=Latin1 url=?String new=?"" leftbar=?("true"|"false")>[ <title>String <banner>[InlineText*]? Item* ]
18 abate 488 type External = <external {|href=String; title=String; name=String |}>[]
19 abate 343
20     type Item =
21 abate 1065 <box ({| title=String; link=String; short=?String |} | {| |})>Content
22 abate 343 | <meta>Content
23     | <left>Content
24 abate 1064 | <footnotes>[]
25 abate 343 | Page
26 abate 488 | External
27 abate 343
28 abate 1330 type Author = <author presenter=?("yes"|"no")>String
29 abate 343 type Paper =
30 abate 1064 <paper file=?String old=?"">[
31 abate 488 <title>String Author+ <comment>[InlineText*] <abstract>Content ]
32 abate 343
33     type Slides =
34 abate 488 <slides file=String>[ <title>String Author+ <comment>[InlineText*] ]
35 abate 343
36     type Link =
37 abate 561 <link url=String title=String>[ InlineText* ]
38 abate 343
39     type Content =
40 abate 614 [ ( <p {|style=?String|}>[InlineText*]
41 abate 1064 | <ul {||}>[<li {||}>Content *]
42 abate 1264 | <ol {|style=?String|}>[<li {||}>Content *]
43 abate 343 | <section title=String>Content
44 abate 344 | <sample highlight=?"true"|"false">String
45 abate 979 | <xmlsample highlight=?"true"|"false">String
46 abate 981 | <sessionsample highlight=?"true"|"false">String
47 abate 713 | H:Xtable
48 abate 343 | Paper | Slides | Link
49 abate 1065 | <boxes-toc short=?"" sections=?"">[]
50     | <pages-toc sections=?"">[]
51 abate 343 | <site-toc>[]
52     | <local-links href=String>[]
53 abate 356 | <two-columns>[ <left>Content <right>Content ]
54 abate 1065 | <note title=?String> Content
55 abate 1064 | <footnotes>[]
56 abate 1387 | <xhtml>H:Flow
57 abate 1411 | <demo label=?String prefix=?String>String
58 abate 343 | InlineText
59 abate 488 )* ]
60 abate 343
61     type InlineText =
62     Char
63 abate 593 | <(`b|`i|`tt|`em) {| style=?String |}>[InlineText*]
64 abate 343 | <code>String
65 abate 347 | <local href=String>String
66 abate 625 | <footnote>[InlineText*]
67 abate 1348 | H:Xa | H:Ximg | H:Xbr
68     | <thumbnail href=String width=?IntStr height=?IntStr>[]
69     | <thumbnails href=String width=?IntStr height=?IntStr>[ PCDATA ]
70 abate 343
71 abate 1348 type IntStr = ['0'--'9'+]
72    
73    
74 abate 343 (** Generic purpose functions **)
75    
76     (* Recursive inclusion of XML files and verbatim text files *)
77    
78 abate 1229 let load_include (Latin1 -> [Any*])
79 abate 336 name ->
80 abate 368 (* let _ = print [ 'Loading ' !name '... \n' ] in *)
81 abate 336 xtransform [ (load_xml name) ] with
82 abate 1229 | <include file=(s & Latin1)>[] -> load_include s
83     | <include-verbatim file=(s & Latin1)>[] -> load_file s
84 abate 336
85 abate 343 (* Highlighting text between {{...}} *)
86 abate 336
87 abate 981 let highlight (String -> [ (Char | H:Xstrong | H:Xi)* ] )
88     | [ '{{%%' h ::(Char *?) '%%}}' ; rest ] ->
89     [ <strong class="highlight">[<i>h]; highlight rest ]
90 abate 340 | [ '{{' h ::(Char *?) '}}' ; rest ] ->
91 abate 981 [ <strong class="highlight">h; highlight rest ]
92 abate 1037 | [ '$$%%' h ::(Char *?) '%%$$' ; rest ] ->
93     [ <strong class="ocaml">[<i>h]; highlight rest ]
94     | [ '$$' h ::(Char *?) '$$' ; rest ] ->
95     [ <strong class="ocaml">h; highlight rest ]
96 abate 381 | [ '%%' h ::(Char *?) '%%' ; rest ] ->
97 abate 698 [ <i>h; highlight rest ]
98 abate 340 | [ c; rest ] -> [ c; highlight rest ]
99 abate 488 | [] -> []
100 abate 336
101 abate 343 (* Split a comma-separated string *)
102    
103 abate 488 let split_comma (String -> [String*])
104 abate 341 | [ x::(Char*?) ',' ; rest ] -> (x, split_comma rest)
105 abate 488 | s -> [ s ]
106 abate 336
107 abate 1348 type wschar = ' ' | '\n' | '\t' | '\r'
108 abate 253
109 abate 1348 let split_thumbnails (String -> [(String,String)*])
110     | [ wschar* x::(Char\wschar\':')+ ':' y::_*? '.'; rest ] ->
111     ((x,y), split_thumbnails rest)
112     | [ wschar* x::(Char\wschar)+; rest ] ->
113     ((x,""), split_thumbnails rest)
114     | [ wschar* ] -> []
115    
116 abate 343 (** Internal types **)
117 abate 341
118 abate 488 type Path = [ { url = String; title = String }* ]
119 abate 341 type Tree = { name = String; url = String; title = String;
120 abate 1058 children = [Tree*]; boxes = [H:Xul?] }
121 abate 250
122 abate 1065 let url_of_page (Page -> String)
123     | <page url=u>_ -> u
124     | <page name=n>_ -> n @ ".html"
125 abate 346
126 abate 1330 let render(a : String)(p : {presenter=?"yes"|"no"}) : H:Flow =
127     (match p with {presenter="yes"} -> [<strong class="ocaml">a] | _ -> a)
128 abate 250
129 abate 1330 let authors ([Author+] -> H:Flow)
130     | [ <author (p)>a ] -> render a p
131     | [ <author (p1)>a1 <author (p2)>a2 ] -> (render a1 p1) @ ", and " @ (render a2 p2)
132     | [ <author (p)>a; rem ] -> (render a p)@ ", " @ authors rem
133    
134 abate 488 let find_local_link (sitemap : [Tree*], l : String) : Tree =
135 abate 341 match sitemap with
136     | (h,t) ->
137 abate 347 if (h . name = l) then h
138 abate 341 else
139     (try find_local_link (t,l) with `Not_found ->
140     find_local_link (h . children,l))
141 abate 488 | [] -> raise `Not_found
142 abate 341
143 abate 1422 let local_link (sitemap : Tree, l : String, txt : String) : [H:Inline?] =
144 abate 347 try
145     let h = find_local_link ([sitemap],l) in
146     let txt = if txt = "" then h . title else txt in
147 abate 1422 [ <a href=(h . url)>txt ]
148     with `Not_found ->
149     print [ 'Warning. Local link not found: ' !(string_of l) '\n' ];
150     []
151 abate 341
152 abate 488 let compute_sitemap ((Page|External) -> Tree)
153 abate 1064 | <page name=name>[ <title>title (c::(Page|External) | _)* ] & p ->
154 abate 341 let children = map c with p -> compute_sitemap p in
155 abate 1065 { name = name; url = (url_of_page p); title = title;
156 abate 1058 children = children; boxes = (boxes_of p) }
157 abate 1064 | <external name=name href=h title=t>[] ->
158 abate 1058 { name = name; url = h; title = t; children = []; boxes = [] }
159 abate 341
160 abate 1064 let ul([H:Xli*] -> [H:Xul?]) [] -> [] | l -> [ <ul>l ]
161    
162 abate 1264 let ol(([H:Xli*],{|style=?String|}) -> [H:Xol?])
163     ([],_) -> []
164     | (l,s&{|style=?String|}) -> [ <ol (s)>l ]
165 abate 1126
166 abate 1264
167    
168 abate 713 let display_sitemap (h : Tree) : H:Xli =
169 abate 341 let ch = map h . children with x -> display_sitemap x in
170 abate 1064 <li>[ <a href=(h . url)>[ '[' !(h . title) ']' ] !(h . boxes); (ul ch) ]
171 abate 341
172 abate 681
173 abate 1064 let boxes_of (Page -> [H:Xul?])
174 abate 1065 <page>[ (items::Item | _)*] & p ->
175 abate 1064 let toc = transform items with
176 abate 1065 | <box title=t link=l>_ -> [ <li>[ <a href=[ !(url_of_page p) '#' !l ]>t ] ]
177 abate 1064 in
178     ul toc
179 abate 351
180 abate 1065 let link_to (<page>[<title>t ; _ ] & p : Page) : H:Xa =
181 abate 1064 let t = match p with
182     | <_ new="">_ -> t @ [ <img src="img/new.gif" alt="(new)" style="border:0">[]]
183     | _ -> t in
184 abate 1065 <a href=(url_of_page p)>t
185 abate 1064
186 abate 1065 let small_box (x : H:Flow) : H:Block =
187 abate 580 <table cellpadding="2"
188 abate 586 style="font-size:11px ; font-family:arial,sans-serif;
189     border: solid 2px black; background: #ffffff" width="100%">
190 abate 580 [ <tr> [<td>x] ]
191    
192 abate 713 let meta (x : H:Flow) : H:Block =
193 abate 580 <table cellpadding="2"
194 abate 797 style="border: solid 1px #b0b0b0; background: #e0e0e0; font-size: 80%"
195 abate 580 width="100%">
196     [ <tr> [<td>x] ]
197    
198 abate 1058 let box_title (x : H:Flow, a : String, t : String) : H:Block =
199 abate 580 <table cellpadding="5"
200     style="border: solid 2px black; background: #ffffff" width="100%">
201 abate 1058 [ <tr>[
202     <td style="background: #fff0f0; color: #0000ff; font: bold 100%
203     helvetica">[<a name=a>t] ]
204     <tr> [<td>x] ]
205 abate 580
206 abate 1065 let box (x : H:Flow) : H:Block =
207     <table cellpadding="5"
208     style="border: solid 2px black; background: #ffffff" width="100%">
209     [ <tr> [<td>x] ]
210    
211 abate 580 let style = "
212     a:link:hover, a:visited:hover {
213     text-decoration: none;
214     background: #FFFFD0;
215     color: #FF0000;
216     }
217 abate 1064 a.old, a.old:hover, a.old:visited:hover { text-decoration: line-through; }
218     p { text-align: justify; margin: 1ex 1em 0 1em; }
219     pre { margin: 1ex 1em 0 1em; }
220     strong.ocaml{ color: #333b8e; }
221     strong.highlight { color: #FF0000; }
222     img.icon { border: 0; }
223     div.code { background: #E0E0E0; margin: 0.5ex 0.5em 0 0.5em; padding: 0.2ex; }
224     div.xmlcode { background:#ebefa2; margin: 0.5ex 0.5em 0 0.5em; padding: 0.2ex;}
225 abate 976
226 abate 580 div.abstract {
227 abate 736 font: bold helvetica;
228 abate 580 margin: 1ex 1em 1ex 1em;
229     padding: 1ex 1em 1ex 1em;
230     background: #F0F0F0;
231     }
232 abate 976
233     div.note {
234 abate 979 text-align: justify;
235 abate 976 font: bold helvetica;
236     margin: 1ex 3em 1ex 3em;
237     padding: 1ex 1em 1ex 1em;
238     background: #D0E2D2;
239     }
240    
241 abate 981 div.session
242     {
243     font: bold 80% helvetica;
244     margin: 1ex 1em 1ex 1em;
245     padding: 1ex 1em 1ex 1em;
246     border: solid .5px grey;
247     }
248    
249 abate 1064 div.abstract p { font: sans-serif; }
250 abate 580 "
251    
252 abate 1064 type PageO = Page | []
253    
254 abate 1387
255 abate 1413 let button(title : String)(onclick : String) : H:Inline =
256     <input type="submit" style="font-size:8px;" value=title onclick=onclick>[]
257     let button_id(id : String)(title : String)(onclick : String)(style : String)
258     : H:Inline =
259     <input type="submit" id=id
260     style=("font-size:8px;"@style) value=title
261     onclick=onclick>[]
262 abate 1387
263 abate 1412 let demo(no : Int)(name : String)(prefix : String)(txt : String) : H:Flow =
264     let n = [ 'a' !name '_' ] in
265     let prefix = if prefix = "" then "" else [ 'a' !prefix '_' ] in
266 abate 1393 [ !(if (no = 1) then [<script src="demo.js" type="text/javascript">" "]
267 abate 1387 else [])
268     <table style="width:100%">[
269     <tr>[
270     <td style="width:50%">[
271 abate 1413 (button_id (n@"btn") "Edit" ("editable('"@n@"','');") "")
272 abate 1387 (button "Evaluate" ("submit('"@n@"');"))
273 abate 1388 (button "Default" ("defreq('"@n@"');"))
274 abate 1413 (button_id (n@"btnclear") "Clear" ("clearreq('"@n@"');") "visibility:hidden;")
275 abate 1387 ]
276     <td style="width:50%">[
277 abate 1388 <input id=(n@"def") type="hidden" value=txt>[]
278 abate 1411 <input id=(n@"prefix") type="hidden" value=prefix>[]
279 abate 1388 (button "Clear" ("clearres('"@n@"');"))
280 abate 1387 ] ]
281     <tr>[
282 abate 1392 <td valign="top">[
283 abate 1415 <div id=(n@"container")>[
284     <pre id=(n@"req")>txt
285     <textarea id=(n@"edit") cols="50" rows="25" style="display:none;border:1px solid #CCCCCC; background-color:#F0F0F0;">txt
286 abate 1392 ]
287     ]
288 abate 1393 <td valign="top">[ <div id=(n@"res")>[] ] ] ]
289     ]
290 abate 1387
291 abate 343 (* Main transformation function *)
292    
293 abate 386 (* returns the last page of the descendance *)
294 abate 1348
295     let thumbnail(w : String, h : String)
296     (url : String)(title : String) : H:Inlines =
297     [ <a href=url>[
298     <img src=url width=w height=h alt="Click to enlarge" title=title>[] ] ]
299    
300     let thumbwh({ width =? IntStr; height =? IntStr} ->
301     (String -> String ->H:Inlines))
302     | { width = w; height = h } ->
303     let w = int_of w in let h = int_of h in
304     (match h with
305     | 0 -> raise "Thumbnail height = 0"
306     | h -> let w = string_of ((w * 200) div h) in thumbnail (w,"200"))
307     | _ -> thumbnail ("266","200")
308    
309 abate 1065 let gen_page (site : String,
310     prev : PageO, page : Page, next : PageO,
311 abate 1064 path : Path, sitemap : Tree) : PageO =
312     match page with
313 abate 1410 <page name=name leftbar="false"&(leftbar:=`false) else (leftbar:=`true)>[
314 abate 1064 <title>title <banner>banner | <title>(title & banner); items ] ->
315 abate 341
316 abate 625 let footnote_counter = ref Int 0 in
317 abate 713 let footnotes = ref H:Flow [] in
318 abate 1387 let demo_no = ref Int 0 in
319 abate 1412 let last_demo = ref String "" in
320 abate 625
321 abate 713 let text (t : [InlineText*]) : H:Inlines =
322 abate 625 transform t with
323     | <code>x -> [ <b>[ <tt>(highlight x) ] ]
324 abate 1422 | <local href=l>txt -> local_link (sitemap,l,txt)
325 abate 625 | <(tag & (`b|`i|`tt|`em)) (attr)>x -> [ <(tag) (attr)>(text x) ]
326 abate 1264 | <footnote nocount=_>_ ->
327     let n = string_of !footnote_counter in
328     [ <a name=[ 'bnote' !n ]>[]
329     <a href=[ '#note' !n ]>[ '[' !n ']' ] ]
330    
331 abate 625 | <footnote>c ->
332     footnote_counter := !footnote_counter + 1;
333     let n = string_of !footnote_counter in
334     let fn = !footnotes in
335     footnotes := [];
336     let c = <p>[ <a name=[ 'note' !n ]>[]
337     <a href=[ '#bnote' !n ]>[ '[' !n ']' ]
338     ' ' ; text c ] in
339     footnotes := fn @ [ c ] @ !footnotes;
340     [ <a name=[ 'bnote' !n ]>[]
341     <a href=[ '#note' !n ]>[ '[' !n ']' ] ]
342 abate 1348 | <thumbnail ({href=url} & r)>[] ->
343     thumbwh r url ""
344     | <thumbnails ({href=url} & r)>l ->
345     let l = split_thumbnails l in
346     let f = thumbwh r in
347     let c = ref Int 0 in
348     (transform l with (x,y) ->
349     let t = f (url @ x) y in
350     if (!c = 4) then (c := 1; [ <br>[] ] @ t)
351     else (c := !c + 1; t))
352 abate 698 | z -> [ z ]
353 abate 341 in
354 abate 254
355 abate 713 let content (t : Content) : H:Flow =
356 abate 250 transform t with
357 abate 284 | <section title=title>c ->
358 abate 580 [ <p>[ <b style="color: #008000">title ] !(content c) ]
359 abate 1408 | <paper (r)>[ <title>tit aut::Author* <comment>com <abstract>ab ] ->
360 abate 734 [ (match r with
361 abate 1064 | { file = f; old = "" } -> <a class="old" href=f>tit
362 abate 734 | { file = f } -> <a href=f>tit
363     | _ -> <b>tit) '. '
364 abate 250 !(authors aut) '. '
365 abate 254 !(text com)
366 abate 250 <div class="abstract">[ 'Abstract:' !(content ab) ]
367     ]
368     | <slides file=f>[ <title>tit aut::Author* <comment>com ] ->
369 abate 254 [ <a href=f>tit '. ' !(authors aut) '. ' !(text com) ]
370 abate 344 | <sample highlight="false">s ->
371     [ <div class="code">[ <pre>s ] ]
372 abate 336 | <sample>s ->
373 abate 340 [ <div class="code">[ <pre>(highlight s) ] ]
374 abate 979 | <xmlsample highlight="false">s ->
375     [ <div class="xmlcode">[ <pre>s ] ]
376     | <xmlsample>s ->
377     [ <div class="xmlcode">[ <pre>(highlight s) ] ]
378 abate 981 | <sessionsample highlight="false">s ->
379     [ <div class="session">[ <pre>s ] ]
380     | <sessionsample>s ->
381     [ <div class="session">[ <pre>(highlight s) ] ]
382 abate 561 | <link url=url title=title>com ->
383 abate 1065 [ <ul>[ <li>[ <a href=url>title '. ' !(text com) ] ] ]
384 abate 284 | <ul>lis ->
385 abate 1064 ul (map lis with <li>x -> <li>(content x))
386 abate 1264 | <ol (attr) >lis ->
387     ol ((map lis with <li>x -> <li>(content x) ),(attr))
388 abate 713 | H:Xtable & x ->
389 abate 1201 [ <table width="100%">[<tr>[<td align="center">[x]]] ]
390 abate 614 | <p (attr)>x -> [ <p (attr)>(text x) ]
391 abate 681 | <pages-toc (a)>[] ->
392 abate 1064 let toc = transform items with
393     | Page & p ->
394     let sects = match a with {|sections=_|} -> boxes_of p | _ -> [] in
395     [ <li>[ (link_to p) ; sects ] ]
396     | <external href=l title=t>[] -> [ <li>[ <a href=l>t ] ] in
397     ul toc
398 abate 696 | <boxes-toc (a)>[] ->
399 abate 1065 let sections = match a with { section=_ } -> `true | _ -> `false in
400     let short = match a with { short=_ } -> `true | _ -> `false in
401 abate 1064 let toc = transform items with
402 abate 1065 | <box ({title=t; link=l} & ({short=s} | {title=s}))>b ->
403     let t = if short then s else t in
404     let sects =
405     if sections then
406 abate 1064 (transform b with <section title=t>_ -> [<br>[] '-' !t])
407 abate 1065 else [] in
408 abate 1064 [ <li>[ <a href=('#',l)>t !sects ]] in
409     ul toc
410 abate 341 | <site-toc>[] ->
411     [ <ul>[ (display_sitemap sitemap) ] ]
412     | <local-links href=s>[] ->
413 abate 1422 ul (transform (split_comma s) with x ->
414     match local_link(sitemap,x,"") with [] -> [] | x -> [<li>x])
415 abate 356 | <two-columns>[ <left>x <right>y ] ->
416     [ <table width="100%">[
417     <tr>[
418     <td valign="top">(content x)
419     <td valign="top">(content y) ] ] ]
420 abate 1065 | <note title=t>c -> [ <div class="note">[ <b>[!t ': '] !(content c) ]]
421 abate 1064 | <note>c -> [ <div class="note">[ <b>"Note: " !(content c) ]]
422     | <footnotes>[] ->
423     (match !footnotes with
424     | [] -> []
425     | n -> footnotes := []; [ <br>[] (meta n) ] )
426 abate 1384 | <xhtml>i -> i
427 abate 1412 | <demo (r)>s ->
428     demo_no := !demo_no + 1;
429     let name = match r with { label } -> label | _ -> string_of !demo_no in
430     let prefix =
431     match r with { prefix = "last" } -> !last_demo
432     | { prefix } -> prefix
433     | _ -> "" in
434     last_demo := name;
435     demo !demo_no name prefix s
436 abate 341 | t -> text [ t ]
437     in
438 abate 250
439 abate 580 (* Preparing left panel *)
440 abate 698
441 abate 580 let left =
442 abate 1410 if leftbar then
443     let navig = transform items with <left>c -> [ c ] in
444     let left = match navig with [] -> [ [<boxes-toc>[]] ] | n -> n in
445     [
446 abate 1411
447 abate 580 <td valign="top" align="left">[
448 abate 1418 <span style="position:fixed;background:#ffffff;border: solid 2px black; cursor:e-resize;" onclick="javascript:var s=document.getElementById('leftbar').style; var d=s.display=='none'?'block':'none'; s.display=d; document.cookie='leftbar='+d;">"*"
449 abate 1411 <table cellpadding="0" cellspacing="15" id="leftbar"
450 abate 586 width="200"
451     style="font-size:80%; border: 1px dashed black;
452 abate 797 background: #ffcd72"> (* altbg 9aa8ba *)
453 abate 1410 (map left with x -> <tr>[ <td>[ (small_box (content x)) ] ]) ] ]
454     else [] in
455 abate 580
456 abate 713 let dpath : H:Inlines = transform path with
457 abate 391 | { url = f; title = t } -> [ <a href=f>t ': ']
458 abate 341 in
459 abate 1065 let npath = path @ [ { url = (url_of_page page); title = title } ] in
460 abate 351 let subpages = transform items with p & Page -> [ p ] in
461 abate 1065 let (next,last) = gen_page_seq (site,page, subpages, next, npath, sitemap) in
462 abate 391 let next = match next with [] -> []
463 abate 1065 | <page>[ <title>t; _ ] & p ->
464     [ <a href=(url_of_page p)>[
465 abate 595 <img width="16" height="16" class="icon" alt="Next page:"
466 abate 586 src="img/right.gif">[]
467 abate 391 ' ' !t
468     ] ] in
469     let prev = match prev with [] -> []
470 abate 1065 | <page>[ <title>t; _ ] & p ->
471     [ <a href=(url_of_page p)>[
472 abate 586 <img width="16" height="16" class="icon"
473 abate 595 alt="Previous page:" src="img/left.gif">[]
474 abate 391 ' ' !t
475     ] ] in
476 abate 580 let navig =
477 abate 391 if prev = [] then [] else
478 abate 1065 [ (small_box [
479 abate 391 <p>[ !dpath !title ]
480 abate 580 <p>[ !prev ' ' !next ] ]) ] in
481    
482     (* Preparing main panel *)
483     let main = transform items with
484 abate 1065 | <box title=t link=l>c -> [ (box_title (content c, l, t)) ]
485     | <box>c -> [ (box (content c)) ]
486 abate 1064 | <footnotes>[] ->
487     (match !footnotes with
488     | [] -> []
489     | n -> footnotes := []; [ (meta n) ] )
490 abate 1058 | <meta>c -> [ (meta (content c)) ]
491 abate 580 in
492 abate 625 let notes = match !footnotes with
493     | [] -> []
494     | n -> [ (meta n) ] in
495     let main = match (navig @ main @ notes @ navig) with
496 abate 580 | [] -> raise "Empty page !"
497     | x -> x in
498    
499 abate 713 let right : H:Xtd =
500 abate 580 <td valign="top" align="left" style="width:100%">[
501     <table width="100%">[
502     <tr>[ <td valign="top" align="left"
503     style="border: 2px solid black; background: #ffffff;
504     text-align:center; color: #aa0000; font: bold 200% helvetica" >
505     (text banner)
506     ]
507    
508     <tr>[
509     <td valign="top" align="left"
510 abate 797 style="border: 1px solid black; background: #fccead">[ (* altbg c8ccd1 *)
511 abate 589 <table width="100%" cellpadding="0" cellspacing="17">
512 abate 580 (map main with x -> <tr>[ <td>[x] ])
513     ] ]
514     ] ] in
515    
516 abate 713 let html : H:Xhtml =
517 abate 250 <html>[
518     <head>[
519 abate 1065 <title>[ !site ': ' !title ]
520 abate 561 <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">[]
521 abate 580 <style type="text/css">style
522 abate 250 ]
523 abate 1418 <body style="margin: 0; padding : 0; background: #fcb333"
524     onload="javascript:if (document.cookie.indexOf('leftbar=none')>=0) document.getElementById('leftbar').style.display='none';">[ (* altbg 4e6e99 *)
525 abate 580 <table cellspacing="10" cellpadding="0" width="100%" border="0">[
526 abate 1410 <tr>[ !left right ]
527 abate 580 ]
528 abate 250 ]
529 abate 341 ]
530     in
531 abate 391 let txt : Latin1 =
532 abate 351 [ '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"'
533 abate 341 ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
534 abate 580 !(print_xml html) ] in
535     let fn = "www/" @ name @ ".html" in
536 abate 625 dump_to_file fn txt;
537 abate 488 last
538 abate 386
539 abate 250
540 abate 488 let gen_page_seq
541 abate 1065 (site : String,
542     prev : PageO, pages : [Page*], next : PageO,
543 abate 1064 path : Path, sitemap : Tree) : (PageO, PageO) =
544 abate 351 match pages with
545     | [ p1 p2 ; _ ] & [ _; rest ] ->
546 abate 1065 let last = gen_page (site,prev,p1,p2, path, sitemap) in
547     let (_,last) = gen_page_seq (site,last, rest, next, path, sitemap) in
548 abate 386 (p1,last)
549 abate 351 | [ p ] ->
550 abate 1065 let last = gen_page (site,prev,p,next, path, sitemap) in (p,last)
551 abate 488 | [] -> (next,prev)
552 abate 351
553    
554 abate 488 ;;
555 abate 284
556 abate 1401 let [<site>[ <title>site p ] ] =
557     try (load_include input :? [ Site ])
558     with (err & Latin1) ->
559     print ['Invalid input document\n' !err '\n'];
560     exit 2
561     in
562     let _ = gen_page (site,[],p,[], [], compute_sitemap p) in []

CVS Admin">CVS Admin
ViewVC Help
Powered by ViewVC 1.1.5