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

Diff of /web/site.cd

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

revision 368 by abate, Tue Jul 10 17:28:55 2007 UTC revision 369 by abate, Tue Jul 10 17:29:02 2007 UTC
# Line 1  Line 1 
1  (* This CDuce script produces CDuce web site. *)  (* This CDuce script produces CDuce web site. *)
2    
3    (** Command line **)
4    
5    let (input, php) =
6      match argv with
7      | [ "-php" s ] -> (s, `true)
8      | [ s ] -> (s, `false)
9      | _ -> raise "Please specify an input file on the command line";;
10    
11    
12  (** Output types **)  (** Output types **)
13    
14  include "xhtml-strict.cd";;  (* XHTML 1 Strict DTD *)  include "xhtml-strict.cd";;  (* XHTML 1 Strict DTD *)
# Line 83  Line 92 
92      The function patch_css search for the textual representation of this      The function patch_css search for the textual representation of this
93      element and replace it with the PHP code. **)      element and replace it with the PHP code. **)
94    
95    let css : String =
96      ['<link rel="stylesheet" href="cduce.css" type="text/css">'];;
97    
98    let fun protect_quote (s : String) : String =
99      transform s with '"' -> [ '\\"' ] | c -> [c];;
100    
101  let php_css : String =  let php_css : String =
102  [' <?php  if php then
103  $browser = getenv("HTTP_USER_AGENT");  [' <?php $browser = getenv("HTTP_USER_AGENT");
104  if (preg_match("/MSIE/i", "$browser")) {  if (preg_match("/Mozilla/i", "$browser") && !preg_match("/Mozilla\\/5.0/i", "$browser"))
105          $css = "<link rel=\\"stylesheet\\" href=\\"cduce.css\\"  {
106  type=\\"text/css\\">";    echo "<blink>For better presentation use a more recent version of
107  } elseif (preg_match("/Mozilla/i", "$browser")) {  your browser, like Netscape 6</blink>";
         $css = "<blink>For better presentation use a more recent version  
 of your browser, like Netscape 6</blink>";  
 } if (preg_match("/Mozilla\\/5.0/i", "$browser")) {  
         $css = "<link rel=\\"stylesheet\\" href=\\"cduce.css\\"  
 type=\\"text/css\\">";  
 } elseif  (preg_match("/opera/i", "$browser")) {  
         $css = "<link rel=\\"stylesheet\\" href=\\"cduce.css\\"  
 type=\\"text/css\\">";  
108  }  }
109  echo "$css";  else { echo "' !(protect_quote css) '"; }
110  ?> '];;  ?> ']
111    else css;;
112    
113    
114  let fun patch_css (String -> String)  let fun patch_css (String -> String)
# Line 278  Line 286 
286    
287  (* Entry point *)  (* Entry point *)
288    
289  match argv with  match load_include input with
  | [ s ] ->  
     (match load_include s with  
290       | [ Page & p ] -> gen_page ([],p,[], [], compute_sitemap p)       | [ Page & p ] -> gen_page ([],p,[], [], compute_sitemap p)
291       | _ -> raise ("Invalid input document " @ s))   | _ -> raise ("Invalid input document " @ input);;
292   | _ -> raise "Please specify an input file on the command line";;  

Legend:
Removed from v.368  
changed lines
  Added in v.369

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