Commit 1043de08 authored by gerd's avatar gerd

Updates


git-svn-id: https://godirepo.camlcity.org/svn/app-presentation/trunk@5 50e5f3cf-a9f2-0310-83d8-d11ec64cb5ab
parent cc867c57
(* $Id: main.ml,v 1.3 2002/02/08 14:47:27 gerd Exp $
(* $Id: main.ml,v 1.4 2002/02/14 16:46:33 gerd Exp $
* ----------------------------------------------------------------------
*
*)
......@@ -64,7 +64,7 @@ let main() =
exit 1
| Some s -> s
in
(* run *) (convert_to_html fn !no_gifs) !remove
run (convert_to_html fn !no_gifs) !remove
;;
main();;
......@@ -73,6 +73,9 @@ main();;
* History:
*
* $Log: main.ml,v $
* Revision 1.4 2002/02/14 16:46:33 gerd
* Updates
*
* Revision 1.3 2002/02/08 14:47:27 gerd
* Change: The XML tree is now encoded as UTF-8 strings.
* Improvement: Pages that are not included in the hierarchy
......
<!-- $Id: presentation.dtd,v 1.2 2001/04/26 20:47:47 gerd Exp $ -->
<!-- $Id: presentation.dtd,v 1.3 2002/02/14 16:46:33 gerd Exp $ -->
<!ENTITY % p.like "p|ul|picture">
<!ENTITY % text "br|code|c|em|footnote|a|numref|nameref">
<!ENTITY % text "br|code|c|em|footnote|a|numref|nameref|html">
<!ENTITY % layout "layout|headline-layout">
<!ELEMENT presentation ((%layout;)*,hierarchy,page+)>
......@@ -115,8 +115,14 @@
src CDATA #REQUIRED
id ID #IMPLIED
caption CDATA #REQUIRED
map CDATA #IMPLIED
>
<!-- Layout customizable: SRC, ANCHOR, CAPTION, NUMBER -->
<!-- Layout customizable: SRC, ANCHOR, CAPTION, NUMBER, MAP -->
<!-- The attribute map is the name of a file containing a client-side
image map. The file consists of lines with three columns, separated
by space: idref shape coords. The generated <MAP><AREA>...</MAP>
sequence is appended to the generated picture.
-->
<!ELEMENT a (#PCDATA)*>
......@@ -147,3 +153,5 @@
For pictures: The caption of the picture.
-->
<!ELEMENT html (#PCDATA)*>
<!-- Includes the text as it is -->
(* $Id: to_html.ml,v 1.4 2002/02/08 14:47:27 gerd Exp $
(* $Id: to_html.ml,v 1.5 2002/02/14 16:46:33 gerd Exp $
* ----------------------------------------------------------------------
*
*)
......@@ -373,6 +373,16 @@ class only_data =
;;
class html =
object (self)
inherit shared
method to_html store idx =
self # node # data
end
;;
class no_markup =
object (self)
inherit shared
......@@ -911,17 +921,60 @@ class picture =
n + 1
method to_html store idx =
let rec transform_map f =
try
let line = input_line f in
let fields = Pcre.split line in
match fields with
[] -> transform_map f
| [ idref; shape; coords ] ->
let page =
try idx # find idref
with
Not_found ->
failwith ("Cannot find object with ID: " ^ idref)
in
let href =
escape_html (store # url (page # extension # url_of_object))
in
let alt =
escape_html (page # extension # toc_title_of_object) in
let s =
Printf.sprintf "<AREA HREF=\"%s\" ALT=\"%s\" SHAPE=\"%s\" COORDS=\"%s\">\n"
href alt shape coords in
s ^ transform_map f
| _ ->
failwith ("Bad line in mapfile: " ^ line)
with
End_of_file ->
""
in
let src = self # node # required_string_attribute "src" in
let caption = self # node # required_string_attribute "caption" in
let map = self # node # optional_string_attribute "map" in
let text =
store # instantiate_layout "picture"
[ "SRC", lazy src;
"ANCHOR", lazy ("pic" ^ string_of_int picture_nr);
"CAPTION", lazy caption;
"NUMBER", lazy (string_of_int picture_nr);
"MAP", lazy ("#map" ^ string_of_int picture_nr);
]
in
text
let mapdef =
match map with
None -> ""
| Some mapfile ->
let f = open_in mapfile in
let s = transform_map f in
close_in f;
"<MAP NAME=\"map" ^ string_of_int picture_nr ^ "\">" ^ s ^
"</MAP>\n"
in
text ^ mapdef
end
;;
......@@ -1056,6 +1109,7 @@ let tag_map =
"a", (new element_impl (new a));
"numref", (new element_impl (new numref));
"nameref", (new element_impl (new nameref));
"html", (new element_impl (new html));
]
()
;;
......@@ -1065,6 +1119,9 @@ let tag_map =
* History:
*
* $Log: to_html.ml,v $
* Revision 1.5 2002/02/14 16:46:33 gerd
* Updates
*
* Revision 1.4 2002/02/08 14:47:27 gerd
* Change: The XML tree is now encoded as UTF-8 strings.
* Improvement: Pages that are not included in the hierarchy
......
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