Commit 348b5a72 authored by Pietro Abate's avatar Pietro Abate

[r2005-03-28 21:41:36 by beppe] Upgraded code to version 0.3

Original author: beppe
Date: 2005-03-28 21:41:36+00:00
parent ac1775b2
# include ../../Makefile.distrib
JAVA_HOME=/usr/java/jre1.5.0
VERSION=0.3.2
CDUCE=/tmp/cduce-0.2.2/cduce
FOP=/tmp/fop-0.20.5/fop.sh
CDUCE=../cduce
FOP=fop-0.20.5/fop.sh
tutorial:
(cd ../../web && $(CDUCE) ../doc/fomanual/xml2fo.cd --arg tutorial.xml tutorial_fo.xml $(VERSION))
(cd ../../web && $(CDUCE) ../doc/fomanual/xml2fo.cd \
--arg tutorial.xml tutorial_fo.xml $(VERSION))
manual:
(cd ../../web && $(CDUCE) ../doc/fomanual/xml2fo.cd --arg manual.xml manual_fo.xml $(VERSION))
(cd ../../web && $(CDUCE) ../doc/fomanual/xml2fo.cd \
--arg manual.xml manual_fo.xml $(VERSION))
tutorial_pdf: tutorial
......@@ -18,5 +20,5 @@ tutorial_pdf: tutorial
manual_pdf: manual
$(FOP) manual_fo.xml manual.pdf
all: manual, tutorial
all: manual_pdf tutorial_pdf
(* This type has been automatically generated from DTD_XSLFO.dtd by dtd2cduce *)
namespace fo = "http://www.w3.org/1999/XSL/Format"
type declarations = <fo:declarations {|fo:color-profile=?String|}>[ Any* ];;
type declarations = <fo:declarations fo:color-profile=?String>[ Any* ];;
type block =
<fo:block {|
space-after=?String;
space-before=?String;
id=?String;
font-weight=?String;
text-align=?String;
text-align-last=?String;
font-size=?String;
font-family=?("Helvetica" | "TimesNewRoman" | "Courier");
font-style=?String ;
color=?String;
background-color=?String;
border-style=?String;
break-before=?("auto" | "column" | "page" | "even-page" | "odd-page" | "inherit");
<fo:block
space-after=?String
space-before=?String
id=?String
font-weight=?String
text-align=?String
text-align-last=?String
font-size=?String
font-family=?("Helvetica" | "TimesNewRoman" | "Courier")
font-style=?String
color=?String
background-color=?String
border-style=?String
break-before=?("auto" | "column" | "page" | "even-page" | "odd-page" | "inherit")
linefeed-treatment=?("preserve"|"ignore");
margin-bottom=?String;
margin-left=?String;
margin-right=?String;
padding-after=?String;
padding-before=?String;
padding-start=?String;
padding-end=?String;
white-space-collapse=?("false"|"true"|"inherit");
white-space-treatment=?("preserve"|"ignore")|}>[
margin-bottom=?String
margin-left=?String
margin-right=?String
padding-after=?String
padding-before=?String
padding-start=?String
padding-end=?String
white-space-collapse=?("false"|"true"|"inherit")
white-space-treatment=?("preserve"|"ignore")>[
Any* ];;
type inline = <fo:inline {|
text-decoration=?String;
baseline-shift=?String;
color=?String;
font-family=?String;
font-size=?String;
font-weight=?String;
font-style=?String|}>[Any*];;
type basic-link =<fo:basic-link {|
color=?String;
text-decoration=?String;
font-style=?String;
internal-destination=?String;
external-destination=?String|}>[Any*];;
type table = <fo:table>[Any*]
type inline = <fo:inline
text-decoration=?String
baseline-shift=?String
color=?String
font-family=?String
font-size=?String
font-weight=?String
font-style=?String>[Any*];;
type basic-link =<fo:basic-link
color=?String
text-decoration=?String
font-style=?String
internal-destination=?String
external-destination=?String>[Any*];;
type table = <fo:table ..>[Any*]
type list-block =
<fo:list-block {|
provisional-label-separation=?String;
space-after.optimum=?String ;
provisional-distance-between-starts=?String|}>[
<fo:list-block
provisional-label-separation=?String
space-after\.optimum=?String
provisional-distance-between-starts=?String>[
list-item* ];;
type list-item =
<fo:list-item space-after=?String>[
<fo:list-item-label
text-align=?("start" | "center" | "end" | "justify" | "inside" | "outside" | "left" | "right" | "inherit");
text-align=?("start" | "center" | "end" | "justify" | "inside" | "outside" | "left" | "right" | "inherit")
end-indent=?String>[block*]
<fo:list-item-body start-indent=?String>[block*]];;
type flow = <fo:flow {|flow-name=String; font-size=String; text-align=?String|}>[ block* ];;
type static-content = <fo:static-content>[ block* ];;
type footnote = <fo:footnote>[inline footnote-body];;
type footnote-body = <fo:footnote-body>[(list-block | block | footnote)*];;
type flow = <fo:flow flow-name=String font-size=String text-align=?String>[ block* ];;
type static-content = <fo:static-content flow-name=?String >[ block* ];;
type footnote = <fo:footnote text-indent=?String>[inline footnote-body];;
type footnote-body = <fo:footnote-body >[(list-block | block | footnote)*];;
type page-sequence =
<fo:page-sequence {|master-reference=String|}>[ ( static-content? flow?) ];;
<fo:page-sequence master-reference=String>[ ( static-content? flow?) ];;
type repeatable-page-master-alternatives =
<fo:repeatable-page-master-alternatives {|conditional-page-master-reference=?String|}>[
<fo:repeatable-page-master-alternatives conditional-page-master-reference=?String>[
Any* ];;
type page-sequence-master =
<fo:page-sequence-master {|repeatable-page-master-reference=?String; single-page-master-reference=?String|}>[
<fo:page-sequence-master repeatable-page-master-reference=?String single-page-master-reference=?String>[
repeatable-page-master-alternatives ];;
type region-body=
<fo:region-body {|margin-top=?String; margin-bottom=?String; margin-left=?String; margin-right=?String|}>[Any*];;
<fo:region-body margin-top=?String margin-bottom=?String margin-left=?String margin-right=?String>[Any*];;
type simple-page-master =
<fo:simple-page-master {|master-name=String; page-height=String; page-width=String; region-end=?String; region-after=?String; region-start=?String; region-body=?String; fo:region-before=?String|}>[
<fo:simple-page-master master-name=String page-height=String page-width=String region-end=?String region-after=?String region-start=?String region-body=?String fo:region-before=?String>[
(region-body Any*) ];;
type layout-master-set =
<fo:layout-master-set {||}>[
<fo:layout-master-set >[
(simple-page-master page-sequence-master?) ];;
type root =
<fo:root {|font-size=?String|}>[
<fo:root font-size=?String>[
(layout-master-set declarations? page-sequence) ];;
include "inputType.cd";;
include "../../web/siteTypes.cd";;
include "typeFO.cd";;
(** Command line **)
......@@ -10,7 +10,7 @@ let highlight (String -> [ (Char| inline)* ] )
| [ '{{%%' h ::(Char *?) '%%}}' ; rest ] ->
[<fo:inline color="red" font-weight="bold" font-style="italic"> h; highlight rest]
| [ '{{' h ::(Char *?) '}}' ; rest ] ->
[<fo:inline color="red" font-weight="bold"> h; highlight rest] h @ highlight rest
[<fo:inline color="red" font-weight="bold"> h; highlight rest]
| [ '$$%%' h ::(Char *?) '%%$$' ; rest ] ->
[<fo:inline color="darkblue" font-weight="bold" font-style="italic"> h; highlight rest]
| [ '$$' h ::(Char *?) '$$' ; rest ] ->
......@@ -28,24 +28,26 @@ let highlight (String -> [ (Char| inline)* ] )
|<em>s2 -> [<fo:inline font-style="italic">[!(text s2)]]
| z & Char -> [z]
| <code>x -> [<fo:inline color="darkgreen" font-weight="bold" font-family="Courier">[ !(highlight x)] ]
| <local href=x>s2 ->[ <fo:basic-link color="blue" text-decoration="underline"
| <local href=x>(s2&[InlineText*])
->[ <fo:basic-link color="blue" text-decoration="underline"
internal-destination=x>[!(text s2)]]
| <a href=['#' ;x]>s2 (* if it starts by # is an internal reference *)
| <a href=['#' ;x]>(s2&[InlineText*]) (* if it starts by # is an internal reference *)
->[ <fo:basic-link color="blue"
text-decoration="underline"
internal-destination=x>[!(text s2)]]
| <a href=x>s2 (* otherwise it is an external reference *)
| <a href=x ..>(s2&[InlineText*]) (* otherwise it is an external reference *)
->[ <fo:basic-link color="red"
text-decoration="underline"
font-style="italic"
external-destination=x>[!(text s2)]]
|<footnote>t -> [
|<footnote ..>t -> [
<fo:footnote text-indent="0pt">[
<fo:inline baseline-shift="super" font-size="8pt">"(*)"
<fo:footnote-body>[
<fo:list-block provisional-label-separation="0pt"
<fo:list-block
provisional-label-separation="0pt"
provisional-distance-between-starts="18pt"
space-after.optimum="6pt">[
space-after\.optimum="6pt">[
<fo:list-item>[
<fo:list-item-label end-indent="label-end()">[
<fo:block font-size="8pt">"(*)"]
......@@ -98,14 +100,14 @@ let highlight (String -> [ (Char| inline)* ] )
text-align="left"
space-after="10pt">[!(highlight s)]]
| <p>x -> [<fo:block space-after="15pt">[!(text x)]]
| <table> [ (col:: Col)* (rows::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)">[])
| <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 -> [<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 -> [<fo:table-cell padding="3pt" background-color=c border="0.5pt solid black" text-align="left">[ <fo:block>[!(content z) ]]]
| <td> z -> [<fo:table-cell padding="3pt" border="0.5pt solid black" text-align="left">[ <fo:block>[!(content z) ]]]
<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) ]]]
)])
]](*]*)
| <ul>u ->[ <fo:list-block provisional-distance-between-starts="18pt"
......@@ -118,11 +120,10 @@ let highlight (String -> [ (Char| inline)* ] )
| <ol>o -> [ <fo:list-block provisional-distance-between-starts="18pt"
provisional-label-separation="3pt">(
let i = ref Int 0 in
i := !i + 1 ;
transform o with
<li>c -> [<fo:list-item>[
<fo:list-item-label end-indent="label-end()">[
<fo:block>(string_of(i)@".")]
<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()">[
<fo:block>[ !(content c) ]]]])]
| p & Paper -> (paper p)
......@@ -139,23 +140,23 @@ let highlight (String -> [ (Char| inline)* ] )
margin-left="35pt"
margin-right="35pt"
space-after="10pt">[(<fo:inline font-weight="bold">"Note: ") !(content s)]]
| <pages-toc>_ ->[<fo:block>['A FAIRE PAGES TOC']]
| <site-toc>_ -> [<fo:block>['A FAIRE SITE TOC']]
| <local-links>_ -> [<fo:block>['A FAIRE LOCAL LINKS']]
| <two-columns>[ <left>x <right>y ] ->
[<fo:table
space-after="15pt"
table-layout="fixed"
inline-progression-dimension.maximum="125%">[
inline-progression-dimension\.maximum="125%">[
<fo:table-column>[]
<fo:table-column>[]
<fo:table-body>[
<fo:table-row>[
<fo:table-cell padding="3pt">(content x)
<fo:table-cell padding="3pt">(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']]
| <footnotes>_ -> [<fo:block>['A FAIRE FOOTNOTE']]
| <demo>_ -> [<fo:block>['A FAIRE DEMO LABEL']]
| <boxes-toc>_ -> []
| <demo ..>_ -> [<fo:block>['A FAIRE DEMO LABEL']]
| <boxes-toc ..>_ -> []
let paper (p : Paper) : [block*] =
......@@ -171,36 +172,34 @@ let highlight (String -> [ (Char| inline)* ] )
_ -> [<fo:block>['A FAIRE SLIDE']]
let ma (it : [Item]) : block =
match it with
| [<box title=t link=x>c] -> <fo:block id=x>[<fo:block font-size="22pt" space-before="15pt">[<fo:block (*text-decoration="underline" color="blue"*) 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)]
| [<left>_] -> <fo:block>[]
| [<footnotes>[]] -> <fo:block>[ ]
| [<page name=_ > [(<title>_) (<banner>_)? ]] -> <fo:block>['box vide!!!!!!!!!!!!!']
| [<page name=x >[(<title>title1 (<banner>_)? litem::Item+)]] ->
<fo:block id=x break-before="page" text-align-last="justify">[
let lireItem (it : [Item+]): [block*] =
transform it with
| <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)]]
| <box>c -> [<fo:block>[!(content c)]]
| <meta>c -> (* non utilise pour manuel et tutoriel*)
[<fo:block>[!(content c)]]
| <left>_ -> [<fo:block>[]]
| <footnotes>[] -> [<fo:block>[ ]]
| <page .. > [(<title>_) (<banner>_)? ] -> [<fo:block>['box vide!!!!!!!!!!!!!']]
| <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]
] !(lireItem litem)
]
(*lireItem lit une sequence de bloc et applique*)
(*la fonction "ma" sur chaque item*)
let lireItem ([Item+] -> [block*])
|[it::Item]-> [(ma it)]
| [it::Item ; it2 ] -> [(ma it)] @ (lireItem it2)
]]
let gen_page (page : Page, cduce_version : Latin1) : [block*] =
match page with
(* le cas sans item*)
<page name=_>[(<title>_) (<banner>_)?] -> [<fo:block text-align="center" font-size="35pt" color="green" space-after="30pt">
<page ..>[(<title>_) (<banner>_)?] -> [<fo:block text-align="center" font-size="35pt" color="green" space-after="30pt">
["err"] ]
(* la cas de base *)
|<page name=_ >[(<title>title1 (<banner>_)? litem::Item+)] ->(
|<page ..>[(<title>title1 (<banner>_)? litem::Item+)] ->(
let sortie : [block+]=
[
......
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