.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "HTML::LinkList 3pm" .TH HTML::LinkList 3pm "2016-01-16" "perl v5.22.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" HTML::LinkList \- Create a 'smart' list of HTML links. .SH "VERSION" .IX Header "VERSION" version 0.1701 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use HTML::LinkList qw(link_list); \& \& # default formatting \& my $html_links = link_list(current_url=>$url, \& urls=>\e@links_in_order, \& labels=>\e%labels, \& descriptions=>\e%desc); \& \& # paragraph with \*(Aq :: \*(Aq separators \& my $html_links = link_list(current_url=>$url, \& urls=>\e@links_in_order, \& labels=>\e%labels, \& descriptions=>\e%desc, \& links_head=>\*(Aq

\*(Aq, \& links_foot=>\*(Aq

\*(Aq, \& pre_item=>\*(Aq\*(Aq, \& post_item=>\*(Aq\*(Aq \& pre_active_item=>\*(Aq\*(Aq, \& post_active_item=>\*(Aq\*(Aq, \& item_sep=>" :: "); \& \& # multi\-level list \& my $html_links = link_tree( \& current_url=>$url, \& link_tree=>\e@list_of_lists, \& labels=>\e%labels, \& descriptions=>\e%desc); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module contains a number of functions for taking sets of URLs and labels and creating suitably formatted \s-1HTML. \s0 These links are \*(L"smart\*(R" because, if given the url of the current page, if any of the links in the list equal it, that item in the list will be formatted as a special label, not as a link; this is a Good Thing, since the user would be confused by clicking on a link back to the current page. .PP While many website systems have plugins for \*(L"smart\*(R" navbars, they are specialized for that system only, and can't be reused elsewhere, forcing people to reinvent the wheel. I hereby present one wheel, free to be reused by anybody; just the simple functions, a backend, which can be plugged into whatever system you want. .PP The default format for the \s-1HTML\s0 is to make an unordered list, but there are many options, enabling one to have a flatter layout with any separators you desire, or a more complicated list with differing formats for different levels. .PP The \*(L"link_list\*(R" function uses a simple list of links \*(-- good for a simple navbar. .PP The \*(L"link_tree\*(R" function takes a set of nested links and makes the \s-1HTML\s0 for them \*(-- good for making a table of contents, or a more complicated navbar. .PP The \*(L"full_tree\*(R" function takes a list of paths and makes a full tree of all the pages and index-pages in those paths \*(-- good for making a site map. .PP The \*(L"breadcrumb_trail\*(R" function takes a url and makes a \*(L"breadcrumb trail\*(R" from it. .PP The \*(L"nav_tree\*(R" function creates a set of nested links to be used as a multi-level navbar; one can give it a list of paths (as for full_tree) and it will only show the links related to the current \s-1URL.\s0 .SH "FUNCTIONS" .IX Header "FUNCTIONS" To export a function, add it to the 'use' call. .PP .Vb 1 \& use HTML::LinkList qw(link_list); .Ve .PP To export all functions do: .PP .Vb 1 \& use HTML::LinkList \*(Aq:all\*(Aq; .Ve .SS "link_list" .IX Subsection "link_list" .Vb 10 \& $links = link_list( \& current_url=>$url, \& urls=>\e@links_in_order, \& labels=>\e%labels, \& descriptions=>\e%desc, \& pre_desc=>\*(Aq \*(Aq, \& post_desc=>\*(Aq\*(Aq, \& links_head=>\*(Aq\*(Aq, \& pre_item=>\*(Aq
  • \*(Aq, \& post_item=>\*(Aq
  • \*(Aq \& pre_active_item=>\*(Aq\*(Aq, \& post_active_item=>\*(Aq\*(Aq, \& item_sep=>"\en"); .Ve .PP Generates a simple list of links, from list of urls (and optional labels) taking into account of the \*(L"current\*(R" \s-1URL.\s0 .PP This provides a large number of options to customize the appearance of the list. The default setup is for a simple \s-1UL\s0 list, but setting the options can enable you to make it something other than a list altogether, or add in \s-1CSS\s0 styles or classes to make it look just like you want. .PP Required: .IP "urls" 4 .IX Item "urls" The urls in the order you want them displayed. If this list is empty, then nothing will be generated. .PP Options: .IP "current_url" 4 .IX Item "current_url" The link to the current page. If one of the links equals this, then that is deemed to be the \*(L"active\*(R" link and is just displayed as a label rather than a link. .IP "descriptions" 4 .IX Item "descriptions" Optional hash of descriptions, to put next to the links. The keys of this hash are the urls. .IP "hide_ext" 4 .IX Item "hide_ext" If a site is hiding link extensions (such as using MultiViews with Apache) you may wish to hide the extensions (while using the full URLs to check various things). (default: 0 (false)) .IP "item_sep" 4 .IX Item "item_sep" String to put between items. .IP "labels" 4 .IX Item "labels" A hash whose keys are links and whose values are labels. These are the labels for the links; if no label is given, then the last part of the link is used for the label, with some formatting. .IP "links_head" 4 .IX Item "links_head" String to begin the list with. .IP "links_foot" 4 .IX Item "links_foot" String to end the list with. .IP "pre_desc" 4 .IX Item "pre_desc" String to prepend to each description. .IP "post_desc" 4 .IX Item "post_desc" String to append to each description. .IP "pre_item" 4 .IX Item "pre_item" String to prepend to each item. .IP "post_item" 4 .IX Item "post_item" String to append to each item. .IP "pre_active_item" 4 .IX Item "pre_active_item" An additional string to put in front of each \*(L"active\*(R" item, after pre_item. The \*(L"active\*(R" item is the link which matches 'current_url'. .IP "pre_item_active" 4 .IX Item "pre_item_active" \&\s-1INSTEAD\s0 of the \*(L"pre_item\*(R" string, use this string for active items .IP "post_active_item" 4 .IX Item "post_active_item" An additional string to append to each active item, before post_item. .IP "prefix_url" 4 .IX Item "prefix_url" A prefix to prepend to all the links. (default: empty string) .SS "link_tree" .IX Subsection "link_tree" .Vb 10 \& $links = link_tree( \& current_url=>$url, \& link_tree=>\e@list_of_lists, \& labels=>\e%labels, \& descriptions=>\e%desc, \& pre_desc=>\*(Aq \*(Aq, \& post_desc=>\*(Aq\*(Aq, \& links_head=>\*(Aq\*(Aq, \& subtree_head=>\*(Aq\*(Aq, \& pre_item=>\*(Aq
  • \*(Aq, \& post_item=>\*(Aq
  • \*(Aq \& pre_active_item=>\*(Aq\*(Aq, \& post_active_item=>\*(Aq\*(Aq, \& item_sep=>"\en", \& tree_sep=>"\en", \& formats=>\e%formats); .Ve .PP Generates nested lists of links from a list of lists of links. This is useful for things such as table-of-contents or site maps. .PP By default, this will return \s-1UL\s0 lists, but this is highly configurable. .PP Required: .IP "link_tree" 4 .IX Item "link_tree" A list of lists of urls, in the order you want them displayed. If a url is not in this list, it will not be displayed. .PP Options: .IP "current_url" 4 .IX Item "current_url" The link to the current page. If one of the links equals this, then that is deemed to be the \*(L"active\*(R" link and is just displayed as a label rather than a link. .IP "descriptions" 4 .IX Item "descriptions" Optional hash of descriptions, to put next to the links. The keys of this hash are the urls. .IP "exclude_root_parent" 4 .IX Item "exclude_root_parent" If this is true, then the \*(L"current_parent\*(R" display options are not used for the \*(L"root\*(R" (\*(L"/\*(R") path, it isn't counted as a \*(L"parent\*(R" of the current_url. .IP "formats" 4 .IX Item "formats" A reference to a hash containing advanced format settings. For example: .Sp .Vb 10 \& my %formats = ( \& # level 1 and onwards \& \*(Aq1\*(Aq => { \& tree_head=>"
      ", \& tree_foot=>"
    \en", \& }, \& # level 2 and onwards \& \*(Aq2\*(Aq => { \& tree_head=>"\en", \& }, \& # level 3 and onwards \& \*(Aq3\*(Aq => { \& pre_item=>\*(Aq(\*(Aq, \& post_item=>\*(Aq)\*(Aq, \& item_sep=>",\en", \& tree_sep=>\*(Aq \-> \*(Aq, \& tree_head=>"
    \en", \& tree_foot=>"", \& } \& ); .Ve .Sp The formats hash enables you to control the formatting on a per-level basis. Each key of the hash corresponds to a level-number; the sub-hashes contain format arguments which will apply from that level onwards. If an argument isn't given in the sub-hash, then it will fall back to the previous level (or to the default, if there is no setting for that format-argument for a previous level). .Sp The only difference between the names of the arguments in the sub-hash and in the global format arguments is that instead of 'subtree_head' and subtree_foot' it uses 'tree_head' and 'tree_foot'. .IP "hide_ext" 4 .IX Item "hide_ext" If a site is hiding link extensions (such as using MultiViews with Apache) you may wish to hide the extensions (while using the full URLs to check various things). (default: 0 (false)) .IP "item_sep" 4 .IX Item "item_sep" The string to separate each item. .IP "labels" 4 .IX Item "labels" A hash whose keys are links and whose values are labels. These are the labels for the links; if no label is given, then the last part of the link is used for the label, with some formatting. .IP "links_head" 4 .IX Item "links_head" The string to prepend the top-level tree with. (default: ) .IP "pre_desc" 4 .IX Item "pre_desc" String to prepend to each description. .IP "post_desc" 4 .IX Item "post_desc" String to append to each description. .IP "pre_item" 4 .IX Item "pre_item" String to prepend to each item. (default:
  • ) .IP "post_item" 4 .IX Item "post_item" String to append to each item. (default:
  • ) .IP "pre_active_item" 4 .IX Item "pre_active_item" An additional string to put in front of each \*(L"active\*(R" item, after pre_item. The \*(L"active\*(R" item is the link which matches 'current_url'. (default: ) .IP "pre_item_active" 4 .IX Item "pre_item_active" \&\s-1INSTEAD\s0 of the \*(L"pre_item\*(R" string, use this string for active items .IP "post_active_item" 4 .IX Item "post_active_item" An additional string to append to each active item, before post_item. (default: ) .IP "pre_current_parent" 4 .IX Item "pre_current_parent" An additional string to put in front of a link which is a parent of the 'current_url' link, after pre_item. .IP "pre_item_current_parent" 4 .IX Item "pre_item_current_parent" \&\s-1INSTEAD\s0 of the \*(L"pre_item\*(R" string, use this for links which are parents of the 'current_url' link. .IP "post_current_parent" 4 .IX Item "post_current_parent" An additional string to append to a link which is a parent of the 'current_url' link, before post_item. .IP "prefix_url" 4 .IX Item "prefix_url" A prefix to prepend to all the links. (default: empty string) .IP "subtree_head" 4 .IX Item "subtree_head" The string to prepend to lower-level trees. (default: ) .IP "tree_sep" 4 .IX Item "tree_sep" The string to separate each tree. .SS "full_tree" .IX Subsection "full_tree" .Vb 10 \& $links = full_tree( \& paths=>\e@list_of_paths, \& labels=>\e%labels, \& descriptions=>\e%desc, \& hide=>$hide_regex, \& nohide=>$nohide_regex, \& start_depth=>0, \& end_depth=>0, \& top_level=>0, \& preserve_order=>0, \& preserve_paths=>0, \& ... \& ); .Ve .PP Given a set of paths this will generate a tree of links in the style of \&\fIlink_tree\fR. This will figure out all the intermediate paths and construct the nested structure for you, clustering parents and children together. .PP The formatting options are as for \*(L"link_tree\*(R". .PP Required: .IP "paths" 4 .IX Item "paths" A reference to a list of paths: that is, URLs relative to the top of the site. .Sp For example, if the full \s-1URL\s0 is http://www.example.com/foo.html then the path is /foo.html .Sp If the full \s-1URL\s0 is http://www.example.com/~frednurk/foo.html then the path is /foo.html .Sp This does not require that every possible path be given; all the intermediate paths will be figured out from the list. .PP Options: .IP "append_list" 4 .IX Item "append_list" Array of paths to append to the top-level links. They are used as-is, and are not part of the processing done to the \*(L"paths\*(R" list of paths. (see \*(L"prepend_list\*(R") .IP "descriptions" 4 .IX Item "descriptions" Optional hash of descriptions, to put next to the links. The keys of this hash are the paths. .IP "end_depth" 4 .IX Item "end_depth" End your tree at this depth. If zero, then go all the way. (see \*(L"start_depth\*(R") .IP "exclude_root_parent" 4 .IX Item "exclude_root_parent" If this is true, then the \*(L"current_parent\*(R" display options are not used for the \*(L"root\*(R" (\*(L"/\*(R") path, it isn't counted as a \*(L"parent\*(R" of the current_url. .IP "hide" 4 .IX Item "hide" If the path matches this string, don't include it in the tree. .IP "hide_ext" 4 .IX Item "hide_ext" If a site is hiding link extensions (such as using MultiViews with Apache) you may wish to hide the extensions (while using the full URLs to check various things). (default: 0 (false)) .IP "labels" 4 .IX Item "labels" Hash containing replacement labels for one or more paths. If no label is given for '/' (the root path) then 'Home' will be used. .IP "last_subtree_head" 4 .IX Item "last_subtree_head" The string to prepend to the last lower-level tree. Only used if end_depth is not zero. .IP "last_subtree_foot" 4 .IX Item "last_subtree_foot" The string to append to the last lower-level tree. Only used if end_depth is not zero. .IP "nohide" 4 .IX Item "nohide" If the path matches this string, it will be included even if it matches the 'hide' string. .IP "prefix_url" 4 .IX Item "prefix_url" A prefix to prepend to all the links. (default: empty string) .IP "prepend_list" 4 .IX Item "prepend_list" Array of paths to prepend to the top-level links. They are used as-is, and are not part of the processing done to the \*(L"paths\*(R" list of paths. .IP "preserve_order" 4 .IX Item "preserve_order" Preserve the ordering of the paths in the input list of paths; otherwise the links will be sorted alphabetically. Note that if preserve_order is true, the structure is at the whims of the order of the original list of paths, and so could end up odd-looking. (default: false) .IP "preserve_paths" 4 .IX Item "preserve_paths" Do not extract intermediate paths or reorder the input list of paths. This speeds things up, but assumes that the input paths are complete and in good order. (default: false) .IP "start_depth" 4 .IX Item "start_depth" Start your tree at this depth. Zero is the root, level 1 is the files/sub\-folders in the root, and so on. (default: 0) .IP "top_level" 4 .IX Item "top_level" Decide which level is the \*(L"top\*(R" level. Useful when you set the start_depth to something greater than 1. .SS "breadcrumb_trail" .IX Subsection "breadcrumb_trail" .Vb 10 \& $links = breadcrumb_trail( \& current_url=>$url, \& labels=>\e%labels, \& descriptions=>\e%desc, \& links_head=>\*(Aq

    \*(Aq, \& links_foot=>"\en

    ", \& subtree_head=>\*(Aq\*(Aq, \& subtree_foot=>"\en", \& pre_item=>\*(Aq\*(Aq, \& post_item=>\*(Aq\*(Aq, \& pre_active_item=>\*(Aq\*(Aq, \& post_active_item=>\*(Aq\*(Aq, \& item_sep=>"\en", \& tree_sep=>\*(Aq > \*(Aq, \& ... \& ); .Ve .PP Given the current url, make a breadcrumb trail from it. By default, this is laid out with '>' separators, but it can be set up to give a nested set of \s-1UL\s0 lists (as for \*(L"full_tree\*(R"). .PP The formatting options are as for \*(L"link_tree\*(R". .PP Required: .IP "current_url" 4 .IX Item "current_url" The current url to be made into a breadcrumb-trail. .PP Options: .IP "descriptions" 4 .IX Item "descriptions" Optional hash of descriptions, to put next to the links. The keys of this hash are the urls. .IP "exclude_root_parent" 4 .IX Item "exclude_root_parent" If this is true, then the \*(L"current_parent\*(R" display options are not used for the \*(L"root\*(R" (\*(L"/\*(R") path, it isn't counted as a \*(L"parent\*(R" of the current_url. .IP "hide_ext" 4 .IX Item "hide_ext" If a site is hiding link extensions (such as using MultiViews with Apache) you may wish to hide the extensions (while using the full URLs to check various things). (default: 0 (false)) .IP "labels" 4 .IX Item "labels" Hash containing replacement labels for one or more \s-1URLS.\s0 If no label is given for '/' (the root path) then 'Home' will be used. .SS "nav_tree" .IX Subsection "nav_tree" .Vb 10 \& $links = nav_tree( \& paths=>\e@list_of_paths, \& labels=>\e%labels, \& current_url=>$url, \& hide=>$hide_regex, \& nohide=>$nohide_regex, \& preserve_order=>1, \& descriptions=>\e%desc, \& ... \& ); .Ve .PP This takes a list of links, and the current \s-1URL,\s0 and makes a nested navigation tree, consisting of (a) the top-level links (b) the links leading to the current \s-1URL \s0(c) the links on the same level as the current \s-1URL, \&\s0(d) the related links just above this level, depending on whether this is an index-page or a content page. .PP Optionally one can hide links which match match the 'hide' option. .PP The formatting options are as for \*(L"link_tree\*(R", with some additions. .PP Required: .IP "current_url" 4 .IX Item "current_url" The link to the current page. If one of the links equals this, then that is deemed to be the \*(L"active\*(R" link and is just displayed as a label rather than a link. This is also used to determine which links to show and which ones to filter out. .IP "paths" 4 .IX Item "paths" A reference to a list of paths: that is, URLs relative to the top of the site. .Sp For example, if the full \s-1URL\s0 is http://www.example.com/foo.html then the path is /foo.html .Sp This does not require that every possible path be given; all the intermediate paths will be figured out from the list. .PP Options: .IP "append_list" 4 .IX Item "append_list" Array of paths to append to the top-level links. They are used as-is, and are not part of the processing done to the \*(L"paths\*(R" list of paths. (see \*(L"prepend_list\*(R") .IP "descriptions" 4 .IX Item "descriptions" Optional hash of descriptions, to put next to the links. The keys of this hash are the paths. .IP "end_depth" 4 .IX Item "end_depth" End your tree at this depth. If zero, then go all the way. By default this is set to the depth of the current_url. .IP "exclude_root_parent" 4 .IX Item "exclude_root_parent" If this is true, then the \*(L"current_parent\*(R" display options are not used for the \*(L"root\*(R" (\*(L"/\*(R") path, it isn't counted as a \*(L"parent\*(R" of the current_url. .IP "hide" 4 .IX Item "hide" If a path matches this string, don't include it in the tree. .IP "hide_ext" 4 .IX Item "hide_ext" If a site is hiding link extensions (such as using MultiViews with Apache) you may wish to hide the extensions (while using the full URLs to check various things). (default: 0 (false)) .IP "labels" 4 .IX Item "labels" Hash containing replacement labels for one or more paths. If no label is given for '/' (the root path) then 'Home' will be used. .IP "last_subtree_head" 4 .IX Item "last_subtree_head" The string to prepend to the last lower-level tree. .IP "last_subtree_foot" 4 .IX Item "last_subtree_foot" The string to append to the last lower-level tree. .IP "nohide" 4 .IX Item "nohide" If the path matches this string, it will be included even if it matches the 'hide' string. .IP "prefix_url" 4 .IX Item "prefix_url" A prefix to prepend to all the links. (default: empty string) .IP "prepend_list" 4 .IX Item "prepend_list" Array of paths to prepend to the top-level links. They are used as-is, and are not part of the processing done to the \*(L"paths\*(R" list of paths. .IP "preserve_order" 4 .IX Item "preserve_order" Preserve the ordering of the paths in the input list of paths; otherwise the links will be sorted alphabetically. (default: true) .IP "preserve_paths" 4 .IX Item "preserve_paths" Do not extract intermediate paths or reorder the input list of paths. This speeds things up, but assumes that the input paths are complete and in good order. (default: false) .IP "start_depth" 4 .IX Item "start_depth" Start your tree at this depth. Zero is the root, level 1 is the files/sub\-folders in the root, and so on. (default: 1) .IP "top_level" 4 .IX Item "top_level" Decide which level is the \*(L"top\*(R" level. Useful when you set the start_depth to something greater than 1. .SH "Private Functions" .IX Header "Private Functions" These functions cannot be exported. .SS "make_item" .IX Subsection "make_item" \&\f(CW$item\fR = make_item( this_label=>$label, this_link=>$link, hide_ext=>0, current_url=>$url, current_parents=>\e%current_parents, descriptions=>\e%desc, format=>\e%format, ); .PP \&\f(CW%format\fR = ( pre_desc=>' ', post_desc=>'', pre_item=>'
  • ', post_item=>'
  • ' pre_active_item=>'', post_active_item=>'', pre_current_parent=>'', post_current_parent=>'', item_sep=>\*(L"\en\*(R"); ); .PP Format a link item. .PP See \*(L"link_list\*(R" for the formatting options. .IP "this_label" 4 .IX Item "this_label" The label of the required link. If there is no label, this uses the base-name of the last part of the link, capitalizing it and replacing underscores and dashes with spaces. .IP "this_link" 4 .IX Item "this_link" The \s-1URL\s0 of the required link. .IP "current_url" 4 .IX Item "current_url" The link to the current page. If one of the links equals this, then that is deemed to be the \*(L"active\*(R" link and is just displayed as a label rather than a link. .IP "current_parents" 4 .IX Item "current_parents" URLs of the parents of the current item. .IP "descriptions" 4 .IX Item "descriptions" Optional hash of descriptions, to put next to the links. The keys of this hash are the links (not the labels). .IP "defer_post_item" 4 .IX Item "defer_post_item" Don't add the 'post_item' string if this is true. (needed for nested lists) (default: false) .IP "no_link" 4 .IX Item "no_link" Don't make a link for this, just a label. .SS "make_canonical" .IX Subsection "make_canonical" my \f(CW$new_url\fR = make_canonical($url); .PP Make a \s-1URL\s0 canonical; remove the 'index.*' and add on a needed \&'/' \*(-- this assumes that directory names never have a '.' in them. .SS "get_index_path" .IX Subsection "get_index_path" my \f(CW$new_url\fR = get_index_path($url); .PP Get the \*(L"index\*(R" part of this path. That is, if this path is not for an index-page, then get the parent index-page path for this path. (Removes the trailing slash). .SS "get_index_parent" .IX Subsection "get_index_parent" my \f(CW$new_url\fR = get_index_parent($url); .PP Get the parent of the \*(L"index\*(R" part of this path. (Removes the trailing slash). .SS "path_depth" .IX Subsection "path_depth" my \f(CW$depth\fR = path_depth($url); .PP Calculate the \*(L"depth\*(R" of the given path. .SS "link_is_active" .IX Subsection "link_is_active" .Vb 2 \& if (link_is_active(this_link=>$link, current_url=>$url)) \& ... .Ve .PP Check if the given link is \*(L"active\*(R", that is, if it matches the 'current_url'. .SS "traverse_lol" .IX Subsection "traverse_lol" \&\f(CW$links\fR = traverse_lol(\e@list_of_lists, labels=>\e%labels, tree_depth=>$depth current_format=>\e%format, ... ); .PP Traverse the list of lists (of urls) to produce a nested collection of links. .PP This consumes the list_of_lists! .SS "extract_all_paths" .IX Subsection "extract_all_paths" my \f(CW@all_paths\fR = extract_all_paths(paths=>\e@paths, preserve_order=>0); .PP Extract all possible paths out of a list of paths. Thus, if one has .PP /foo/bar/baz.html .PP then that would make .PP / /foo/ /foo/bar/ /foo/bar/baz.html .PP If 'preserve_order' is true, this preserves the ordering of the paths in the input list; otherwise the output paths are sorted alphabetically. .SS "extract_current_parents" .IX Subsection "extract_current_parents" .Vb 2 \& my %current_parents = extract_current_parents(current_url=>$url, \& exclude_root_parent=>0); .Ve .PP Extract the \*(L"parent\*(R" paths of the current url .PP /foo/bar/baz.html .PP then that would make .PP / /foo/ /foo/bar/ .PP If 'exclude_root_parent' is true, then the '/' is excluded from the list of parents. .SS "build_lol" .IX Subsection "build_lol" .Vb 5 \& my @lol = build_lol( \& paths=>\e@paths, \& current_url=>$url, \& navbar_type=>\*(Aq\*(Aq, \& ); .Ve .PP Build a list of lists of paths, given a simple list of paths. Assumes that this list has already been filtered. .IP "paths" 4 .IX Item "paths" Reference to list of paths; this is consumed. .SS "filter_out_paths" .IX Subsection "filter_out_paths" .Vb 10 \& my @filtered_paths = filter_out_paths( \& paths=>\e@paths, \& current_url=>$url, \& hide=>$hide, \& nohide=>$nohide, \& start_depth=>$start_depth, \& end_depth=>$end_depth, \& top_level=>$top_level, \& navbar_type=>\*(Aq\*(Aq, \& ); .Ve .PP Filter out the paths we don't want from our list of paths. Returns a list of the paths we want. .SS "make_default_format" .IX Subsection "make_default_format" .Vb 1 \& my %default_format = make_default_format(%args); .Ve .PP Make the default format hash from the args. Returns a hash of format options. .SS "make_extra_formats" .IX Subsection "make_extra_formats" .Vb 1 \& my %formats = make_extra_formats(%args); .Ve .PP Transforms the subtree_head and subtree_foot into the \*(L"formats\*(R" method of formatting. Returns a hash of hashes of format options. .SH "REQUIRES" .IX Header "REQUIRES" .Vb 1 \& Test::More .Ve .SH "INSTALLATION" .IX Header "INSTALLATION" To install this module, run the following commands: .PP .Vb 4 \& perl Build.PL \& ./Build \& ./Build test \& ./Build install .Ve .PP Or, if you're on a platform (like \s-1DOS\s0 or Windows) that doesn't like the \&\*(L"./\*(R" notation, you can do this: .PP .Vb 4 \& perl Build.PL \& perl Build \& perl Build test \& perl Build install .Ve .PP In order to install somewhere other than the default, such as in a directory under your home directory, like \*(L"/home/fred/perl\*(R" go .PP .Vb 1 \& perl Build.PL \-\-install_base /home/fred/perl .Ve .PP as the first step instead. .PP This will install the files underneath /home/fred/perl. .PP You will then need to make sure that you alter the \s-1PERL5LIB\s0 variable to find the modules. .PP Therefore you will need to change the \s-1PERL5LIB\s0 variable to add /home/fred/perl/lib .PP .Vb 1 \& PERL5LIB=/home/fred/perl/lib:${PERL5LIB} .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIperl\fR\|(1). .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests to the author. .SH "AUTHOR" .IX Header "AUTHOR" .Vb 3 \& Kathryn Andersen (RUBYKAT) \& perlkat AT katspace dot com \& http://www.katspace.com/tools/html_linklist/ .Ve .SH "COPYRIGHT AND LICENCE" .IX Header "COPYRIGHT AND LICENCE" Copyright (c) 2006 by Kathryn Andersen .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.