Commit 5ce81b35 authored by gerd's avatar gerd

@PREVLINK@, @NEXTLINK@


git-svn-id: https://godirepo.camlcity.org/svn/app-presentation/trunk@10 50e5f3cf-a9f2-0310-83d8-d11ec64cb5ab
parent 414a6128
(* $Id: to_html.ml,v 1.7 2003/03/23 21:11:06 gerd Exp $
(* $Id: to_html.ml,v 1.8 2003/03/30 20:25:40 gerd Exp $
* ----------------------------------------------------------------------
*
*)
......@@ -114,6 +114,13 @@ and store_type =
;;
type find_id =
Not_in_tree
| Next_node
| Found of string
;;
class store remove_this_url_prefix =
object (self)
......@@ -131,6 +138,7 @@ class store remove_this_url_prefix =
val mutable next_pic_number = 1
val mutable hier = ( None : page_hierarchy option )
val mutable hier_list = ( [] : string list )
val mutable remove_url_prefix = (remove_this_url_prefix : string)
......@@ -153,13 +161,48 @@ class store remove_this_url_prefix =
s
method set_hierarchy h =
hier <- Some h
let rec flatten h =
h.pageid :: (List.flatten (List.map flatten h.children))
in
hier <- Some h;
hier_list <- flatten h;
method hierarchy =
match hier with
None -> failwith "hierarchy"
| Some h -> h
method prev_id id =
let rec find prev l =
match l with
[] ->
None
| x :: l' ->
if x = id then
prev
else
find (Some x) l'
in
find None hier_list
method next_id id =
let rec find l =
match l with
[] ->
None
| [x] ->
None
| x :: y :: l' ->
if x = id then
Some y
else
find (y :: l')
in
find hier_list
method alloc_footnote n =
let number = next_footnote_number in
next_footnote_number <- number+1;
......@@ -704,12 +747,46 @@ class page =
]
end else ""
in
let prev_link() =
match store # prev_id id with
None -> ""
| Some prev_id ->
( try
let prev_page = idx # find prev_id in
"<LINK REL=\"Prev\" HREF=\"" ^
escape_html (prev_page # extension # url_of_object) ^
"\" TITLE=\"" ^
escape_html (prev_page # extension # toc_title_of_object) ^
"\">"
with
Not_found -> ""
)
in
let next_link() =
match store # next_id id with
None -> ""
| Some next_id ->
( try
let next_page = idx # find next_id in
"<LINK REL=\"Next\" HREF=\"" ^
escape_html (next_page # extension # url_of_object) ^
"\" TITLE=\"" ^
escape_html (next_page # extension # toc_title_of_object) ^
"\">"
with
Not_found -> ""
)
in
let page_text =
store # instantiate_layout "page"
[ "TITLE", lazy (escape_html title);
"UPURL", lazy (escape_html (store # url hier_parent.pagelink));
"UPTITLE", lazy (escape_html hier_parent.title);
"PREVLINK", lazy (prev_link());
"NEXTLINK", lazy (next_link());
"LEVEL", lazy (levels());
"RELATED", lazy (related());
"FOOTER", lazy (footer());
......@@ -1134,6 +1211,9 @@ let tag_map =
* History:
*
* $Log: to_html.ml,v $
* Revision 1.8 2003/03/30 20:25:40 gerd
* @PREVLINK@, @NEXTLINK@
*
* Revision 1.7 2003/03/23 21:11:06 gerd
* Anti-SPAM: Escaping characters @ and :
*
......
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