Commit 010510bc authored by Pietro Abate's avatar Pietro Abate

[r2005-03-29 00:27:16 by beppe] Now uses full xsl:fo specification

Original author: beppe
Date: 2005-03-29 00:27:16+00:00
parent f9973129
This source diff could not be displayed because it is too large. You can view the blob instead.
(** Input types **)
type Page = <page name=Latin1 url=?String new=?"" leftbar=?("true"|"false")>[<title>String <banner>[InlineText*]? Item* ]
type Item =
<box ({| title=String; link=String; short=?String |} | {| |})>Content
| <meta>Content
| <left>Content
| <footnotes>[]
| Page
type Author = <author presenter=?("yes"|"no")>String
type Paper =
<paper file=?String old=?"">[
<title>String Author+ <comment>[InlineText*] <abstract>Content ]
type Slides =
<slides file=String>[ <title>String Author+ <comment>[InlineText*] ]
type Link =
<link url=String title=String>[ InlineText* ]
type Table=
<table {|border=?String; style=?String|}>[Col* Tr*]
type Col = <col width=?String>[]
type Tr =
<tr>[(Td|Th)*]
type Td =
<td>[InlineText*]
type Th =
<th>[InlineText*]
type Content =
[ ( <p {|style=?String|}>[InlineText*]
| <ul {||}>[<li {||}>Content *]
| <ol {|style=?String|}>[<li {||}>Content *]
| <br>[]
| <section title=String>Content
| <sample highlight=?"true"|"false">String
| <xmlsample highlight=?"true"|"false">String
| <sessionsample highlight=?"true"|"false">String
| Paper | Slides | Link
| <boxes-toc short=?"" sections=?"">[]
| <pages-toc sections=?"">[]
| <site-toc>[]
| <local-links href=String>[]
| <two-columns>[ <left>Content <right>Content ]
| <note title=?String> Content
| <footnotes>[]
| <demo label=?String prefix=?String>String
| InlineText
| Table
)* ]
type InlineText =
Char
| <(`b|`i|`tt|`em) {| style=?String |}>[InlineText*]
| <code>String
| <local href=String>String
| <a href=?String ; name=?String >[InlineText*]
| <footnote>[InlineText*]
|<br>[]
include "../../web/siteTypes.cd";;
include "typeFO.cd";;
include "fo_dtd.cd";;
(*include "typeFO.cd";;*)
(** Command line **)
......@@ -53,9 +54,12 @@ let highlight (String -> [ (Char| inline)* ] )
<fo:block font-size="8pt">"(*)"]
<fo:list-item-body start-indent="body-start()">[
<fo:block font-size="8pt">[!(text t)]]]]]]]
let content (t : Content) : [(block|basic-link|Char|inline|list-block|footnote|table)*] =
transform t with
| <section title=title1>c -> [<fo:block space-before="5pt">[<fo:block space-after="4pt" font-size="14pt" font-weight="bold">[title1] !(content c) ]]
| <section title=title1>c
-> [<fo:block space-before="5pt">[
<fo:block space-after="4pt" font-size="14pt" font-weight="bold">[!title1] !(content c) ]]
|((<sessionsample >s) | <sessionsample highlight="false">s)
-> [<fo:block font-family="Courier"
font-size="10pt"
......@@ -100,28 +104,42 @@ let highlight (String -> [ (Char| inline)* ] )
text-align="left"
space-after="10pt">[!(highlight s)]]
| <p>x -> [<fo:block space-after="15pt">[!(text x)]]
| <table ..> [ (col:: H.col)* (rows::H.tr)*] -> [
| <table ..> [ (col:: H.col)* (rows::H.tr)+] -> [
<fo:table space-after="15pt" table-layout="fixed" inline-progression-dimension\.maximum="95%">[
!(map col with <col ..>[] -> <fo:table-column width="proportional-column-width(1)">[])
<fo:table-body>( transform rows with
<tr ..> y -> [<fo:table-row>( transform y with
| <th ..> (z&Content) -> [<fo:table-cell padding="6pt" background-color="silver" border="0.5pt solid black">[ <fo:block font-weight="bold">[!(content z) ]]]
| <td style=['background:' ;c] ..> (z&Content) -> [<fo:table-cell padding="3pt" background-color=c border="0.5pt solid black" text-align="left">[ <fo:block>[!(content z) ]]]
| <td ..> (z&Content) -> [<fo:table-cell padding="3pt" border="0.5pt solid black" text-align="left">[ <fo:block>[!(content z) ]]]
| <th ..> (z&Content)
-> [<fo:table-cell
padding="6pt"
background-color="silver"
border="0.5pt solid black">[ <fo:block font-weight="bold">[!(content z) ]]]
| <td style=['background:' ;c] ..> (z&Content)
-> [<fo:table-cell
padding="3pt"
background-color=c
border="0.5pt solid black"
text-align="left">[ <fo:block>[!(content z) ]]]
| <td ..> (z&Content)
-> [<fo:table-cell
padding="3pt"
border="0.5pt solid black"
text-align="left">[ <fo:block>[!(content z) ]]]
| _ -> [<fo:table-cell>[<fo:block>[]]] (* fake entry to assure that it will have type table-cell+*)
)])
]](*]*)
| <ul>u ->[ <fo:list-block provisional-distance-between-starts="18pt"
]]
| <ul ..>u ->[ <fo:list-block provisional-distance-between-starts="18pt"
provisional-label-separation="3pt">( transform u with
<li>c -> [<fo:list-item>[
<li ..>c -> [<fo:list-item>[
<fo:list-item-label text-align="center" end-indent="label-end()">[
<fo:block font-size="18pt">"\x2022;"]
<fo:list-item-body start-indent="body-start()">[
<fo:block>[ !(content c) ]]]])]
| <ol>o -> [ <fo:list-block provisional-distance-between-starts="18pt"
| <ol ..>o -> [ <fo:list-block provisional-distance-between-starts="18pt"
provisional-label-separation="3pt">(
let i = ref Int 0 in
transform o with
<li>c -> [<fo:list-item>[
<li ..>c -> [<fo:list-item>[
<fo:list-item-label text-align="right" end-indent="label-end()">[
<fo:block>(string_of(i:=!i+1 ; !i)@".")]
<fo:list-item-body start-indent="body-start()">[
......@@ -140,7 +158,7 @@ let highlight (String -> [ (Char| inline)* ] )
margin-left="35pt"
margin-right="35pt"
space-after="10pt">[(<fo:inline font-weight="bold">"Note: ") !(content s)]]
| <two-columns>[ <left>x <right>y ] ->
| <two-columns>[ <left>x <right>y ] ->
[<fo:table
space-after="15pt"
table-layout="fixed"
......@@ -149,8 +167,8 @@ let highlight (String -> [ (Char| inline)* ] )
<fo:table-column>[]
<fo:table-body>[
<fo:table-row>[
<fo:table-cell padding="3pt">(content x)
<fo:table-cell padding="3pt">(content y)]]]]
<fo:table-cell padding="3pt">[<fo:block>[!(content x)]]
<fo:table-cell padding="3pt">[<fo:block>[!(content y)]]]]]]
| <pages-toc ..>_ ->[<fo:block>['TODO PAGES TABLE OF CONTENTS']]
| <site-toc ..>_ -> [<fo:block>['TODO SITE TABLE OF CONTENTS']]
| <local-links ..>_ -> [<fo:block>['A FAIRE LOCAL LINKS']]
......@@ -178,7 +196,7 @@ let lireItem (it : [Item+]): [block*] =
| <box title=t link=x>c ->
[<fo:block id=x>[
<fo:block font-size="22pt"
space-before="15pt">[<fo:block space-after="7pt" font-weight="bold">[t]] !(content c)]]
space-before="15pt">[<fo:block space-after="7pt" font-weight="bold">[!t]] !(content c)]]
| <box>c -> [<fo:block>[!(content c)]]
| <meta>c -> (* non utilise pour manuel et tutoriel*)
[<fo:block>[!(content c)]]
......@@ -188,15 +206,20 @@ let lireItem (it : [Item+]): [block*] =
| <page name=x >[(<title>title1 (<banner>_)? litem::Item+)] ->
[<fo:block id=x break-before="page" text-align-last="justify">[
<fo:block text-align="left">[
<fo:block font-size="32pt" font-weight="bold" space-after="40pt" space-before="85pt" color="black" >[title1]
<fo:block font-size="32pt"
font-weight="bold"
space-after="40pt"
space-before="85pt"
color="black" >[!title1]
] !(lireItem litem)
]]
| _ -> raise "ERROR"
let gen_page (page : Page, cduce_version : Latin1) : [block*] =
let gen_page (page : Page, cduce_version : Latin1) : [block+] =
match page with
(* le cas sans item*)
<page ..>[(<title>_) (<banner>_)?] -> [<fo:block text-align="center" font-size="35pt" color="green" space-after="30pt">
["err"] ]
(raise "error") ]
(* la cas de base *)
|<page ..>[(<title>title1 (<banner>_)? litem::Item+)] ->(
......@@ -204,9 +227,9 @@ let gen_page (page : Page, cduce_version : Latin1) : [block*] =
[
<fo:block text-align="center" space-before="130pt">[
<fo:block font-size="35pt" font-weight="bold">"CDuce Programming Language"
<fo:block font-size="35pt" font-weight="bold" space-after="20pt">[title1]
<fo:block font-size="18pt" font-weight="bold">("Language Version "@cduce_version)
<fo:block font-size="35pt" font-weight="bold">"CDuce Programming Language"
<fo:block font-size="35pt" font-weight="bold" space-after="20pt">[!title1]
<fo:block font-size="18pt" font-weight="bold">("Language Version "@cduce_version)
]
!(lireItem litem)]
......
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