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
cd3a0d46
Commit
cd3a0d46
authored
Oct 05, 2007
by
Pietro Abate
Browse files
[r2004-12-28 01:30:34 by afrisch] Demo
Original author: afrisch Date: 2004-12-28 01:31:49+00:00
parent
653a9e48
Changes
2
Hide whitespace changes
Inline
Side-by-side
web/demo.xml
View file @
cd3a0d46
...
...
@@ -2,31 +2,18 @@
<page
name=
"demo"
>
<title>
CDuce demo
</title>
<box
title=
"Demo"
link=
"demo"
>
<xhtml>
<table
style=
"width:100%"
>
<tr>
<td
style=
"width:50%"
>
<input
type=
"submit"
value=
"Evaluate"
onclick=
"submit('a');"
/>
<input
type=
"button"
value=
"Clear"
onclick=
"clearreq('a');"
/>
</td>
<td
style=
"width:50%"
>
<input
type=
"button"
value=
"Clear"
onclick=
"show_result('a','');"
/>
</td>
</tr>
<tr>
<td>
<textarea
id=
"areq"
cols=
"60"
rows=
"25"
>
[];;
</textarea>
</td>
<td
valign=
"top"
>
<div
id=
"ares"
></div>
</td>
</tr>
</table>
<script
src=
"demo.js"
type=
"text/javascript"
/>
</xhtml>
<box
title=
"Integers"
link=
"ints"
>
<demo>
let x = 2;;
let a = x * 10;;
</demo>
</box>
<box
title=
"Strings"
link=
"strs"
>
<demo>
let x = "abc";;
let a = [ !x 'xyz' ] @ "123";;
</demo>
</box>
</page>
web/site.cd
View file @
cd3a0d46
...
...
@@ -53,7 +53,8 @@ type Content =
|
<two-columns>
[
<left>
Content
<right>
Content ]
|
<note
title=
?String
>
Content
|
<footnotes>
[]
|
<xhtml>
H:Flow
|
<xhtml>
H:Flow
|
<demo>
String
| InlineText
)* ]
...
...
@@ -248,6 +249,27 @@ div.abstract p { font: sans-serif; }
type PageO = Page | []
let button(title : String)(onclick : String) : H:Xinput =
<input
type=
"submit"
value=
title
onclick=
onclick
>
[]
let demo(no : Int)(txt : String) : H:Flow =
let n = [ 'a' !(string_of no) '_' ] in
[ !(if (no = 1) then [
<script
src=
"demo.js"
type=
"text/javascript"
>
[]]
else
[])
<
table
style
=
"
width:100%
"
>
[
<
tr
>
[
<
td
style
=
"
width:50%
"
>
[
(
button
"
Evaluate
"
(
"
submit('
"
@
n
@
"
');
"
))
(
button
"
Clear
"
(
"
clearreq('
"
@
n
@
"
';)
"
))
]
<
td
style
=
"
width:50%
"
>
[
(
button
"
Clear
"
(
"
show_result('
"
@
n
@
"
','');
"
))
]
]
<
tr
>
[
<
td
>
[
<
textarea
id
=
(
n
@
"
req
"
)
cols
=
"
60
"
rows
=
"
25
"
>
txt
]
<
td
valign
=
"
top
"
>
[
<
div
id
=
(
n
@
"
res
"
)
>
[]
]
]
]
]
(
*
Main
transformation
function
*
)
(
*
returns
the
last
page
of
the
descendance
*
)
...
...
@@ -275,6 +297,7 @@ match page with
let
footnote_counter
=
ref
Int
0
in
let
footnotes
=
ref
H
:
Flow
[]
in
let
demo_no
=
ref
Int
0
in
let
text
(
t
:
[
InlineText
*
])
:
H
:
Inlines
=
transform
t
with
...
...
@@ -382,6 +405,7 @@ match page with
|
[]
->
[]
|
n
->
footnotes
:
=
[];
[
<
br
>
[]
(
meta
n
)
]
)
|
<
xhtml
>
i
->
i
|
<
demo
>
s
->
demo_no
:
=
!
demo_no
+
1
;
demo
!
demo_no
s
|
t
->
text
[
t
]
in
...
...
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