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
6f6f19a9
Commit
6f6f19a9
authored
Oct 05, 2007
by
Pietro Abate
Browse files
[r2005-01-06 16:02:02 by afrisch] html output again
Original author: afrisch Date: 2005-01-06 16:02:02+00:00
parent
a4c73a11
Changes
3
Hide whitespace changes
Inline
Side-by-side
parser/location.ml
View file @
6f6f19a9
...
...
@@ -95,9 +95,7 @@ let print_loc ppf ((src,i,j),w) =
let
extr
s
i
j
=
try
let
n
=
min
(
String
.
length
s
)
j
-
i
in
if
n
<=
0
then
""
else
Netencoding
.
Html
.
encode_from_latin1
(
String
.
sub
s
i
n
)
if
n
<=
0
then
""
else
String
.
sub
s
i
n
with
e
->
failwith
(
Printf
.
sprintf
"Location.extr len=%i i=%i j=%i"
(
String
.
length
s
)
i
j
)
...
...
@@ -147,22 +145,6 @@ let mk_loc loc x = { loc = loc; descr = x }
let
mknoloc
x
=
{
loc
=
noloc
;
descr
=
x
}
let
loc_of_pos
(
i
,
j
)
=
(
!
source
,
i
,
j
)
(*
let protect ppf f =
match !viewport with
| `Html ->
let b = Buffer.create 63 in
let ppf' = Format.formatter_of_buffer b in
Format.pp_set_margin ppf' (Format.pp_get_margin ppf ());
f ppf';
Format.pp_print_flush ppf' ();
let s = Buffer.contents b in
let s = Netencoding.Html.encode_from_latin1 s in
Format.fprintf ppf "@[%s@]" s
| _ -> f ppf
*)
let
protected
=
ref
false
let
set_protected
p
=
protected
:=
p
let
is_protected
()
=
!
protected
...
...
web/demo.xml
View file @
6f6f19a9
...
...
@@ -6,15 +6,25 @@
<title>
CDuce demo
</title>
<box
title=
"Types, pattern matching"
link=
"typpm"
>
<demo
label=
"1"
><include-verbatim
file=
"funxml_types.cd"
/>
<![CDATA[
<demo><include-verbatim
file=
"funxml_types.cd"
/>
<![CDATA[
let title(Book ->
String)
<book>
[
<title>
x _* ] -> x
let authors(Book -> [Author+])
<_>
[ (x::Author|_)* ] -> x
]]>
</demo>
</box>
]]>
</demo></box>
<box
title=
"Printing functions"
link=
"printfun"
>
<demo
prefix=
"1"
>
<![CDATA[
<box
title=
"Sample values"
link=
"samp"
><demo
prefix=
"last"
>
<![CDATA[
let b1 : Book = <book>
[
<title>
[ 'Object-Oriented Programming' ]
<subtitle>
[ 'A Unified Foundation' ]
<author>
[ 'Castagna' ] ]
let b2 : Book =
<book>
[
<title>
[ 'Persistent Object Systems' ]
<author>
[ 'Atkinson' ]
<author>
[ 'Benzaken' ]
<author>
[ 'Maier' ] ]
let v : Bib = [ b1 b2 ]
]]>
</demo></box>
<box
title=
"Printing functions"
link=
"printfun"
><demo
prefix=
"last"
>
<![CDATA[
type FBook = Book ->
String
type ABook =
<book
print=
FBook
>
[ Title Subtitle? Author+ ]
type ABib = [ ABook* ]
...
...
@@ -27,24 +37,12 @@ let b : Bib =
[
<book>
[
<title>
"T"
<subtitle>
"S"
<author>
"A" ] ]
let ab = prepare b
]]>
</demo>
</box>
]]>
</demo></box>
<!--
#silent
let b1 : Book = <book>[
<title>[ 'Object-Oriented Programming' ]
<subtitle>[ 'A Unified Foundation' ]
<author>[ 'Castagna' ] ]
let b2 : Book = <book>[
<title>[ 'Persistent Object Systems' ]
<author>[ 'Atkinson' ]
<author>[ 'Benzaken' ]
<author>[ 'Maier' ] ]
let v : Bib = [ b1 b2 ]
#verbose
let z = authors b1
...
...
web/site.cd
View file @
6f6f19a9
...
...
@@ -253,10 +253,9 @@ type PageO = Page | []
let button(title : String)(onclick : String) : H:Xinput =
<input
type=
"submit"
value=
title
onclick=
onclick
>
[]
let demo(no : Int)(r : { label =? String; prefix =? String })(txt : String) : H:Flow =
let n = match r with { label } -> label | _ -> string_of no in
let n = [ 'a' !n '_' ] in
let prefix = match r with { prefix } -> [ 'a' !prefix '_' ] | _ -> "" in
let demo(no : Int)(name : String)(prefix : String)(txt : String) : H:Flow =
let n = [ 'a' !name '_' ] in
let prefix = if prefix = "" then "" else [ 'a' !prefix '_' ] in
[ !(if (no = 1) then [
<script
src=
"demo.js"
type=
"text/javascript"
>
"
"
]
else
[])
<
table
style
=
"
width:100%
"
>
[
...
...
@@ -310,6 +309,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
last_demo
=
ref
String
""
in
let
text
(
t
:
[
InlineText
*
])
:
H
:
Inlines
=
transform
t
with
...
...
@@ -417,7 +417,15 @@ match page with
|
[]
->
[]
|
n
->
footnotes
:
=
[];
[
<
br
>
[]
(
meta
n
)
]
)
|
<
xhtml
>
i
->
i
|
<
demo
(
r
)
>
s
->
demo_no
:
=
!
demo_no
+
1
;
demo
!
demo_no
r
s
|
<
demo
(
r
)
>
s
->
demo_no
:
=
!
demo_no
+
1
;
let
name
=
match
r
with
{
label
}
->
label
|
_
->
string_of
!
demo_no
in
let
prefix
=
match
r
with
{
prefix
=
"
last
"
}
->
!
last_demo
|
{
prefix
}
->
prefix
|
_
->
""
in
last_demo
:
=
name
;
demo
!
demo_no
name
prefix
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