Commit 636c4755 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-06-30 14:29:07 by cvscast] Empty log message

Original author: cvscast
Date: 2003-06-30 14:29:07+00:00
parent c1733997
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
simplified definition of Xhtml simplified definition of Xhtml
*) *)
type Flow = Char | Block | Inline ;; type Flow = Char | Block | Inline ;;
type Block = P | Heading | Lists | Blocktext | Char type Block = P | Heading | Lists | Blocktext | Char
type Lists = Ul type Lists = Ul
...@@ -34,6 +32,7 @@ type B = <b>[ Inline* ];; ...@@ -34,6 +32,7 @@ type B = <b>[ Inline* ];;
type Big = <big>[ Inline* ];; type Big = <big>[ Inline* ];;
type Small = <small>[ Inline* ];; type Small = <small>[ Inline* ];;
(* xtransform matches the patterns against the root element of each (* xtransform matches the patterns against the root element of each
XML tree and, if it fails, it recursively applies itself to the XML tree and, if it fails, it recursively applies itself to the
sequence of sons of the root. sequence of sons of the root.
...@@ -42,11 +41,9 @@ type Small = <small>[ Inline* ];; ...@@ -42,11 +41,9 @@ type Small = <small>[ Inline* ];;
document as follows document as follows
*) *)
let bold(x:[Xhtml]):[Xhtml]=xtransform x with <a (y)>t -> [ <a(y)>[<b>t] ] let bold(x:[Xhtml]):[Xhtml]=xtransform x with <a (y)>t -> [ <a(y)>[<b>t] ]
(* let us apply the function to a document where links appear (* let us apply the function to a document where links appear
at different depths at different depths
*) *)
...@@ -57,7 +54,7 @@ let doc : Xhtml = ...@@ -57,7 +54,7 @@ let doc : Xhtml =
<head>[<title>"Example" <link>[]] <head>[<title>"Example" <link>[]]
<body>[ <body>[
<h2>['You can have links ' <a href="here">"here"] <h2>['You can have links ' <a href="here">"here"]
<p>['Or they can be down'] <pre>['Or they can be down']
<ul>[ <ul>[
<li>['In ' <a name="list">"lists" ' for instance'] <li>['In ' <a name="list">"lists" ' for instance']
<li>['or you oddly decided to ' <li>['or you oddly decided to '
...@@ -65,15 +62,19 @@ let doc : Xhtml = ...@@ -65,15 +62,19 @@ let doc : Xhtml =
' them ' ' them '
] ]
] ]
<address>[ <address>[
'and even if they are in fancy ' <a name="address">"address boxes" 'and even if they are in fancy ' <a name="address">"address boxes"
]
<p>[
'nevertheless ' <a href="http://www.cduce.org">"Cduce" ' and '
<a href="xtransform">[<tt>"xtransform"]
' will put all links in bold so that when'
' you program your transformation you '
<big>[<a name="">" don\'t " ] ' have to worry about it'
] ]
<p>['nevertheless ' <a href="http://www.cduce.org">"Cduce" ' and ' ]
<a href="xtransform">[<tt>"xtransform"] ' will put all links in bold ']
]
];; ];;
bold [doc];; bold [doc];;
match let [x] = bold [doc] in print_xml x;;
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