Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
a3dc83e9
Commit
a3dc83e9
authored
Feb 27, 2014
by
Pietro Abate
Browse files
fix syntaxt problem in memento.cd
parent
aa7ac8a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/misc/memento.cd
View file @
a3dc83e9
...
...
@@ -45,11 +45,11 @@ type Table = <table border=?String; bgcolor=String; width=String>
(* Input document *)
type Page =
<page
filename=
Str
in
g
>
[
<title>
String; Content ];;
type Page =
<page
filename=
Lat
in
1
>
[
<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!";;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment