Commit 7e9108de authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-05-14 21:44:05 by cvscast] Empty log message

Original author: cvscast
Date: 2003-05-14 21:44:06+00:00
parent 541fd28f
......@@ -182,3 +182,5 @@ build_website:
rsh cedre ". .env; cd IMPLEM/CDUCE; make web/files"
scp web/*.php web/cduce.css cduce@iris:public_html/
build_website_local: web/files
scp web/*.php web/cduce.css cduce@iris:public_html/
......@@ -12,12 +12,35 @@
<box title="Our canonical example" link="sort">
The example below is the one we use to demonstrate
how overloaded functions can avoid duplicating code.
Without overloaded functions, we would need to define
two mutually recursive functions in order to type-check
the transformation. Here, two constraints
in the (highlighted) function interface
can express precisely the behaviour of the function.
<include-verbatim file=""/>
<box title="The script that generates this site" link="site">
The script below is one of the longest CDuce application ever written
;-) It is used to produce all the pages of this web site (except
the <local href="proto">web prototype</local> which is
an CGI script written in OCaml). CDuce type system ensures
that produced pages are valid w.r.t XHTML 1.0 Strict.
This program features both XML and text-content manipulation.
It also demonstrates the use of non-XML internal data structures.
Here, a tree represents internally the site
structure, and a list represents the path from the
root to the current page (in order to display the "You're here" line).
<sample highlight="false">
<include-verbatim file=""/>
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<page name="index">
<title>Home page</title>
<img title="CDuce" src="img/cduce_logo.jpg" width="400" height="206"
......@@ -9,7 +9,7 @@ type Woman = <woman name=String>[ Sons Daughters ];;
type Sons = <sons>[ Man* ];;
type Daughters = <daughters>[ Woman* ];;
let fun split (MPerson -> Man ; FPerson -> Woman)
let fun split ({{MPerson -> Man ; FPerson -> Woman}})
<person gender=g>[ <name>n <children>[(mc::MPerson | fc::FPerson)*] ] ->
(* this pattern collects all the MPerson in mc, and all the FPerson in fc *)
let tag = match g with "F" -> `woman | "M" -> `man in
......@@ -228,12 +228,13 @@ match page with
let html : Xhtml =
<title>[ 'CDuce: ' !title ]
<meta content="text/html; charset=iso-8859-1"; http-equiv="Content-Type">[]
<meta content="css">[] (* Placeholder for PHP code *)
<div class="title">[ <h1>(text banner) <p>[ !dpath !title ] ]
<div class="title">[ <h1>(text banner)
<p>[ <b>"You're here: " !dpath !title ] ]
<div id="Sidelog">navig
<div id="Content">main
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