Commit 70756c94 authored by gerd's avatar gerd

Added a number of variables to "page" layout.


git-svn-id: https://godirepo.camlcity.org/svn/app-presentation/trunk@18 50e5f3cf-a9f2-0310-83d8-d11ec64cb5ab
parent c8d455a3
......@@ -25,6 +25,7 @@ presentation.bin.opt:
.PHONY: clean
clean:
rm -f *.cmi *.cmo *.cma *.cmx *.o *.a *.cmxa
rm -f dtd.ml
.PHONY: CLEAN
CLEAN: clean
......
......@@ -151,7 +151,9 @@ Hashtbl.add std_layout_decls "footnote.text" "<a name=\"@TEXTANCHOR@\" href=\"#@
Hashtbl.add std_layout_decls "footnote.foot" "<dt><a name=\"@FOOTANCHOR@\" href=\"#@TEXTANCHOR\">[@SYMBOL@]</a></dt><dd>@CHILDREN@</dd>";
(* The following decls are for backward compatibility: *)
Hashtbl.add std_layout_decls "navigator.start" "@SUBLEVELS@";
Hashtbl.add std_layout_decls "navigator.onpath" "@navigator.level@"
Hashtbl.add std_layout_decls "navigator.onpath" "@navigator.level@";
Hashtbl.add std_layout_decls "navigator.topurl" "";
Hashtbl.add std_layout_decls "navigator.toptitle" "";
;;
......@@ -207,6 +209,12 @@ class store remove_this_url_prefix =
None -> failwith "hierarchy"
| Some h -> h
method first_id =
List.hd hier_list
method last_id =
List.hd (List.rev hier_list)
method prev_id id =
let rec find prev l =
match l with
......@@ -853,45 +861,87 @@ class page =
end else ""
in
let prev_link() =
let prev_url, prev_title =
match store # prev_id id with
None -> ""
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) ^
"\">"
(prev_page # extension # url_of_object,
prev_page # extension # toc_title_of_object)
with
Not_found -> ""
)
Not_found -> ("", "")
) in
let prev_link =
if prev_url <> "" then
"<LINK REL=\"Prev\" HREF=\"" ^
escape_html prev_url ^
"\" TITLE=\"" ^
escape_html prev_title ^
"\">"
else ""
in
let next_link() =
let next_url, next_title =
match store # next_id id with
None -> ""
None -> ("", "")
| Some next_id ->
( try
( 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 -> ""
)
(next_page # extension # url_of_object,
next_page # extension # toc_title_of_object)
with
Not_found -> ("", "")
) in
let next_link =
if next_url <> "" then
"<LINK REL=\"Next\" HREF=\"" ^
escape_html next_url ^
"\" TITLE=\"" ^
escape_html next_title ^
"\">"
else ""
in
let first_url, first_title =
match store # first_id with
| first_id ->
( try
let first_page = idx # find first_id in
(first_page # extension # url_of_object,
first_page # extension # toc_title_of_object)
with
Not_found -> ("", "")
) in
let last_url, last_title =
match store # last_id with
| last_id ->
( try
let last_page = idx # find last_id in
(last_page # extension # url_of_object,
last_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 parent_page.pagelink));
"UPTITLE", lazy (escape_html parent_page.title);
"PREVLINK", lazy (prev_link());
"NEXTLINK", lazy (next_link());
"PREVLINK", lazy (prev_link);
"PREVURL", lazy (prev_url);
"PREVTITLE",lazy (prev_title);
"NEXTLINK", lazy (next_link);
"NEXTURL", lazy (next_url);
"NEXTTITLE",lazy (next_title);
"FIRSTURL", lazy (first_url);
"FIRSTTITLE", lazy (first_title);
"LASTURL", lazy (last_url);
"LASTTITLE", lazy (last_title);
"LEVEL", lazy (levels());
"NAVIGATION", lazy (levels());
"RELATED", lazy (related());
......
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