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

Diff of /web/site.cd

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

revision 1347 by abate, Tue Jul 10 18:40:21 2007 UTC revision 1348 by abate, Tue Jul 10 18:41:21 2007 UTC
# Line 63  Line 63 
63     | <local href=String>String     | <local href=String>String
64     | <footnote>[InlineText*]     | <footnote>[InlineText*]
65     | H:Xa | H:Ximg | H:Xbr     | H:Xa | H:Ximg | H:Xbr
66       | <thumbnail href=String width=?IntStr height=?IntStr>[]
67       | <thumbnails href=String width=?IntStr height=?IntStr>[ PCDATA ]
68    
69    type IntStr = ['0'--'9'+]
70    
71    
72  (** Generic purpose functions **)  (** Generic purpose functions **)
73    
# Line 97  Line 102 
102   | [ x::(Char*?) ',' ; rest ] -> (x, split_comma rest)   | [ x::(Char*?) ',' ; rest ] -> (x, split_comma rest)
103   | s -> [ s ]   | s -> [ s ]
104    
105    type wschar = ' ' | '\n' | '\t' | '\r'
106    
107    let split_thumbnails (String -> [(String,String)*])
108     | [ wschar* x::(Char\wschar\':')+ ':' y::_*? '.'; rest ] ->
109            ((x,y), split_thumbnails rest)
110     | [ wschar* x::(Char\wschar)+; rest ] ->
111            ((x,""), split_thumbnails rest)
112     | [ wschar* ] -> []
113    
114  (** Internal types **)  (** Internal types **)
115    
# Line 237  Line 250 
250  (* Main transformation function *)  (* Main transformation function *)
251    
252  (* returns the last page of the descendance *)  (* returns the last page of the descendance *)
253    
254    let thumbnail(w : String, h : String)
255     (url : String)(title : String) : H:Inlines =
256     [ <a href=url>[
257       <img src=url width=w height=h alt="Click to enlarge" title=title>[] ] ]
258    
259    let thumbwh({ width =? IntStr; height =? IntStr} ->
260       (String -> String ->H:Inlines))
261      | { width = w; height = h } ->
262          let w = int_of w in let h = int_of h in
263          (match h with
264           | 0 -> raise "Thumbnail height = 0"
265           | h -> let w = string_of ((w * 200) div h) in thumbnail (w,"200"))
266      | _ -> thumbnail ("266","200")
267    
268  let gen_page (site : String,  let gen_page (site : String,
269                prev : PageO, page : Page, next : PageO,                prev : PageO, page : Page, next : PageO,
270                path : Path, sitemap : Tree) : PageO =                path : Path, sitemap : Tree) : PageO =
# Line 268  Line 296 
296        footnotes := fn @ [ c ] @ !footnotes;        footnotes := fn @ [ c ] @ !footnotes;
297        [ <a name=[ 'bnote' !n ]>[]        [ <a name=[ 'bnote' !n ]>[]
298          <a href=[ '#note' !n ]>[ '[' !n ']' ] ]          <a href=[ '#note' !n ]>[ '[' !n ']' ] ]
299       | <thumbnail ({href=url} & r)>[] ->
300          thumbwh r url ""
301       | <thumbnails ({href=url} & r)>l ->
302          let l = split_thumbnails l in
303          let f = thumbwh r in
304          let c = ref Int 0 in
305          (transform l with (x,y) ->
306              let t = f (url @ x) y in
307              if (!c = 4) then (c := 1; [ <br>[] ] @ t)
308              else (c := !c + 1; t))
309     | z -> [ z ]     | z -> [ z ]
310   in   in
311    

Legend:
Removed from v.1347  
changed lines
  Added in v.1348

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