Commit 44eb20dc authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-07-24 16:00:10 by cvscast] Experiment with encoded references

Original author: cvscast
Date: 2003-07-24 16:00:10+00:00
parent ee3879ff
......@@ -533,7 +533,7 @@ EXTEND
expr_record_spec:
[ [ r = LIST1
[ l = [LIDENT | UIDENT | keyword ]; "="; x = expr ->
[ l = [LIDENT | UIDENT | keyword ]; "="; x = expr LEVEL "no_appl" ->
(label l,x) ]
SEP ";" ->
exp loc (RecordLitt r)
......
......@@ -22,6 +22,7 @@ Content:
- site-toc: global sitemap
- local-links: list of links to some arbitrary pages of the site
(href is a comma separted list of page names)
- footnote
- ...
......@@ -95,7 +95,16 @@ DTD, XML Schema, Relax-NG, ...) seriously. The benefit are the following:</p>
<ul>
<li> <b>static verifications</b>
(e.g.: ensure that a transformation produces a valid document <a href="#ftn1"><sup>1</sup></a>);</li>
(e.g.: ensure that a transformation produces a valid document
<footnote>
Valid with respect to validity constraints
that can be expressed by the type system (thus typically excluding
constraints like <a
href="http://www.w3.org/TR/REC-xml#sec-attribute-types">ID</a> and
<a href="http://www.w3.org/TR/REC-xml#sec-attribute-types">IDREF</a>).
</footnote>);</li>
<li> in particular, we aim at <b>smooth and safe</b> compositions
of XML transformations, and incremental programming;</li>
<li> static <b>optimizations</b> and <b>efficient execution model</b>
......@@ -143,11 +152,7 @@ style-sheet (we performed benchmarks with
the xsltproc tools from the Gnome libxslt library).
</p>
<p style="font-size:80%"><a name="ftn1"><sup>1</sup></a>Valid with respect to validity constraints
that can be expressed by the type system (thus typically excluding
constraints like <a href="http://www.w3.org/TR/REC-xml#sec-attribute-types">ID</a> and
<a href="http://www.w3.org/TR/REC-xml#sec-attribute-types">IDREF</a>).
</p>
</box>
<box title="Research directions" link="research">
......
......@@ -57,7 +57,7 @@ type InlineText =
| <(`b|`i|`tt|`em) {| style=?String |}>[InlineText*]
| <code>String
| <local href=String>String
| <footnote>Content
| <footnote>[InlineText*]
| Xa | Ximg | Xbr
......@@ -123,7 +123,7 @@ let local_link (sitemap : Tree, l : String, txt : String) : Inline =
let compute_sitemap ((Page|External) -> Tree)
<page name=name>[ <title>title (c::(Page|External) | _)* ] ->
let children = map c with p -> compute_sitemap p in
{ name = name; url = url_of_name name; title = title; children =children }
{ name = name; url = (url_of_name name); title = title; children =children }
|<external name=name href=h title=t>[] ->
{ name = name; url = h; title = t; children = [] }
......@@ -193,7 +193,6 @@ div.abstract p {
(* Main transformation function *)
(* returns the last page of the descendance *)
let gen_page (prev : Page|[], page : Page, next : Page|[],
path : Path, sitemap : Tree) : (Page|[]) =
......@@ -201,14 +200,27 @@ match page with
<page name=name>[
<title>title <banner>banner | <title>(title & banner); items ] ->
let footnote_counter = ref Int 0 in
let footnotes = ref Flow [] in
let text (t : [InlineText*]) : Inlines =
map t with
| <code>x -> <b>[ <tt>(highlight x) ]
| <local href=l>txt -> local_link (sitemap,l,txt)
| <(tag & (`b|`i|`tt|`em)) (attr)>x -> <(tag) (attr)>(text x)
(* | <a href=url>_ & z -> let [] = print [ 'Link: ' !url '\n'] in z *)
| <footnote>_ -> raise "Footnotes not yet implemented !"
| z -> z
transform t with
| <code>x -> [ <b>[ <tt>(highlight x) ] ]
| <local href=l>txt -> [ (local_link (sitemap,l,txt)) ]
| <(tag & (`b|`i|`tt|`em)) (attr)>x -> [ <(tag) (attr)>(text x) ]
(* | <a href=url>_ & z -> let [] = print [ 'Link: ' !url '\n'] in [z] *)
| <footnote>c ->
footnote_counter := !footnote_counter + 1;
let n = string_of !footnote_counter in
let fn = !footnotes in
footnotes := [];
let c = <p>[ <a name=[ 'note' !n ]>[]
<a href=[ '#bnote' !n ]>[ '[' !n ']' ]
' ' ; text c ] in
footnotes := fn @ [ c ] @ !footnotes;
[ <a name=[ 'bnote' !n ]>[]
<a href=[ '#note' !n ]>[ '[' !n ']' ] ]
| z -> [ z ]
in
let content (t : Content) : Flow =
......@@ -260,7 +272,6 @@ match page with
| t -> text [ t ]
in
(* Preparing left panel *)
let navig = transform items with <left>c -> [ c ] in
let left = match navig with [] -> [ [<boxes-toc>[]] ] | n -> n in
......@@ -275,7 +286,7 @@ match page with
let dpath : Inlines = transform path with
| { url = f; title = t } -> [ <a href=f>t ': ']
in
let npath = path @ [ { url = url_of_name name; title = title } ] in
let npath = path @ [ { url = (url_of_name name); title = title } ] in
let subpages = transform items with p & Page -> [ p ] in
let (next,last) = gen_page_seq (page, subpages, next, npath, sitemap) in
let next = match next with [] -> []
......@@ -307,7 +318,10 @@ match page with
[ (box_title (b,r . title)) ]
| <meta>c -> [ (meta (content c)) ]
in
let main = match (navig @ main @ navig) with
let notes = match !footnotes with
| [] -> []
| n -> [ (meta n) ] in
let main = match (navig @ main @ notes @ navig) with
| [] -> raise "Empty page !"
| x -> x in
......@@ -347,7 +361,7 @@ text-align:center; color: #aa0000; font: bold 200% helvetica" >
' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
!(print_xml html) ] in
let fn = "www/" @ name @ ".html" in
let [] = dump_to_file fn txt in
dump_to_file fn txt;
last
......@@ -370,3 +384,4 @@ match load_include input with
| [ Page & p ] -> let _ = gen_page ([],p,[], [], compute_sitemap p) in []
| _ -> raise ("Invalid input document " @ input)
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