Commit a3dc83e9 authored by Pietro Abate's avatar Pietro Abate

fix syntaxt problem in memento.cd

parent aa7ac8a5
......@@ -45,11 +45,11 @@ type Table = <table border=?String; bgcolor=String; width=String>
(* Input document *)
type Page = <page filename=String>[ <title>String; Content ];;
type Page = <page filename=Latin1>[ <title>String; Content ];;
type Content = [ (Box | Section)* ];;
type Box = <box>Text;;
type Section = <section>[ <title>String ; Text ];;
type Section = <section no=?Int>[ <title>String ; Text ];;
type Text = [ (Char | <duce>String | <ul>[<li>Text +]
| <a href=String>String | <br>[])* ];;
......@@ -62,7 +62,7 @@ let fun box(c : [Flow*]) : [Block*] =
let fun format (Box | Section | Content -> [Block*]; Text -> [Flow*])
| <box>s -> box (format s)
| <section no=i>[ <title>t ; s ] ->
box [ <h2>[!(string_of i) '. ' !t] <a name=string_of i>[];
box [ <h2>[!(string_of i) '. ' !t] <a name=(string_of i)>[];
format s ]
| txt & Text -> (map txt with
| <duce>c -> <b>[<tt>c]
......@@ -81,10 +81,10 @@ let fun summary (Content -> [Block*])
let (fname, title, content) =
match load_xml "memento.xml" with
| <page filename=f>[ <title>t ; c ] & Page ->
let fun aux ((Int,Content) -> Content)
| (_,[]) -> []
| (i,(<section>s,rem)) -> [ <section no=i>s !(aux (i+1,rem)) ]
| (i,(x,rem)) -> [ x !(aux (i,rem)) ]
let fun aux ((Int,Content) -> Content)
| (_,[]) -> []
| (i,(<section>s,rem)) -> [ <section no=i>s !(aux (i+1,rem)) ]
| (i,(x,rem)) -> [ x !(aux (i,rem)) ]
in
(f,t,aux (1,c))
| _ -> raise "Invalid input document!";;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment