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

Diff of /web/site.cd

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 252 by abate, Tue Jul 10 17:19:18 2007 UTC revision 253 by abate, Tue Jul 10 17:19:32 2007 UTC
# Line 1  Line 1 
1  include "xhtml-strict.cd";;  include "xhtml-strict.cd";;
2  include "xhtml-categ.cd";;  include "xhtml-categ.cd";;
3    
4    type Site = <site>[ <page {|input=String; output=String|}>[]* ];;
5    
6  type Page = <page>[  type Page = <page>[
7               <title>String               <title>String
8               <banner>[InlineText*]               <banner>[InlineText*]
# Line 98  Line 100 
100    ]    ]
101   ];;   ];;
102    
103  let page : Page = match load_xml "site.xml" with  let fun do_page((String,String) -> [])
104     (inf,outf) ->
105        let _ = print [ 'Loading ' !inf '... ' ] in
106        let page = match load_xml inf with
107    | Page & p -> p    | Page & p -> p
108    | _ -> raise "Invalid input document";;        | _ -> raise ("Invalid input document" @ inf) in
109        let _ = print [ 'Generating html ... ' ] in
110  let out : String =      let html : String =
111   [ '<?xml version="1.0" encoding="iso-8859-1"?>'   [ '<?xml version="1.0" encoding="iso-8859-1"?>'
112     '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"'     '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"'
113     '  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'     '  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
114     !(print_xml (page2html page)) ];;           !(print_xml (page2html page)) ] in
115        let _ = print [ 'Saving to ' !outf '...\n' ] in
116        dump_to_file outf html;;
117    
118    
119  dump_to_file "index.html" out;;  let site =
120     let _ = print [ 'Loading site.xml ...\n' ] in
121     match load_xml "site.xml" with
122     | Site & <site>s ->
123        (transform s with <page input=inf; output=outf>[] ->
124                             do_page(inf,outf))
125     | _ -> raise "Invalid site.xml";;

Legend:
Removed from v.252  
changed lines
  Added in v.253

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