HTML-Widgets-NavMenu-1.1000 000755 000764 000764 0 14247414065 15616 5 ustar 00shlomif shlomif 000000 000000 TODO 100644 000764 000764 2355 14247414065 16374 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000 Short-Term:
-----------
* Make sure H::W::NM will associate the breadcrumbs trail with a category,
if this category expands there. So, for example:
http://www.shlomifish.org/philosophy/case-for-file-swapping/
will generate the breadcrumbs trail of:
Shlomi Fish -> Philosophy.
* Create a 'show' directive - like 'show_always' only with a predicate.
Long-Term:
----------
* Add a way to manage sub-menu objects, where a navigation menu can refer
to a sub-navigation menu.
- Perhaps it should be done by simply adding a reference to the tree?
* Make the module support URLs with CGI GET parameters properly.
* Add support for more attributes other than class="" to the ul and li
tags.
- like id=""
* Add a host-based regexp arbitrator to the predicate:
{ 'host_re' => { 't2' => "^home/", 'vipe' => "^home2/" } }
* In HTML::Widgets::NavMenu::Tree::Node - make sure url_type accepts only
its enum values.
* Give an option to render a sub-set of the navigation-menu, starting
at a certain coords/url-path.
* Release on CPAN as version 0.8.0.
- change the version in $VERSION.
- document the changes in Changes.
- update the readme.
* Maybe make a way to implement a generic backend to the data using various
kinds of databases/etc.
README 100644 000764 000764 501 14247414065 16533 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000 This archive contains the distribution HTML-Widgets-NavMenu,
version 1.1000:
A Perl Module for Generating HTML Navigation Menus
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
This README file was generated by Dist::Zilla::Plugin::Readme v6.024.
Changes 100644 000764 000764 13354 14247414065 17220 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000 Revision history for Perl extension HTML::Widgets::NavMenu.
1.1000 2022-06-06
- Convert packages to lib/**.pm files.
1.0902 2022-05-20
- Fix for up arrow/nav-link.
1.0901 2022-05-20
- Fix for up arrow/nav-link.
1.0900 2021-04-25
- Add the experimental coords_stop option.
- false by default.
1.0801 2020-07-03
- Fix and re-enable the PerlCritic test on tidyall.
1.0800 2020-07-03
- Speed up some hot spots / bottlenecks.
- "A Lisp programmer knows the value of everything and the cost
of nothing"
- https://www.shlomifish.org/humour/fortunes/show.cgi?id=linus-torvalds-about-indirections
- lib/HTML/Widgets/NavMenu/EscapeHtml.pm switched escape_html() to @EXPORT_OK
- Minor back compat break.
- Cleanups including explicit imports , and perlcritic.
1.0704 2019-03-11
- Convert to dzil.
- Try to fix broken provides (e.g:
https://metacpan.org/search?q=HTML%3A%3AWidgets%3A%3ANavMenu%3A%3AObject )
1.0703 2015-06-10
- Fix broken links to the examples' version control repositories.
- Thanks to Anne for inspiring it.
1.0702 2013-05-21
- Add t/cpan-changes.t
- Correct this file.
- Add scripts/bump-version-number.pl .
1.0701 2012-12-09
- Fix typo: https://rt.cpan.org/Ticket/Display.html?id=81840
- Thanks to GUIMARD and lintian.
1.0700 2012-12-09
- Add the li_id attribute to the tree's nodes to add an id="..." attribute
to the
tags.
1.0603 2012-09-18
- Update the URLs to the repository, and sites.
1.0602 2012-09-17
- Get rid of trailing space.
- Update the contact details.
1.0601 2012-09-05
- Moved away tag-release.pl to scripts/tag-release.pl so it won't
be installed by default.
- Moved away output.pl under examples.
1.0600 2011-04-16
- Add HTML::Widgets::NavMenu::JQueryTreeView for generating navigation
menu that this jQuery plugin can handle well:
- http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
1.0501 2010-11-14
- Now generating the Makefile.PL from the Build.PL using
create_makefile_pl (less error-prone).
1.0500 2010-11-12
- Convert from Class::Accessor to Class::XSAccessor for extra speed.
- Add the tag-release.pl file.
1.0400 2009-12-09
- Got rid of the dependency on Error.pm.
- moved the HTML/ directory with the test scripts-support code from
the root of the distribution to unde t/lib .
1.0302 2009-06-25
- Fixed some broken links and other inaccuracies in the POD of
lib/HTML/Widgets/NavMenu.pm .
1.0301 2009-06-23
- Changed the 'license' in Build.PL from "bsd" to the more accurate
"mit".
- Added keywords and links to the META.yml.
1.0300 2009-06-14
- Refactoring: Made HTML::Widgets::NavMenu::Object a sub-class of
Class::Accessor to remove many "use base" calls to it.
- In progress - converting a flat %args hash (splatted into the @_)
into a single $args hash-ref.
- Removed a use lib "." from HTML::Widgets::NavMenu - it's a leftover
statement that could be a subtle bug.
- Refactoring: converted direct $self->{'field'} accesses to
accessors. (from all the classes).
- Fixed a bug with the HeaderRole where an empty
was created.
1.0201 2008-03-28
- Fixed a case where a non-capturing expand in a node inside a
capturing expand caused the upper node to be non-capturing too.
1.0200 2008-03-23
- Removed trailing whitespace from "# TEST" lines - this can confuse
early versions of Test-Count
- Fixed a "# TEST" instead of a "# TESTbr" line that confused Test-Count.
- Added the no_leading_dot option with a test.
1.0100 2008-02-08
- Fixed a bug in HTML::Widgets::NavMenu::Url:
relative URL from a non-dir to a dir. It accidently had an
extraneous "../".
- Fixed the _get_leading_path_of_coords function in HTML::Widgets::NavMenu
to properly generate the topmost item of the breadcrumbs trail, which
should be in coords = [0] and not coord = []. The latter is meaningless
and ignored. This caused a subtle bug in combining the breadcrumbs
trails of my homesite.
- it became apparent when the URL of the [0] item was not empty.
- Added the 'capt' key to the 'expand' => keys for "capturing" regex.
1.0001 2006-09-11
- Added "use strict" and "use warnings" to all modules.
- Added a Test::Pod based test.
- Added a Test::Pod::Coverage test, and added POD to all modules.
- Some internal methods were prefixed with an underscore.
- Added the examples directory.
1.0000 2005-11-06
- Made sure that the breadcrumbs trail in expanded sections will
display the components of the expanded sections.
- Fixed the POD.
- Added the link to the article to the POD.
- Bumped the major version number to 1.x and kept some digits into the
future to make CPAN and CPAN.pm happy.
0.10.2 2005-08-24
(backdated - module was released on 17-August-2005)
- Added IO::Scalar to the Perl modules this module depends on. (it
is needed by the tests, but was not explicitly specified yet, because
it was believed to be part of the core distribution).
0.10.1 2005-07-25
- Fixed the building using "perl Makefile.PL" and "make".
0.10.0 2005-07-12
- Added tests and refactored the code to have a 100% test coverage.
0.8.0 2005-04-23
- get_cross_host_rel_url is now part of the API.
- Now returning nav_links_obj
- Added some tests
0.6.0 2005-03-24
- no longer making use of the CGI.pm module.
- extracted two methods in HTML::Widgets::NavMenu::Iterator::NavMenu
that can now be over-rided by the user.
0.4.0 2005-01-20
- Added the url_is_abs option to the nodes.
- Many code cleanups.
0.2.0 2005-01-02
- First non-developer CPAN Release.
COPYING 100644 000764 000764 2064 14247414065 16734 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000 This is the MIT/X11 license:
--------------
Copyright 2004 Shlomi Fish.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
LICENSE 100644 000764 000764 2206 14247414065 16704 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000 This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
The MIT License
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to
whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall
be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
dist.ini 100644 000764 000764 1503 14247414065 17342 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000 name = HTML-Widgets-NavMenu
author = Shlomi Fish
license = MIT
copyright_holder = Shlomi Fish
copyright_year = 2005
version = 1.1000
[@Filter]
-bundle = @SHLOMIF
dist = HTML-Widgets-NavMenu
github_name = perl-HTML-Widgets-NavMenu
homepage = http://web-cpan.shlomifish.org/modules/HTML-Widgets-NavMenu/
[Keywords]
keyword = arrows
keyword = bar
keyword = breadcrumbs
keyword = css
keyword = expand
keyword = hidden
keyword = html
keyword = menu
keyword = menus
keyword = nav-bar
keyword = navbar
keyword = navigation
keyword = navigation aids
keyword = nav-menu
keyword = navmenu
keyword = next
keyword = prev
keyword = previous
keyword = pure-perl
keyword = site-map
keyword = skipped
keyword = trail
keyword = tree
keyword = unexpand
keyword = up
keyword = widget
keyword = widgets
keyword = xhtml
[Test::TidyAll]
META.yml 100644 000764 000764 36212 14247414065 17174 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000 ---
abstract: 'A Perl Module for Generating HTML Navigation Menus'
author:
- 'Shlomi Fish '
build_requires:
File::Spec: '0'
IO::Handle: '0'
IO::Scalar: '0'
IPC::Open3: '0'
Module::Build: '0.28'
Test::More: '0.88'
lib: '0'
perl: '5.006'
configure_requires:
ExtUtils::MakeMaker: '0'
Module::Build: '0.28'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.024, CPAN::Meta::Converter version 2.150010'
keywords:
- arrows
- bar
- breadcrumbs
- css
- expand
- hidden
- html
- menu
- menus
- nav-bar
- navbar
- navigation
- navigation
- aids
- nav-menu
- navmenu
- next
- prev
- previous
- pure-perl
- site-map
- skipped
- trail
- tree
- unexpand
- up
- widget
- widgets
- xhtml
license: mit
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: HTML-Widgets-NavMenu
provides:
HTML::Widgets::NavMenu:
file: lib/HTML/Widgets/NavMenu.pm
version: '1.1000'
HTML::Widgets::NavMenu::Error:
file: lib/HTML/Widgets/NavMenu/Error.pm
version: '1.1000'
HTML::Widgets::NavMenu::Error::Redirect:
file: lib/HTML/Widgets/NavMenu/Error/Redirect.pm
version: '1.1000'
HTML::Widgets::NavMenu::EscapeHtml:
file: lib/HTML/Widgets/NavMenu/EscapeHtml.pm
version: '1.1000'
HTML::Widgets::NavMenu::ExpandVal:
file: lib/HTML/Widgets/NavMenu/ExpandVal.pm
version: '1.1000'
HTML::Widgets::NavMenu::HeaderRole:
file: lib/HTML/Widgets/NavMenu/HeaderRole.pm
version: '1.1000'
HTML::Widgets::NavMenu::Iterator::Base:
file: lib/HTML/Widgets/NavMenu/Iterator/Base.pm
version: '1.1000'
HTML::Widgets::NavMenu::Iterator::GetCurrentlyActive:
file: lib/HTML/Widgets/NavMenu/Iterator/GetCurrentlyActive.pm
version: '1.1000'
HTML::Widgets::NavMenu::Iterator::Html:
file: lib/HTML/Widgets/NavMenu/Iterator/Html.pm
version: '1.1000'
HTML::Widgets::NavMenu::Iterator::Html::Item:
file: lib/HTML/Widgets/NavMenu/Iterator/Html/Item.pm
version: '1.1000'
HTML::Widgets::NavMenu::Iterator::JQTreeView:
file: lib/HTML/Widgets/NavMenu/Iterator/JQTreeView.pm
version: '1.1000'
HTML::Widgets::NavMenu::Iterator::NavMenu:
file: lib/HTML/Widgets/NavMenu/Iterator/NavMenu.pm
version: '1.1000'
HTML::Widgets::NavMenu::Iterator::NavMenu::HeaderRole:
file: lib/HTML/Widgets/NavMenu/Iterator/NavMenu/HeaderRole.pm
version: '1.1000'
HTML::Widgets::NavMenu::Iterator::SiteMap:
file: lib/HTML/Widgets/NavMenu/Iterator/SiteMap.pm
version: '1.1000'
HTML::Widgets::NavMenu::JQueryTreeView:
file: lib/HTML/Widgets/NavMenu/JQueryTreeView.pm
version: '1.1000'
HTML::Widgets::NavMenu::LeadingPath::Component:
file: lib/HTML/Widgets/NavMenu/LeadingPath/Component.pm
version: '1.1000'
HTML::Widgets::NavMenu::NodeDescription:
file: lib/HTML/Widgets/NavMenu/NodeDescription.pm
version: '1.1000'
HTML::Widgets::NavMenu::Object:
file: lib/HTML/Widgets/NavMenu/Object.pm
version: '1.1000'
HTML::Widgets::NavMenu::Predicate:
file: lib/HTML/Widgets/NavMenu/Predicate.pm
version: '1.1000'
HTML::Widgets::NavMenu::TagGen:
file: lib/HTML/Widgets/NavMenu/TagGen.pm
version: '1.1000'
HTML::Widgets::NavMenu::Tree::Iterator:
file: lib/HTML/Widgets/NavMenu/Tree/Iterator.pm
version: '1.1000'
HTML::Widgets::NavMenu::Tree::Iterator::Item:
file: lib/HTML/Widgets/NavMenu/Tree/Iterator/Item.pm
version: '1.1000'
HTML::Widgets::NavMenu::Tree::Iterator::Stack:
file: lib/HTML/Widgets/NavMenu/Tree/Iterator/Stack.pm
version: '1.1000'
HTML::Widgets::NavMenu::Tree::Node:
file: lib/HTML/Widgets/NavMenu/Tree/Node.pm
version: '1.1000'
HTML::Widgets::NavMenu::Url:
file: lib/HTML/Widgets/NavMenu/Url.pm
version: '1.1000'
requires:
Class::XSAccessor: '0'
Exporter: '0'
parent: '0'
strict: '0'
vars: '0'
warnings: '0'
resources:
bugtracker: https://github.com/shlomif/perl-HTML-Widgets-NavMenu/issues
homepage: http://web-cpan.shlomifish.org/modules/HTML-Widgets-NavMenu/
repository: git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
version: '1.1000'
x_Dist_Zilla:
perl:
version: '5.034001'
plugins:
-
class: Dist::Zilla::Plugin::Prereqs
config:
Dist::Zilla::Plugin::Prereqs:
phase: test
type: requires
name: '@Filter/TestMoreDoneTesting'
version: '6.024'
-
class: Dist::Zilla::Plugin::AutoPrereqs
name: '@Filter/AutoPrereqs'
version: '6.024'
-
class: Dist::Zilla::Plugin::ExecDir
name: '@Filter/ExecDir'
version: '6.024'
-
class: Dist::Zilla::Plugin::GatherDir
config:
Dist::Zilla::Plugin::GatherDir:
exclude_filename: []
exclude_match: []
follow_symlinks: 0
include_dotfiles: 0
prefix: ''
prune_directory: []
root: .
name: '@Filter/GatherDir'
version: '6.024'
-
class: Dist::Zilla::Plugin::License
name: '@Filter/License'
version: '6.024'
-
class: Dist::Zilla::Plugin::ManifestSkip
name: '@Filter/ManifestSkip'
version: '6.024'
-
class: Dist::Zilla::Plugin::MetaYAML
name: '@Filter/MetaYAML'
version: '6.024'
-
class: Dist::Zilla::Plugin::PruneCruft
name: '@Filter/PruneCruft'
version: '6.024'
-
class: Dist::Zilla::Plugin::Readme
name: '@Filter/Readme'
version: '6.024'
-
class: Dist::Zilla::Plugin::RunExtraTests
config:
Dist::Zilla::Role::TestRunner:
default_jobs: 1
name: '@Filter/RunExtraTests'
version: '0.029'
-
class: Dist::Zilla::Plugin::ShareDir
name: '@Filter/ShareDir'
version: '6.024'
-
class: Dist::Zilla::Plugin::MakeMaker
config:
Dist::Zilla::Role::TestRunner:
default_jobs: 1
name: '@Filter/MakeMaker'
version: '6.024'
-
class: Dist::Zilla::Plugin::CheckChangesHasContent
name: '@Filter/CheckChangesHasContent'
version: '0.011'
-
class: Dist::Zilla::Plugin::ConfirmRelease
name: '@Filter/ConfirmRelease'
version: '6.024'
-
class: Dist::Zilla::Plugin::Manifest
name: '@Filter/Manifest'
version: '6.024'
-
class: Dist::Zilla::Plugin::MetaConfig
name: '@Filter/MetaConfig'
version: '6.024'
-
class: Dist::Zilla::Plugin::MetaJSON
name: '@Filter/MetaJSON'
version: '6.024'
-
class: Dist::Zilla::Plugin::MetaProvides::Package
config:
Dist::Zilla::Plugin::MetaProvides::Package:
finder_objects:
-
class: Dist::Zilla::Plugin::FinderCode
name: '@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM'
version: '6.024'
include_underscores: 0
Dist::Zilla::Role::MetaProvider::Provider:
$Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002004'
inherit_missing: '1'
inherit_version: '1'
meta_noindex: '1'
Dist::Zilla::Role::ModuleMetadata:
Module::Metadata: '1.000037'
version: '0.006'
name: '@Filter/MetaProvides::Package'
version: '2.004003'
-
class: Dist::Zilla::Plugin::MetaResources
name: '@Filter/MetaResources'
version: '6.024'
-
class: Dist::Zilla::Plugin::ModuleBuild
config:
Dist::Zilla::Role::TestRunner:
default_jobs: 1
name: '@Filter/ModuleBuild'
version: '6.024'
-
class: Dist::Zilla::Plugin::PkgVersion
name: '@Filter/PkgVersion'
version: '6.024'
-
class: Dist::Zilla::Plugin::PodCoverageTests
name: '@Filter/PodCoverageTests'
version: '6.024'
-
class: Dist::Zilla::Plugin::PodSyntaxTests
name: '@Filter/PodSyntaxTests'
version: '6.024'
-
class: Dist::Zilla::Plugin::Test::Compile
config:
Dist::Zilla::Plugin::Test::Compile:
bail_out_on_fail: '0'
fail_on_warning: author
fake_home: 0
filename: t/00-compile.t
module_finder:
- ':InstallModules'
needs_display: 0
phase: test
script_finder:
- ':PerlExecFiles'
skips: []
switch: []
name: '@Filter/Test::Compile'
version: '2.058'
-
class: Dist::Zilla::Plugin::Test::CPAN::Changes
config:
Dist::Zilla::Plugin::Test::CPAN::Changes:
changelog: Changes
name: '@Filter/Test::CPAN::Changes'
version: '0.012'
-
class: Dist::Zilla::Plugin::Test::EOL
config:
Dist::Zilla::Plugin::Test::EOL:
filename: xt/author/eol.t
finder:
- ':ExecFiles'
- ':InstallModules'
- ':TestFiles'
trailing_whitespace: 1
name: '@Filter/Test::EOL'
version: '0.19'
-
class: Dist::Zilla::Plugin::Test::NoTabs
config:
Dist::Zilla::Plugin::Test::NoTabs:
filename: xt/author/no-tabs.t
finder:
- ':InstallModules'
- ':ExecFiles'
- ':TestFiles'
name: '@Filter/Test::NoTabs'
version: '0.15'
-
class: Dist::Zilla::Plugin::Test::TrailingSpace
name: '@Filter/Test::TrailingSpace'
version: ~
-
class: Dist::Zilla::Plugin::TestRelease
name: '@Filter/TestRelease'
version: '6.024'
-
class: Dist::Zilla::Plugin::PodWeaver
config:
Dist::Zilla::Plugin::PodWeaver:
finder:
- ':InstallModules'
- ':ExecFiles'
plugins:
-
class: Pod::Weaver::Plugin::SingleEncoding
name: '@SHLOMIF/SingleEncoding'
version: '4.018'
-
class: Pod::Weaver::Plugin::WikiDoc
name: '@SHLOMIF/WikiDoc'
version: '0.093004'
-
class: Pod::Weaver::Plugin::EnsurePod5
name: '@CorePrep/EnsurePod5'
version: '4.018'
-
class: Pod::Weaver::Plugin::H1Nester
name: '@CorePrep/H1Nester'
version: '4.018'
-
class: Pod::Weaver::Section::Generic
name: '@SHLOMIF/Name'
version: '4.018'
-
class: Pod::Weaver::Section::Version
name: '@SHLOMIF/Version'
version: '4.018'
-
class: Pod::Weaver::Section::Region
name: '@SHLOMIF/Prelude'
version: '4.018'
-
class: Pod::Weaver::Section::Generic
name: '@SHLOMIF/Synopsis'
version: '4.018'
-
class: Pod::Weaver::Section::Generic
name: '@SHLOMIF/Description'
version: '4.018'
-
class: Pod::Weaver::Section::Generic
name: '@SHLOMIF/Usage'
version: '4.018'
-
class: Pod::Weaver::Section::Generic
name: '@SHLOMIF/Overview'
version: '4.018'
-
class: Pod::Weaver::Section::Generic
name: '@SHLOMIF/Stability'
version: '4.018'
-
class: Pod::Weaver::Section::Collect
name: Requirements
version: '4.018'
-
class: Pod::Weaver::Section::Collect
name: Attributes
version: '4.018'
-
class: Pod::Weaver::Section::Collect
name: Constructors
version: '4.018'
-
class: Pod::Weaver::Section::Collect
name: Methods
version: '4.018'
-
class: Pod::Weaver::Section::Collect
name: Functions
version: '4.018'
-
class: Pod::Weaver::Section::Leftovers
name: '@SHLOMIF/Leftovers'
version: '4.018'
-
class: Pod::Weaver::Section::Region
name: '@SHLOMIF/postlude'
version: '4.018'
-
class: Pod::Weaver::Section::Support
name: '@SHLOMIF/Support'
version: '1.013'
-
class: Pod::Weaver::Section::Authors
name: '@SHLOMIF/Authors'
version: '4.018'
-
class: Pod::Weaver::Section::Bugs
name: '@SHLOMIF/Bugs'
version: '4.018'
-
class: Pod::Weaver::Section::Contributors
name: '@SHLOMIF/Contributors'
version: '0.009'
-
class: Pod::Weaver::Section::Legal
name: '@SHLOMIF/Legal'
version: '4.018'
-
class: Pod::Weaver::Plugin::Transformer
name: '@SHLOMIF/List'
version: '4.018'
name: '@Filter/PodWeaver'
version: '4.009'
-
class: Dist::Zilla::Plugin::UploadToCPAN
name: '@Filter/UploadToCPAN'
version: '6.024'
-
class: Dist::Zilla::Plugin::Keywords
config:
Dist::Zilla::Plugin::Keywords:
keywords:
- arrows
- bar
- breadcrumbs
- css
- expand
- hidden
- html
- menu
- menus
- nav-bar
- navbar
- navigation
- navigation
- aids
- nav-menu
- navmenu
- next
- prev
- previous
- pure-perl
- site-map
- skipped
- trail
- tree
- unexpand
- up
- widget
- widgets
- xhtml
name: Keywords
version: '0.007'
-
class: Dist::Zilla::Plugin::Test::TidyAll
name: Test::TidyAll
version: '0.04'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':InstallModules'
version: '6.024'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':IncModules'
version: '6.024'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':TestFiles'
version: '6.024'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ExtraTestFiles'
version: '6.024'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ExecFiles'
version: '6.024'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':PerlExecFiles'
version: '6.024'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ShareFiles'
version: '6.024'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':MainModule'
version: '6.024'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':AllFiles'
version: '6.024'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':NoFiles'
version: '6.024'
-
class: Dist::Zilla::Plugin::FinderCode
name: '@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM'
version: '6.024'
zilla:
class: Dist::Zilla::Dist::Builder
config:
is_trial: '0'
version: '6.024'
x_generated_by_perl: v5.34.1
x_serialization_backend: 'YAML::Tiny version 1.73'
x_spdx_expression: MIT
MANIFEST 100644 000764 000764 4320 14247414065 17027 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.024.
Build.PL
COPYING
Changes
LICENSE
MANIFEST
MANIFEST.SKIP
META.json
META.yml
Makefile.PL
README
TODO
TODO-Rejects
dist.ini
examples/README
examples/article-examples/cgi-script/H-W-NM-serve.pl
examples/article-examples/complex/H-W-NM-complex.pl
examples/article-examples/fine-grained-site-flow/H-W-NM-fine-grained-site-flow.pl
examples/article-examples/simple/H-W-NM-simple.pl
examples/article-examples/with-embellishments/H-W-NM-embellish.pl
examples/output.pl
inc/Test/Run/Builder.pm
lib/HTML/Widgets/NavMenu.pm
lib/HTML/Widgets/NavMenu/Error.pm
lib/HTML/Widgets/NavMenu/Error/Redirect.pm
lib/HTML/Widgets/NavMenu/EscapeHtml.pm
lib/HTML/Widgets/NavMenu/ExpandVal.pm
lib/HTML/Widgets/NavMenu/HeaderRole.pm
lib/HTML/Widgets/NavMenu/Iterator/Base.pm
lib/HTML/Widgets/NavMenu/Iterator/GetCurrentlyActive.pm
lib/HTML/Widgets/NavMenu/Iterator/Html.pm
lib/HTML/Widgets/NavMenu/Iterator/Html/Item.pm
lib/HTML/Widgets/NavMenu/Iterator/JQTreeView.pm
lib/HTML/Widgets/NavMenu/Iterator/NavMenu.pm
lib/HTML/Widgets/NavMenu/Iterator/NavMenu/HeaderRole.pm
lib/HTML/Widgets/NavMenu/Iterator/SiteMap.pm
lib/HTML/Widgets/NavMenu/JQueryTreeView.pm
lib/HTML/Widgets/NavMenu/LeadingPath/Component.pm
lib/HTML/Widgets/NavMenu/NodeDescription.pm
lib/HTML/Widgets/NavMenu/Object.pm
lib/HTML/Widgets/NavMenu/Predicate.pm
lib/HTML/Widgets/NavMenu/TagGen.pm
lib/HTML/Widgets/NavMenu/Tree/Iterator.pm
lib/HTML/Widgets/NavMenu/Tree/Iterator/Item.pm
lib/HTML/Widgets/NavMenu/Tree/Iterator/Stack.pm
lib/HTML/Widgets/NavMenu/Tree/Node.pm
lib/HTML/Widgets/NavMenu/Url.pm
scripts/tag-release.pl
t/00-compile.t
t/00use.t
t/01unit.t
t/02site-map.t
t/03nav-links.t
t/04nav-menu.t
t/05stack.t
t/06tree-iter-item.t
t/07tree-iter.t
t/08tree-node.t
t/09leading-path.t
t/10ul-classes.t
t/11predicate.t
t/12x-host-rel-url.t
t/13escape-html.t
t/14tag-gen.t
t/15aspetersen-inherit.t
t/16redirect.t
t/17nav-coords-unit.t
t/18url.t
t/lib/HTML/Widgets/NavMenu/Test/Data.pm
t/lib/HTML/Widgets/NavMenu/Test/Stdout.pm
t/lib/HTML/Widgets/NavMenu/Test/Util.pm
weaver.ini
xt/author/eol.t
xt/author/no-tabs.t
xt/author/pod-coverage.t
xt/author/pod-syntax.t
xt/author/tidyall.t
xt/release/cpan-changes.t
xt/release/trailing-space.t
Build.PL 100644 000764 000764 2620 14247414065 17173 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000
# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v6.024.
use strict;
use warnings;
use Module::Build 0.28;
my %module_build_args = (
"build_requires" => {
"Module::Build" => "0.28"
},
"configure_requires" => {
"ExtUtils::MakeMaker" => 0,
"Module::Build" => "0.28"
},
"dist_abstract" => "A Perl Module for Generating HTML Navigation Menus",
"dist_author" => [
"Shlomi Fish "
],
"dist_name" => "HTML-Widgets-NavMenu",
"dist_version" => "1.1000",
"license" => "mit",
"module_name" => "HTML::Widgets::NavMenu",
"recursive_test_files" => 1,
"requires" => {
"Class::XSAccessor" => 0,
"Exporter" => 0,
"parent" => 0,
"strict" => 0,
"vars" => 0,
"warnings" => 0
},
"test_requires" => {
"File::Spec" => 0,
"IO::Handle" => 0,
"IO::Scalar" => 0,
"IPC::Open3" => 0,
"Test::More" => "0.88",
"lib" => 0,
"perl" => "5.006"
}
);
my %fallback_build_requires = (
"File::Spec" => 0,
"IO::Handle" => 0,
"IO::Scalar" => 0,
"IPC::Open3" => 0,
"Module::Build" => "0.28",
"Test::More" => "0.88",
"lib" => 0,
"perl" => "5.006"
);
unless ( eval { Module::Build->VERSION(0.4004) } ) {
delete $module_build_args{test_requires};
$module_build_args{build_requires} = \%fallback_build_requires;
}
my $build = Module::Build->new(%module_build_args);
$build->create_build_script;
t 000755 000764 000764 0 14247414065 16002 5 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000 00use.t 100644 000764 000764 170 14247414065 17241 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/t #!/usr/bin/perl -w
use strict;
use Test::More tests => 1;
BEGIN
{
# TEST
use_ok('HTML::Widgets::NavMenu');
}
18url.t 100644 000764 000764 3614 14247414065 17306 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/t #!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 6;
use HTML::Widgets::NavMenu::Url ();
{
my $from =
HTML::Widgets::NavMenu::Url->new( [qw(hello there wow.html)], 1, );
my $to = HTML::Widgets::NavMenu::Url->new( [qw(hello there wow.html)], 0, );
my $url;
eval { $url = $from->_get_relative_url($to); };
# TEST
like(
$@,
qr{^Two identical URLs},
"Checking that an exception was thrown."
);
}
{
my $from = HTML::Widgets::NavMenu::Url->new( [], 0, );
my $to = HTML::Widgets::NavMenu::Url->new( [], 0, );
my $url;
eval { $url = $from->_get_relative_url($to); };
# TEST
like( $@, qr{^Root URL}, "Checking that an exception was thrown." );
}
{
my $from = HTML::Widgets::NavMenu::Url->new( ["hello"], 1, "harddisk", );
my $to = HTML::Widgets::NavMenu::Url->new( ["good.html"], 0, );
# TEST
is( $from->_get_relative_url( $to, 1 ),
"../good.html", "Checking for harddisk URL from dir to file" );
}
{
my $from = HTML::Widgets::NavMenu::Url->new( ["hello"], 1, "harddisk", );
my $to = HTML::Widgets::NavMenu::Url->new( ["good"], 1, );
# TEST
is( $from->_get_relative_url( $to, 1 ),
"../good/index.html", "Checking for harddisk URL from dir to dir" );
}
{
my $from = HTML::Widgets::NavMenu::Url->new( ["hello"], 1, "harddisk", );
my $to = HTML::Widgets::NavMenu::Url->new( ["good"], 1, );
# TEST
is( $from->_get_relative_url( $to, 0 ),
"./good/index.html", "Checking for harddisk URL from dir to dir" );
}
{
my $from =
HTML::Widgets::NavMenu::Url->new(
[ "directory", "sub-dir", "good.html" ],
0, "server", );
my $to = HTML::Widgets::NavMenu::Url->new( ["directory"], 1, "server" );
# TEST
is( $from->_get_relative_url( $to, 1 ),
"../", "Checking for relative URL from a non-dir to a dir." );
}
META.json 100644 000764 000764 56324 14247414065 17352 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000 {
"abstract" : "A Perl Module for Generating HTML Navigation Menus",
"author" : [
"Shlomi Fish "
],
"dynamic_config" : 0,
"generated_by" : "Dist::Zilla version 6.024, CPAN::Meta::Converter version 2.150010",
"keywords" : [
"arrows",
"bar",
"breadcrumbs",
"css",
"expand",
"hidden",
"html",
"menu",
"menus",
"nav-bar",
"navbar",
"navigation",
"navigation",
"aids",
"nav-menu",
"navmenu",
"next",
"prev",
"previous",
"pure-perl",
"site-map",
"skipped",
"trail",
"tree",
"unexpand",
"up",
"widget",
"widgets",
"xhtml"
],
"license" : [
"mit"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : 2
},
"name" : "HTML-Widgets-NavMenu",
"prereqs" : {
"build" : {
"requires" : {
"Module::Build" : "0.28"
}
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0",
"Module::Build" : "0.28"
}
},
"develop" : {
"requires" : {
"Pod::Coverage::TrustPod" : "0",
"Test::CPAN::Changes" : "0.19",
"Test::Code::TidyAll" : "0.50",
"Test::EOL" : "0",
"Test::More" : "0.96",
"Test::NoTabs" : "0",
"Test::Pod" : "1.41",
"Test::Pod::Coverage" : "1.08",
"Test::TrailingSpace" : "0.0203"
}
},
"runtime" : {
"requires" : {
"Class::XSAccessor" : "0",
"Exporter" : "0",
"parent" : "0",
"strict" : "0",
"vars" : "0",
"warnings" : "0"
}
},
"test" : {
"requires" : {
"File::Spec" : "0",
"IO::Handle" : "0",
"IO::Scalar" : "0",
"IPC::Open3" : "0",
"Test::More" : "0.88",
"lib" : "0",
"perl" : "5.006"
}
}
},
"provides" : {
"HTML::Widgets::NavMenu" : {
"file" : "lib/HTML/Widgets/NavMenu.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::Error" : {
"file" : "lib/HTML/Widgets/NavMenu/Error.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::Error::Redirect" : {
"file" : "lib/HTML/Widgets/NavMenu/Error/Redirect.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::EscapeHtml" : {
"file" : "lib/HTML/Widgets/NavMenu/EscapeHtml.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::ExpandVal" : {
"file" : "lib/HTML/Widgets/NavMenu/ExpandVal.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::HeaderRole" : {
"file" : "lib/HTML/Widgets/NavMenu/HeaderRole.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::Iterator::Base" : {
"file" : "lib/HTML/Widgets/NavMenu/Iterator/Base.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::Iterator::GetCurrentlyActive" : {
"file" : "lib/HTML/Widgets/NavMenu/Iterator/GetCurrentlyActive.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::Iterator::Html" : {
"file" : "lib/HTML/Widgets/NavMenu/Iterator/Html.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::Iterator::Html::Item" : {
"file" : "lib/HTML/Widgets/NavMenu/Iterator/Html/Item.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::Iterator::JQTreeView" : {
"file" : "lib/HTML/Widgets/NavMenu/Iterator/JQTreeView.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::Iterator::NavMenu" : {
"file" : "lib/HTML/Widgets/NavMenu/Iterator/NavMenu.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::Iterator::NavMenu::HeaderRole" : {
"file" : "lib/HTML/Widgets/NavMenu/Iterator/NavMenu/HeaderRole.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::Iterator::SiteMap" : {
"file" : "lib/HTML/Widgets/NavMenu/Iterator/SiteMap.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::JQueryTreeView" : {
"file" : "lib/HTML/Widgets/NavMenu/JQueryTreeView.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::LeadingPath::Component" : {
"file" : "lib/HTML/Widgets/NavMenu/LeadingPath/Component.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::NodeDescription" : {
"file" : "lib/HTML/Widgets/NavMenu/NodeDescription.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::Object" : {
"file" : "lib/HTML/Widgets/NavMenu/Object.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::Predicate" : {
"file" : "lib/HTML/Widgets/NavMenu/Predicate.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::TagGen" : {
"file" : "lib/HTML/Widgets/NavMenu/TagGen.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::Tree::Iterator" : {
"file" : "lib/HTML/Widgets/NavMenu/Tree/Iterator.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::Tree::Iterator::Item" : {
"file" : "lib/HTML/Widgets/NavMenu/Tree/Iterator/Item.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::Tree::Iterator::Stack" : {
"file" : "lib/HTML/Widgets/NavMenu/Tree/Iterator/Stack.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::Tree::Node" : {
"file" : "lib/HTML/Widgets/NavMenu/Tree/Node.pm",
"version" : "1.1000"
},
"HTML::Widgets::NavMenu::Url" : {
"file" : "lib/HTML/Widgets/NavMenu/Url.pm",
"version" : "1.1000"
}
},
"release_status" : "stable",
"resources" : {
"bugtracker" : {
"web" : "https://github.com/shlomif/perl-HTML-Widgets-NavMenu/issues"
},
"homepage" : "http://web-cpan.shlomifish.org/modules/HTML-Widgets-NavMenu/",
"repository" : {
"type" : "git",
"url" : "git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git",
"web" : "https://github.com/shlomif/perl-HTML-Widgets-NavMenu"
}
},
"version" : "1.1000",
"x_Dist_Zilla" : {
"perl" : {
"version" : "5.034001"
},
"plugins" : [
{
"class" : "Dist::Zilla::Plugin::Prereqs",
"config" : {
"Dist::Zilla::Plugin::Prereqs" : {
"phase" : "test",
"type" : "requires"
}
},
"name" : "@Filter/TestMoreDoneTesting",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::AutoPrereqs",
"name" : "@Filter/AutoPrereqs",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::ExecDir",
"name" : "@Filter/ExecDir",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::GatherDir",
"config" : {
"Dist::Zilla::Plugin::GatherDir" : {
"exclude_filename" : [],
"exclude_match" : [],
"follow_symlinks" : 0,
"include_dotfiles" : 0,
"prefix" : "",
"prune_directory" : [],
"root" : "."
}
},
"name" : "@Filter/GatherDir",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::License",
"name" : "@Filter/License",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::ManifestSkip",
"name" : "@Filter/ManifestSkip",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::MetaYAML",
"name" : "@Filter/MetaYAML",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::PruneCruft",
"name" : "@Filter/PruneCruft",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::Readme",
"name" : "@Filter/Readme",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::RunExtraTests",
"config" : {
"Dist::Zilla::Role::TestRunner" : {
"default_jobs" : 1
}
},
"name" : "@Filter/RunExtraTests",
"version" : "0.029"
},
{
"class" : "Dist::Zilla::Plugin::ShareDir",
"name" : "@Filter/ShareDir",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::MakeMaker",
"config" : {
"Dist::Zilla::Role::TestRunner" : {
"default_jobs" : 1
}
},
"name" : "@Filter/MakeMaker",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::CheckChangesHasContent",
"name" : "@Filter/CheckChangesHasContent",
"version" : "0.011"
},
{
"class" : "Dist::Zilla::Plugin::ConfirmRelease",
"name" : "@Filter/ConfirmRelease",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::Manifest",
"name" : "@Filter/Manifest",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::MetaConfig",
"name" : "@Filter/MetaConfig",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::MetaJSON",
"name" : "@Filter/MetaJSON",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::MetaProvides::Package",
"config" : {
"Dist::Zilla::Plugin::MetaProvides::Package" : {
"finder_objects" : [
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : "@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM",
"version" : "6.024"
}
],
"include_underscores" : 0
},
"Dist::Zilla::Role::MetaProvider::Provider" : {
"$Dist::Zilla::Role::MetaProvider::Provider::VERSION" : "2.002004",
"inherit_missing" : 1,
"inherit_version" : 1,
"meta_noindex" : 1
},
"Dist::Zilla::Role::ModuleMetadata" : {
"Module::Metadata" : "1.000037",
"version" : "0.006"
}
},
"name" : "@Filter/MetaProvides::Package",
"version" : "2.004003"
},
{
"class" : "Dist::Zilla::Plugin::MetaResources",
"name" : "@Filter/MetaResources",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::ModuleBuild",
"config" : {
"Dist::Zilla::Role::TestRunner" : {
"default_jobs" : 1
}
},
"name" : "@Filter/ModuleBuild",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::PkgVersion",
"name" : "@Filter/PkgVersion",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::PodCoverageTests",
"name" : "@Filter/PodCoverageTests",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::PodSyntaxTests",
"name" : "@Filter/PodSyntaxTests",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::Test::Compile",
"config" : {
"Dist::Zilla::Plugin::Test::Compile" : {
"bail_out_on_fail" : 0,
"fail_on_warning" : "author",
"fake_home" : 0,
"filename" : "t/00-compile.t",
"module_finder" : [
":InstallModules"
],
"needs_display" : 0,
"phase" : "test",
"script_finder" : [
":PerlExecFiles"
],
"skips" : [],
"switch" : []
}
},
"name" : "@Filter/Test::Compile",
"version" : "2.058"
},
{
"class" : "Dist::Zilla::Plugin::Test::CPAN::Changes",
"config" : {
"Dist::Zilla::Plugin::Test::CPAN::Changes" : {
"changelog" : "Changes"
}
},
"name" : "@Filter/Test::CPAN::Changes",
"version" : "0.012"
},
{
"class" : "Dist::Zilla::Plugin::Test::EOL",
"config" : {
"Dist::Zilla::Plugin::Test::EOL" : {
"filename" : "xt/author/eol.t",
"finder" : [
":ExecFiles",
":InstallModules",
":TestFiles"
],
"trailing_whitespace" : 1
}
},
"name" : "@Filter/Test::EOL",
"version" : "0.19"
},
{
"class" : "Dist::Zilla::Plugin::Test::NoTabs",
"config" : {
"Dist::Zilla::Plugin::Test::NoTabs" : {
"filename" : "xt/author/no-tabs.t",
"finder" : [
":InstallModules",
":ExecFiles",
":TestFiles"
]
}
},
"name" : "@Filter/Test::NoTabs",
"version" : "0.15"
},
{
"class" : "Dist::Zilla::Plugin::Test::TrailingSpace",
"name" : "@Filter/Test::TrailingSpace",
"version" : null
},
{
"class" : "Dist::Zilla::Plugin::TestRelease",
"name" : "@Filter/TestRelease",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::PodWeaver",
"config" : {
"Dist::Zilla::Plugin::PodWeaver" : {
"finder" : [
":InstallModules",
":ExecFiles"
],
"plugins" : [
{
"class" : "Pod::Weaver::Plugin::SingleEncoding",
"name" : "@SHLOMIF/SingleEncoding",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Plugin::WikiDoc",
"name" : "@SHLOMIF/WikiDoc",
"version" : "0.093004"
},
{
"class" : "Pod::Weaver::Plugin::EnsurePod5",
"name" : "@CorePrep/EnsurePod5",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Plugin::H1Nester",
"name" : "@CorePrep/H1Nester",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "@SHLOMIF/Name",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Section::Version",
"name" : "@SHLOMIF/Version",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Section::Region",
"name" : "@SHLOMIF/Prelude",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "@SHLOMIF/Synopsis",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "@SHLOMIF/Description",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "@SHLOMIF/Usage",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "@SHLOMIF/Overview",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "@SHLOMIF/Stability",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Section::Collect",
"name" : "Requirements",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Section::Collect",
"name" : "Attributes",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Section::Collect",
"name" : "Constructors",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Section::Collect",
"name" : "Methods",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Section::Collect",
"name" : "Functions",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Section::Leftovers",
"name" : "@SHLOMIF/Leftovers",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Section::Region",
"name" : "@SHLOMIF/postlude",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Section::Support",
"name" : "@SHLOMIF/Support",
"version" : "1.013"
},
{
"class" : "Pod::Weaver::Section::Authors",
"name" : "@SHLOMIF/Authors",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Section::Bugs",
"name" : "@SHLOMIF/Bugs",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Section::Contributors",
"name" : "@SHLOMIF/Contributors",
"version" : "0.009"
},
{
"class" : "Pod::Weaver::Section::Legal",
"name" : "@SHLOMIF/Legal",
"version" : "4.018"
},
{
"class" : "Pod::Weaver::Plugin::Transformer",
"name" : "@SHLOMIF/List",
"version" : "4.018"
}
]
}
},
"name" : "@Filter/PodWeaver",
"version" : "4.009"
},
{
"class" : "Dist::Zilla::Plugin::UploadToCPAN",
"name" : "@Filter/UploadToCPAN",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::Keywords",
"config" : {
"Dist::Zilla::Plugin::Keywords" : {
"keywords" : [
"arrows",
"bar",
"breadcrumbs",
"css",
"expand",
"hidden",
"html",
"menu",
"menus",
"nav-bar",
"navbar",
"navigation",
"navigation",
"aids",
"nav-menu",
"navmenu",
"next",
"prev",
"previous",
"pure-perl",
"site-map",
"skipped",
"trail",
"tree",
"unexpand",
"up",
"widget",
"widgets",
"xhtml"
]
}
},
"name" : "Keywords",
"version" : "0.007"
},
{
"class" : "Dist::Zilla::Plugin::Test::TidyAll",
"name" : "Test::TidyAll",
"version" : "0.04"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":InstallModules",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":IncModules",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":TestFiles",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ExtraTestFiles",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ExecFiles",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":PerlExecFiles",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ShareFiles",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":MainModule",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":AllFiles",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":NoFiles",
"version" : "6.024"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : "@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM",
"version" : "6.024"
}
],
"zilla" : {
"class" : "Dist::Zilla::Dist::Builder",
"config" : {
"is_trial" : 0
},
"version" : "6.024"
}
},
"x_generated_by_perl" : "v5.34.1",
"x_serialization_backend" : "Cpanel::JSON::XS version 4.26",
"x_spdx_expression" : "MIT"
}
weaver.ini 100644 000764 000764 13 14247414065 17623 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000 [@SHLOMIF]
01unit.t 100644 000764 000764 3117 14247414065 17451 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/t #!/usr/bin/perl -w
use strict;
use Test::More tests => 9;
use HTML::Widgets::NavMenu ();
{
my $text = "test/foo";
my $url = HTML::Widgets::NavMenu::_text_to_url_obj($text);
my $components = $url->_get_url();
ok( scalar(@$components) == 2 ); # TEST
ok( $components->[0] eq "test" ); # TEST
ok( $components->[1] eq "foo" ); # TEST
ok( !$url->_is_dir() ); # TEST
}
{
my $url1 = HTML::Widgets::NavMenu::Url->new( ["links.html"], 0, "server" );
my $url2 = HTML::Widgets::NavMenu::Url->new( ["links.html"], 0, "server" );
my $rel_url = $url1->_get_relative_url( $url2, 0 );
ok( $rel_url eq "./links.html", "Checking for same file to itself link" )
; # TEST
}
{
my $root_url = HTML::Widgets::NavMenu::Url->new( "", 1 );
my $current_url = HTML::Widgets::NavMenu::Url->new( "open-source/", 1 );
ok( $current_url->_get_relative_url( $root_url, 1 ) eq "../",
"Checking for link to root directory" ); # TEST
}
{
# TEST
ok(
(
HTML::Widgets::NavMenu::_get_relative_url( "open-source/", "" ) eq
"../"
),
"_get_relative_url(): Checking for link to root directory"
);
}
{
eval { my $iter = HTML::Widgets::NavMenu::Iterator::Base->new(); };
# TEST
like( $@, qr{^nav_menu not specified}, "nav_menu not specified" );
}
{
my $obj = HTML::Widgets::NavMenu::Object->new();
# TEST
isa_ok(
$obj,
"HTML::Widgets::NavMenu::Object",
"Testing creation of object"
);
}
05stack.t 100644 000764 000764 5014 14247414065 17601 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/t #!/usr/bin/perl -w
use Test::More tests => 23;
use strict;
BEGIN
{
use_ok('HTML::Widgets::NavMenu::Tree::Iterator::Stack'); # TEST
}
{
my $stack = HTML::Widgets::NavMenu::Tree::Iterator::Stack->new();
ok( $stack, "Checking for Object Allocation" ); # TEST
is( $stack->len(), 0, "len() == 0 on allocation" ); # TEST
ok( $stack->is_empty(), "is_empty() on allocation" ); # TEST
$stack->push("Hello");
$stack->push("World");
# TEST
ok( ( !$stack->is_empty() ), "is_empty() is not true after filling" );
$stack->push("TamTam");
is( $stack->len(), 3, "Checking stack len" ); # TEST
is( $stack->top(), "TamTam", "Checking top of stack" ); # TEST
is( $stack->item(2), "TamTam", "Checking Item 2" ); # TEST
is( $stack->item(1), "World", "Checking Item 1" ); # TEST
is( $stack->item(0), "Hello", "Checking Item 0" ); # TEST
my $popped_item = $stack->pop();
is( $popped_item, "TamTam", "Popped Item" ); # TEST
is( $stack->len(), 2, "Checking stack len" ); # TEST
# TEST
is( $stack->top(), "World", "Checking stack top after pop" );
$stack->push("Quatts");
is( $stack->len(), 3, "Stack Len" ); # TEST
is( $stack->top(), "Quatts", "Top Item is Quatts" ); # TEST
$stack->pop();
$stack->pop();
$stack->pop();
# TEST
ok( ( !defined( $stack->top() ) ),
"Checking for top() returning undef on empty stack" );
is( $stack->len(), 0, "len() == 0 after popping all elements" ); # TEST
ok( $stack->is_empty(), "is_empty() after popping all elements" ); # TEST
}
{
my $stack = HTML::Widgets::NavMenu::Tree::Iterator::Stack->new();
$stack->push("Hello");
$stack->push("Superb");
$stack->push("Quality");
$stack->push("Pardon");
$stack->reset();
is( $stack->len(), 0, "len() == 0 after reset" ); # TEST
ok( $stack->is_empty(), "is_empty() after reset" ); # TEST
# TEST
ok( ( !defined( $stack->top() ) ),
"Checking for top() returning undef on reset stack" );
$stack->push("Condor");
# TEST
is( $stack->len(), 1, "len() after push() after reset" );
# TEST
is( $stack->item(0), "Condor", "Stack is correct after push after reset" );
}
Makefile.PL 100644 000764 000764 3100 14247414065 17643 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.024.
use strict;
use warnings;
use 5.006;
use ExtUtils::MakeMaker;
my %WriteMakefileArgs = (
"ABSTRACT" => "A Perl Module for Generating HTML Navigation Menus",
"AUTHOR" => "Shlomi Fish ",
"BUILD_REQUIRES" => {
"Module::Build" => "0.28"
},
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => 0,
"Module::Build" => "0.28"
},
"DISTNAME" => "HTML-Widgets-NavMenu",
"LICENSE" => "mit",
"MIN_PERL_VERSION" => "5.006",
"NAME" => "HTML::Widgets::NavMenu",
"PREREQ_PM" => {
"Class::XSAccessor" => 0,
"Exporter" => 0,
"parent" => 0,
"strict" => 0,
"vars" => 0,
"warnings" => 0
},
"TEST_REQUIRES" => {
"File::Spec" => 0,
"IO::Handle" => 0,
"IO::Scalar" => 0,
"IPC::Open3" => 0,
"Test::More" => "0.88",
"lib" => 0
},
"VERSION" => "1.1000",
"test" => {
"TESTS" => "t/*.t"
}
);
my %FallbackPrereqs = (
"Class::XSAccessor" => 0,
"Exporter" => 0,
"File::Spec" => 0,
"IO::Handle" => 0,
"IO::Scalar" => 0,
"IPC::Open3" => 0,
"Module::Build" => "0.28",
"Test::More" => "0.88",
"lib" => 0,
"parent" => 0,
"strict" => 0,
"vars" => 0,
"warnings" => 0
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
delete $WriteMakefileArgs{TEST_REQUIRES};
delete $WriteMakefileArgs{BUILD_REQUIRES};
$WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
WriteMakefile(%WriteMakefileArgs);
TODO-Rejects 100644 000764 000764 1471 14247414065 17767 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000 * Refactor get_next_coords().
- I don't see too much point to it. It is working as it is, and it's
only one function that doesn't affect the rest of the code.
* Create a base class for classes with 'subs' functionality - like
get_nth_sub, add_sub, num_subs, etc. Both ..::Node and ..::Item share it.
- They have slightly different semantics, and besides - it's not
too much duplicate code. It would be more trouble than it's worth.
* Future direction: generate the tree once and then be able to render
it for different path_info()/current_host() configurations. (and the
generated tree re-used by all other members).
- the problem is that the expand() operations and the expanded()
flag depends on this combination. Thus, the generated tree is
different for any path_info()/current_host().
MANIFEST.SKIP 100644 000764 000764 56 14247414065 17536 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000 ^HTML-Widgets-NavMenu-[0-9]
^\.tidyall\.d/
~$
14tag-gen.t 100644 000764 000764 4777 14247414065 20035 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/t #!/usr/bin/perl -w
use Test::More tests => 12;
use strict;
BEGIN
{
use_ok('HTML::Widgets::NavMenu::TagGen'); # TEST
}
{
my $test_tag = HTML::Widgets::NavMenu::TagGen->new(
{
'name' => "a",
'attributes' => {
'href' => { 'escape' => 1, },
'title' => { 'escape' => 0, },
'id' => { 'escape' => 1, },
'iname' => { 'escape' => 0, },
},
}
);
# TEST
is(
$test_tag->gen( { 'href' => "http://www.mysite.com/", } ),
q{},
"Simple Tag Test"
);
# TEST
is( $test_tag->gen( { 'href' => "/hello&you", } ),
q{}, "Escaping" );
# TEST
is(
$test_tag->gen( { 'href' => "http://www.mysite.com/", }, 1 ),
q{},
"Standalone Tag"
);
# TEST
is(
$test_tag->gen( { 'href' => "/hello&you", }, 1 ),
q{},
"Standalone Tag with Escaping"
);
# TEST
is( $test_tag->gen( {} ), q{}, "Empty Tag" );
# TEST
is( $test_tag->gen( {}, 1 ), q{}, "Empty Standalone Tag" );
# TEST
is(
$test_tag->gen( { 'title' => "This is me&yours title" } ),
q{},
"Non-escaping for unescaped attribute"
);
# TEST
is(
$test_tag->gen(
{ 'title' => "Hello", 'href' => "/hi/", 'id' => "myid" }
),
q{},
"Multiple Attributes"
);
# TEST
is(
$test_tag->gen(
{
'title' => "Hello",
'href' => "/hi/",
'id' => "myid"
},
1
),
q{},
"Multiple Attributes Standalone"
);
my $string = "<Hello&";
# TEST
is(
$test_tag->gen( { map { $_ => $string } (qw(href title id iname)) } ),
q{},
"Selective Escaping"
);
# TEST
is(
$test_tag->gen(
{ map { $_ => $string } (qw(href title id iname)) }, 1
),
q{},
"Selective Escaping Standalone"
);
}
16redirect.t 100644 000764 000764 3430 14247414065 20277 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/t #!/usr/bin/perl
use strict;
use warnings;
package MockCGI;
sub new
{
my $self = {};
bless $self, shift;
return $self;
}
sub redirect
{
my ( $self, $path ) = (@_);
return "ReDirect-To: $path";
}
sub script_name
{
my $self = shift;
return "{{{Script Name}}}";
}
package main;
use vars qw($exit_count);
BEGIN
{
*CORE::GLOBAL::exit = sub { ++$exit_count; };
}
use lib './t/lib';
use Test::More tests => 6;
use HTML::Widgets::NavMenu::Test::Data;
use HTML::Widgets::NavMenu::Test::Stdout;
use HTML::Widgets::NavMenu ();
my $test_data = get_test_data();
{
eval {
my $nav_menu = HTML::Widgets::NavMenu->new(
'path_info' => "",
@{ $test_data->{'minimal'} },
'ul_classes' => [ "navbarmain", ("navbarnested") x 5 ],
);
};
# TEST
isa_ok( $@, "HTML::Widgets::NavMenu::Error::Redirect", "\$@" );
reset_out_buffer();
$exit_count = 0;
$@->CGIpm_perform_redirect( MockCGI->new() );
# TEST
is(
get_out_buffer(),
"ReDirect-To: {{{Script Name}}}/",
"Checking that redirect-to works"
);
# TEST
is( $exit_count, 1, "Counting an exit" );
}
{
eval {
my $nav_menu = HTML::Widgets::NavMenu->new(
'path_info' => "/hello/world//",
@{ $test_data->{'minimal'} },
'ul_classes' => [ "navbarmain", ("navbarnested") x 5 ],
);
};
# TEST
isa_ok( $@, "HTML::Widgets::NavMenu::Error::Redirect", "\$@" );
reset_out_buffer();
$exit_count = 0;
$@->CGIpm_perform_redirect( MockCGI->new() );
# TEST
is(
get_out_buffer(),
"ReDirect-To: {{{Script Name}}}/hello/world/",
"Checking that redirect-to works"
);
# TEST
is( $exit_count, 1, "Counting an exit" );
}
02site-map.t 100644 000764 000764 14156 14247414065 20237 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/t #!/usr/bin/perl -w
use strict;
use lib './t/lib';
use Test::More tests => 6;
use HTML::Widgets::NavMenu ();
use HTML::Widgets::NavMenu::Test::Data;
my $test_data = get_test_data();
sub validate_site_map
{
my $results = shift;
my $expected_string = shift;
my $test_blurb = shift;
my @result = @$results;
my @expected = ( split( /\n/, $expected_string ) );
is_deeply( \@expected, \@result, $test_blurb );
}
{
my $nav_menu = HTML::Widgets::NavMenu->new(
'path_info' => "hello/",
@{ $test_data->{'minimal'} },
);
my $results = $nav_menu->gen_site_map();
my $expected_text = <<"EOF";
EOF
# TEST
validate_site_map( $results, $expected_text, "site_map - complex" );
}
# Now testing that the separator is safely skipped and does not generate
# a double
EOF
# TEST
validate_site_map( $results, $expected_text, "site_map - separator" );
}
# This is a test for the rec_url_type directive.
{
my $nav_menu = HTML::Widgets::NavMenu->new(
'path_info' => "/darling/",
@{ $test_data->{'rec_url_type_menu'} },
);
my $results = $nav_menu->gen_site_map();
my $expected_text = <<"EOF";
EOF
# TEST
validate_site_map( $results, $expected_text, "site_map - rec_url_type" );
}
# This is a test for the url_is_abs directive.
{
my $nav_menu = HTML::Widgets::NavMenu->new(
'path_info' => "/darling/",
@{ $test_data->{'url_is_abs_menu'} },
);
my $results = $nav_menu->gen_site_map();
my $expected_text = <<"EOF";
EOF
# TEST
test_nav_menu( $rendered, $expected_string, "Nav Menu for minimal - 2" );
}
# This test tests that an expand_re directive should not cause
# the current coords to be assigned to it, thus marking a site
# incorrectly.
{
my $nav_menu = HTML::Widgets::NavMenu->new(
'path_info' => "/me/",
@{ $test_data->{'expand_re'} },
'ul_classes' => [ "navbarmain", ("navbarnested") x 5 ],
);
my $rendered = $nav_menu->render();
my $expected_string = <<"EOF";
EOF
# TEST
test_nav_menu( $rendered, $expected_string, "Nav Menu for expand_re" );
}
# This test tests that an empty expand_re directive works after a successful
# pattern match.
{
my $string = "aslkdjofisvniowgvnoaifnaoiwfb";
$string =~ s{ofisvniowgvnoaifnaoiwfb$}{};
my $nav_menu = HTML::Widgets::NavMenu->new(
'path_info' => "/me/",
@{ $test_data->{'expand_re'} },
'ul_classes' => [ "navbarmain", ("navbarnested") x 5 ],
);
my $rendered = $nav_menu->render();
my $expected_string = <<"EOF";
EOF
# TEST
test_nav_menu( $rendered, $expected_string,
"Nav Menu for empty expand_re after successful pattern match" );
}
# This test tests the show_always directive which causes the entire
# sub-tree to expand at any URL.
{
my $nav_menu = HTML::Widgets::NavMenu->new(
'path_info' => "/me/",
@{ $test_data->{'show_always'} },
'ul_classes' => [ "navbarmain", ("navbarnested") x 5 ],
);
my $rendered = $nav_menu->render();
my $expected_string = <<"EOF";
EOF
# TEST
test_nav_menu( $rendered, $expected_string, "Nav Menu with show_always" );
}
# This test tests a menu auto-expands if the current URL is an item
# inside it.
{
my $nav_menu = HTML::Widgets::NavMenu->new(
'path_info' => "/me/bio.html",
@{ $test_data->{'items_in_sub'} },
'ul_classes' => [ "navbarmain", ("navbarnested") x 5 ],
);
my $rendered = $nav_menu->render();
my $expected_string = <<"EOF";
EOF
# TEST
test_nav_menu( $rendered, $expected_string,
"Nav Menu with a role of \"header\"" );
}
{
my $nav_menu = HTML::Widgets::NavMenu::HeaderRole->new(
'path_info' => "/me/",
@{ $test_data->{'header_role'} },
'ul_classes' => [ "navbarmain", ("navbarnested") x 5 ],
);
my $rendered = $nav_menu->render();
my $expected_string = <<"EOF";
EOF
# TEST
test_nav_menu( $rendered, $expected_string,
"Nav Menu with a selected item with a role of \"header\" " );
}
# Test the selective expand. (test #1)
{
my $nav_menu = HTML::Widgets::NavMenu->new(
'path_info' => "/me/bio/test.html",
@{ $test_data->{'selective_expand'} },
'ul_classes' => [ "one", "two", "three" ],
);
my $rendered = $nav_menu->render();
my $expected_string = <<"EOF";
EOF
# TEST
test_nav_menu( $rendered, $expected_string,
"Selective Expand Nav-Menu #2" );
}
# This is a test for the url_type directive.
{
my $nav_menu = HTML::Widgets::NavMenu->new(
'path_info' => "/darling/",
@{ $test_data->{'url_type_menu'} },
);
my $rendered = $nav_menu->render();
my $expected_string = <<"EOF";
EOF
# TEST
test_nav_menu( $rendered, $expected_string, "Nav Menu for url_type - 1" );
}
# This is a test for the rec_url_type directive.
# Also test the behaviour of the url_type when a trailing_url_base
# is specified
{
my $nav_menu = HTML::Widgets::NavMenu->new(
'path_info' => "/darling/",
@{ $test_data->{'rec_url_type_menu'} },
);
my $rendered = $nav_menu->render();
my $expected_string = <<"EOF";
EOF
# TEST
test_nav_menu( $rendered, $expected_string,
"Nav Menu for rec_url_type - 1" );
}
# Test the url_is_abs directive
{
my $nav_menu = HTML::Widgets::NavMenu->new(
'path_info' => "/hello/",
@{ $test_data->{'url_is_abs_menu'} },
);
my $rendered = $nav_menu->render();
my $expected_string = <<"EOF";
EOF
# TEST
test_nav_menu( $rendered, $expected_string,
"Nav Menu with a special chars URL." );
}
# Test a special chars-based URL.
{
my %args = ( @{ $test_data->{'special_chars_menu'} } );
delete( $args{'current_host'} );
eval {
my $nav_menu = HTML::Widgets::NavMenu->new(
'path_info' => "/&\"you\"/",
%args,
);
};
# TEST
like( $@, qr!^Current host!, "Checking for exception" );
}
# This is to test that the cb2 is working properly.
{
my $nav_menu = HTML::Widgets::NavMenu->new(
'path_info' => "/me/not-exist/",
@{ $test_data->{'mixed_expand_menu'} },
'current_host' => "other",
'ul_classes' => [ "one", "two", "three" ],
);
my $rendered = $nav_menu->render();
my $expected_string = <<"EOF";
EOF
# TEST
test_nav_menu( $rendered, $expected_string, "Non Capturing Expand" );
}
# This test tests that the URLs do not have "./" prepended to them
# when given the no_leading_dot option.
{
my $nav_menu = HTML::Widgets::NavMenu->new(
'path_info' => "/me/bio.html",
@{ $test_data->{'items_in_sub'} },
'ul_classes' => [ "navbarmain", ("navbarnested") x 5 ],
no_leading_dot => 1,
);
my $rendered = $nav_menu->render();
my $expected_string = <<"EOF";
EOF
# TEST
test_nav_menu( $rendered, $expected_string,
"Testing ul classes for no CSS class to be assigned." );
}
# This test tests the show_always directive which causes the entire
# sub-tree to expand at any URL.
{
my $nav_menu = HTML::Widgets::NavMenu->new(
'path_info' => "/me/",
@{ $test_data->{'show_always'} },
'ul_classes' => [ "FirstClass", "secondclass 2C", "ThirdClass" ],
);
my $rendered = $nav_menu->render();
my $expected_string = <<"EOF";
EOF
# TEST
test_nav_menu( $rendered, $expected_string, "Nav Menu with depth classes" );
}
# This test tests the escaping of the class names.
{
my $nav_menu = HTML::Widgets::NavMenu->new(
'path_info' => "/me/",
@{ $test_data->{'show_always'} },
'ul_classes' => [ "F&F Class", "sec", "T\"C" ],
);
my $rendered = $nav_menu->render();
my $expected_string = <<"EOF";
EOF
# TEST
validate_nav_menu( $rendered, $expected_string,
"Nav Menu with show_always" );
}
pod-coverage.t 100644 000764 000764 334 14247414065 22354 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/xt/author #!perl
# This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests.
use Test::Pod::Coverage 1.08;
use Pod::Coverage::TrustPod;
all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' });
release 000755 000764 000764 0 14247414065 17612 5 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/xt cpan-changes.t 100644 000764 000764 344 14247414065 22447 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/xt/release use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::CPAN::Changes 0.012
use Test::More 0.96 tests => 1;
use Test::CPAN::Changes;
subtest 'changes_ok' => sub {
changes_file_ok('Changes');
};
Widgets 000755 000764 000764 0 14247414065 20457 5 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML NavMenu.pm 100644 000764 000764 111655 14247414065 22577 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets package HTML::Widgets::NavMenu;
$HTML::Widgets::NavMenu::VERSION = '1.1000';
use strict;
use warnings;
use HTML::Widgets::NavMenu::Error ();
use HTML::Widgets::NavMenu::Error::Redirect ();
use HTML::Widgets::NavMenu::NodeDescription ();
use HTML::Widgets::NavMenu::LeadingPath::Component ();
use HTML::Widgets::NavMenu::Iterator::GetCurrentlyActive ();
use parent 'HTML::Widgets::NavMenu::Object';
use HTML::Widgets::NavMenu::Url ();
require HTML::Widgets::NavMenu::Iterator::NavMenu;
require HTML::Widgets::NavMenu::Iterator::SiteMap;
require HTML::Widgets::NavMenu::Tree::Node;
require HTML::Widgets::NavMenu::Predicate;
__PACKAGE__->mk_acc_ref(
[
qw(
_current_coords
coords_stop
current_host
_hosts
_no_leading_dot
_leading_path_coords
path_info
_traversed_tree
_tree_contents
_ul_classes
)
]
);
sub _init
{
my $self = shift;
my %args = (@_);
$self->_register_path_info( \%args );
$self->_hosts( $args{hosts} );
$self->_tree_contents( $args{tree_contents} );
$self->current_host( $args{current_host} )
or die "Current host was not specified.";
$self->_ul_classes( $args{'ul_classes'} || [] );
$self->_no_leading_dot(
exists( $args{'no_leading_dot'} ) ? $args{'no_leading_dot'} : 0 );
$self->coords_stop( $args{coords_stop} || 0 );
return 0;
}
sub _get_nav_menu_traverser_args
{
my $self = shift;
return {
'nav_menu' => $self,
'ul_classes' => $self->_ul_classes(),
};
}
sub _get_nav_menu_traverser
{
my $self = shift;
return HTML::Widgets::NavMenu::Iterator::NavMenu->new(
$self->_get_nav_menu_traverser_args() );
}
sub _get_current_coords
{
my $self = shift;
# This is to make sure $self->_current_coords() is generated.
$self->_get_traversed_tree();
return [ @{ $self->_current_coords() } ];
}
sub _register_path_info
{
my $self = shift;
my $args = shift;
my $path_info = $args->{path_info};
my $redir_path = undef;
if ( $path_info eq "" )
{
$redir_path = "";
}
elsif ( $path_info =~ m/\/\/$/ )
{
my $path = $path_info;
$path =~ s{\/+$}{};
$redir_path = $path;
}
if ( defined($redir_path) )
{
my $error = HTML::Widgets::NavMenu::Error::Redirect->new();
$error->{'-redirect_path'} = ( $redir_path . "/" );
$error->{'msg'} = "Need to redirect";
die $error;
}
$path_info =~ s!^\/!!;
$self->path_info($path_info);
return 0;
}
sub _is_slash_terminated
{
my $string = shift;
return ( ( $string =~ /\/$/ ) ? 1 : 0 );
}
sub _text_to_url_obj
{
my $text = shift;
my $url =
HTML::Widgets::NavMenu::Url->new( $text,
( _is_slash_terminated($text) || ( $text eq "" ) ), "server", );
return $url;
}
sub _get_relative_url
{
my $from_text = shift;
my $to_text = shift(@_);
my $no_leading_dot = shift;
my $from_url = _text_to_url_obj($from_text);
my $to_url = _text_to_url_obj($to_text);
my $ret =
$from_url->_get_relative_url( $to_url, _is_slash_terminated($from_text),
$no_leading_dot, );
return $ret;
}
sub _get_full_abs_url
{
my ( $self, $args ) = @_;
my $host = $args->{host};
my $host_url = $args->{host_url};
return ( $self->_hosts->{$host}->{base_url} . $host_url );
}
sub get_cross_host_rel_url_ref
{
my ( $self, $args ) = @_;
my $host = $args->{host};
my $host_url = $args->{host_url};
my $url_type = $args->{url_type};
my $url_is_abs = $args->{url_is_abs};
if ($url_is_abs)
{
return $host_url;
}
elsif ( ( $host ne $self->current_host() ) || ( $url_type eq "full_abs" ) )
{
return $self->_get_full_abs_url($args);
}
elsif ( $url_type eq "rel" )
{
# TODO : convert to a method.
return _get_relative_url( $self->path_info(), $host_url,
$self->_no_leading_dot() );
}
elsif ( $url_type eq "site_abs" )
{
return ( $self->_hosts->{$host}->{trailing_url_base} . $host_url );
}
else
{
die "Unknown url_type \"$url_type\"!\n";
}
}
sub get_cross_host_rel_url
{
my $self = shift;
return $self->get_cross_host_rel_url_ref( {@_} );
}
sub _get_url_to_item
{
my $self = shift;
my $item = shift;
return $self->get_cross_host_rel_url_ref(
{
'host' => $item->_accum_state()->{'host'},
'host_url' => ( $item->_node->url() || "" ),
'url_type' => $item->get_url_type(),
'url_is_abs' => $item->_node->url_is_abs(),
}
);
}
sub _gen_blank_nav_menu_tree_node
{
my $self = shift;
return HTML::Widgets::NavMenu::Tree::Node->new();
}
sub _create_predicate
{
my ( $self, $args ) = @_;
return HTML::Widgets::NavMenu::Predicate->new( 'spec' => $args->{'spec'}, );
}
sub _create_new_nav_menu_item
{
my ( $self, $args ) = @_;
my $sub_contents = $args->{sub_contents};
my $new_item = $self->_gen_blank_nav_menu_tree_node();
$new_item->set_values_from_hash_ref($sub_contents);
if ( exists( $sub_contents->{'expand'} ) )
{
my $expand_val = $self->_create_predicate(
{
'spec' => $sub_contents->{'expand'},
}
)->evaluate(
'path_info' => $self->path_info(),
'current_host' => $self->current_host(),
);
if ($expand_val)
{
$new_item->expand($expand_val);
}
}
return $new_item;
}
sub _render_tree_contents
{
my $self = shift;
my $sub_contents = shift;
my $path_info = $self->path_info();
my $new_item =
$self->_create_new_nav_menu_item( { sub_contents => $sub_contents }, );
if ( exists( $sub_contents->{subs} ) )
{
foreach my $sub_contents_sub ( @{ $sub_contents->{subs} } )
{
$new_item->add_sub(
$self->_render_tree_contents( $sub_contents_sub, ) );
}
}
return $new_item;
}
sub gen_site_map
{
my $self = shift;
my $iterator = HTML::Widgets::NavMenu::Iterator::SiteMap->new(
{
'nav_menu' => $self,
}
);
$iterator->traverse();
return $iterator->get_results();
}
sub _get_next_coords
{
my $self = shift;
my @coords = @{ shift || $self->_get_current_coords };
my @branches = ( $self->_get_traversed_tree() );
my @dest_coords;
my $i;
for ( $i = 0 ; $i < scalar(@coords) ; ++$i )
{
$branches[ $i + 1 ] = $branches[$i]->get_nth_sub( $coords[$i] );
}
if ( $branches[$i]->_num_subs() )
{
@dest_coords = ( @coords, 0 );
}
else
{
for ( --$i ; $i >= 0 ; --$i )
{
if ( $branches[$i]->_num_subs() > ( $coords[$i] + 1 ) )
{
@dest_coords = ( @coords[ 0 .. ( $i - 1 ) ], $coords[$i] + 1 );
last;
}
}
if ( $i == -1 )
{
return;
}
}
return \@dest_coords;
}
sub _get_prev_coords
{
my $self = shift;
my @coords = @{ shift || $self->_get_current_coords() };
if ( scalar(@coords) == 0 )
{
return;
}
elsif ( $coords[$#coords] > 0 )
{
# Get the previous leaf
my @previous_leaf =
( @coords[ 0 .. ( $#coords - 1 ) ], $coords[$#coords] - 1 );
# Continue in this leaf to the end.
my $new_coords = $self->_get_most_advanced_leaf( \@previous_leaf );
return $new_coords;
}
else
{
return [ @coords[ 0 .. ( $#coords - 1 ) ] ];
}
}
sub _get_up_coords
{
my $self = shift;
my @coords = @{ shift || $self->_get_current_coords };
if ( scalar(@coords) == 0 )
{
return;
}
else
{
if ( ( @coords == 1 ) && ( $coords[0] > 0 ) )
{
my $coords_stop = $self->coords_stop();
my $ret = [0];
if ($coords_stop)
{
$ret = [];
}
return $ret;
}
pop(@coords);
return \@coords;
}
}
sub _get_top_coords
{
my $self = shift;
my @coords = @{ shift || $self->_get_current_coords() };
if ( ( !@coords ) || ( ( @coords == 1 ) && ( $coords[0] == 0 ) ) )
{
return;
}
else
{
return [0];
}
}
sub _is_skip
{
my $self = shift;
my $coords = shift;
my $iterator = $self->_get_nav_menu_traverser();
my $ret = $iterator->find_node_by_coords($coords);
my $item = $ret->{item};
return $item->_node()->skip();
}
sub _get_coords_while_skipping_skips
{
my $self = shift;
my $callback = shift;
my $coords = shift(@_);
if ( !$coords )
{
$coords = $self->_get_current_coords();
}
my $do_once = 1;
while ( $do_once || $self->_is_skip($coords) )
{
$coords = $callback->( $self, $coords );
}
continue
{
$do_once = 0;
}
return $coords;
}
sub _get_most_advanced_leaf
{
my $self = shift;
# We accept as a parameter the vector of coordinates
my $coords_ref = shift;
my @coords = @{$coords_ref};
# Get a reference to the contents HDS (= hierarchial data structure)
my $branch = $self->_get_traversed_tree();
# Get to the current branch by advancing to the offset
foreach my $c (@coords)
{
# Advance to the next level which is at index $c
$branch = $branch->get_nth_sub($c);
}
# As long as there is something deeper
while ( my $num_subs = $branch->_num_subs() )
{
my $index = $num_subs - 1;
# We are going to return it, so store it
push @coords, $index;
# Recurse into the sub-branch
$branch = $branch->get_nth_sub($index);
}
return \@coords;
}
# The traversed_tree is the tree that is calculated from the tree given
# by the user and some other parameters such as the host and path_info.
# It is passed to the NavMenu::Iterator::* classes as argument.
sub _get_traversed_tree
{
my $self = shift;
if ( !$self->_traversed_tree() )
{
my $gen_retval = $self->_gen_traversed_tree();
$self->_traversed_tree( $gen_retval->{'tree'} );
$self->_current_coords( $gen_retval->{'current_coords'} );
$self->_leading_path_coords( $gen_retval->{'leading_path_coords'} );
}
return $self->_traversed_tree();
}
sub _gen_traversed_tree
{
my $self = shift;
my $tree = $self->_render_tree_contents( $self->_tree_contents(), );
my $find_coords_iterator =
HTML::Widgets::NavMenu::Iterator::GetCurrentlyActive->new(
{
'nav_menu' => $self,
'tree' => $tree,
}
);
$find_coords_iterator->traverse();
my $current_coords = $find_coords_iterator->get_final_coords() || [];
my $leading_path_coords =
$find_coords_iterator->_get_leading_path_coords() || [];
# The root should always be expanded because:
# 1. If one of the leafs was marked as expanded so will its ancestors
# and eventually the root.
# 2. If nothing was marked as expanded, it should still be marked as
# expanded so it will expand.
$tree->expand();
return {
'tree' => $tree,
'current_coords' => $current_coords,
'leading_path_coords' => $leading_path_coords,
};
}
sub _get_leading_path_of_coords
{
my $self = shift;
my $coords = shift;
my $coords_stop = $self->coords_stop();
if ( !$coords_stop )
{
if ( !@$coords )
{
$coords = [0];
}
}
if (0) # ( $coords->[0] == 0 )
{
$coords = [ @$coords[ 1 .. $#$coords ] ];
}
my @leading_path;
my $iterator = $self->_get_nav_menu_traverser();
COORDS_LOOP:
while (1)
{
my $ret = $iterator->find_node_by_coords($coords);
my $item = $ret->{item};
my $node = $item->_node();
# This is a workaround for the root link.
my $host_url = ( defined( $node->url() ) ? ( $node->url() ) : "" );
my $host = $item->_accum_state()->{'host'};
my $url_type = (
$node->url_is_abs()
? "full_abs"
: $item->get_url_type()
);
push @leading_path,
HTML::Widgets::NavMenu::LeadingPath::Component->new(
{
'host' => $host,
'host_url' => $host_url,
'title' => $node->title(),
'label' => $node->text(),
'direct_url' => $self->_get_url_to_item($item),
'url_type' => $url_type,
}
);
if (
$coords_stop
? ( scalar(@$coords) == 0 )
: ( ( scalar(@$coords) == 1 ) && ( $coords->[0] == 0 ) )
)
{
last COORDS_LOOP;
}
}
continue
{
$coords = $self->_get_up_coords($coords);
}
my $p = [ reverse(@leading_path) ];
if ($coords_stop)
{
while ( ( @$p > 1 and $p->[0]->host_url eq $p->[1]->host_url ) )
{
shift @$p;
}
}
return $p;
}
sub _get_leading_path
{
my $self = shift;
return $self->_get_leading_path_of_coords( $self->_leading_path_coords() );
}
sub render
{
my $self = shift;
my %args = (@_);
return $self->_render_generic(
{ %args, _iter_method => '_get_nav_menu_traverser', } );
}
sub _is_top_coords
{
my ( $self, $coords, $only_empty, ) = @_;
return (
defined($coords)
? (
( @$coords == 0 ) ? 1
: $only_empty ? ''
: ( @$coords == 1 ) ? ( $coords->[0] == 0 )
: ''
)
: 1
);
}
sub _render_generic
{
my $self = shift;
my $args = shift;
my $method = $args->{_iter_method};
my $iterator = $self->$method();
$iterator->traverse();
my $html = $iterator->get_results();
my %nav_links;
my %nav_links_obj;
my %links_proto = (
'prev' => scalar(
$self->_get_coords_while_skipping_skips( \&_get_prev_coords )
),
'next' => scalar(
$self->_get_coords_while_skipping_skips( \&_get_next_coords )
),
'up' => scalar( $self->_get_up_coords() ),
'top' => scalar( $self->_get_top_coords() ),
);
my $IS_TOP =
$self->_is_top_coords( $self->_current_coords(), $self->coords_stop(),
);
while ( my ( $link_rel, $coords ) = each(%links_proto) )
{
# This is so we would avoid coordinates that point to the
# root ($coords == []).
if ( $IS_TOP
and ( $link_rel =~ /\A(?:prev|top|up)\z/ms )
) # $self->_is_top_coords( $coords, 1 ) )
{
undef($coords);
}
if ( defined($coords) )
{
my $obj = $self->_get_leading_path_of_coords($coords)->[-1];
$nav_links_obj{$link_rel} = $obj;
$nav_links{$link_rel} = $obj->direct_url();
}
}
my $js_code = "";
return {
'html' => $html,
'leading_path' => $self->_get_leading_path(),
'nav_links' => \%nav_links,
'nav_links_obj' => \%nav_links_obj,
};
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
HTML::Widgets::NavMenu - A Perl Module for Generating HTML Navigation Menus
=head1 VERSION
version 1.1000
=head1 SYNOPSIS
use HTML::Widgets::NavMenu;
my $nav_menu =
HTML::Widgets::NavMenu->new(
'path_info' => "/me/",
'current_host' => "default",
'hosts' =>
{
'default' =>
{
'base_url' => "http://www.hello.com/"
},
},
'tree_contents' =>
{
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'expand_re' => "",
'subs' =>
[
{
'text' => "Home",
'url' => "",
},
{
'text' => "About Me",
'title' => "About Myself",
'url' => "me/",
},
],
},
);
my $results = $nav_menu->render();
my $nav_menu_html = join("\n", @{$results->{'html'}});
=head1 DESCRIPTION
This module generates a navigation menu for a site. It can also generate
a complete site map, a path of leading components, and also keeps
track of navigation links ("Next", "Prev", "Up", etc.) You can start from the
example above and see more examples in the tests, in the C
directory of the HTML-Widgets-NavMenu tarball, and complete working sites
in the version control repositories at
L
and L .
=head1 USAGE
=head2 my $nav_menu = HTML::Widgets::NavMenu->new(@args)
To use this module call the constructor with the following named arguments:
=over 4
=item hosts
This should be a hash reference that maps host-IDs to another hash reference
that contains information about the hosts. An HTML::Widgets::NavMenu navigation
menu can spread across pages in several hosts, which will link from one to
another using relative URLs if possible and fully-qualified (i.e: C)
URLs if not.
Currently the only key required in the hash is the C one that points
to a string containing the absolute URL to the sub-site. The base URL may
have trailing components if it does not reside on the domain's root directory.
An optional key that is required only if you wish to use the "site_abs"
url_type (see below), is C, which denotes the component of
the site that appears after the hostname. For C
it is C~myuser/>.
Here's an example for a minimal hosts value:
'hosts' =>
{
'default' =>
{
'base_url' => "http://www.hello.com/",
'trailing_url_base' => "/",
},
},
And here's a two-hosts value from my personal site, which is spread across
two sites:
'hosts' =>
{
't2' =>
{
'base_url' => "http://www.shlomifish.org/",
'trailing_url_base' => "/",
},
'vipe' =>
{
'base_url' => "http://vipe.technion.ac.il/~shlomif/",
'trailing_url_base' => "/~shlomif/",
},
},
=item current_host
This parameter indicate which host-ID of the hosts in C is the
one that the page for which the navigation menu should be generated is. This
is important so cross-site and inner-site URLs will be handled correctly.
=item path_info
This is the path relative to the host's C of the currently displayed
page. The path should start with a "/"-character, or otherwise a re-direction
excpetion will be thrown (this is done to aid in using this module from within
CGI scripts).
=item tree_contents
This item gives the complete tree for the navigation menu. It is a nested
Perl data structure, whose syntax is fully explained in the section
"The Input Tree of Contents".
=item ul_classes
This is an optional parameter whose value is a reference to an array that
indicates the values of the class="" arguments for the CulE> tags
whose depthes are the indexes of the array.
For example, assigning:
'ul_classes' => [ "FirstClass", "second myclass", "3C" ],
Will assign "FirstClass" as the class of the top-most ULs, "second myclass"
as the classes of the ULs inner to it, and "3C" as the class of the ULs inner
to the latter ULs.
If classes are undef, the UL tag will not contain a class parameter.
=item no_leading_dot
When this parameter is set to 1, the object will try to generate URLs that
do not start with "./" when possible. That way, the generated markup will
be a little more compact. This option is not enabled by default for
backwards compatibility, but is highly recommended.
=item coords_stop
Experimental ( Boolean ; defaults to false ). B for use by
L .
=back
A complete invocation of an HTML::Widgets::NavMenu constructor can be
found in the SYNOPSIS above.
After you _init an instance of the navigation menu object, you need to
get the results using the render function.
=head2 $results = $nav_menu->render()
render() should be called after a navigation menu object is constructed
to prepare the results and return them. It returns a hash reference with the
following keys:
=over 4
=item 'html'
This key points to a reference to an array that contains the tags for the
HTML. One can join these tags to get the full HTML. It is possible to
delimit them with newlines, if one wishes the markup to be easier to read.
=item 'leading_path'
This is a reference to an array of node description objects. These indicate the
intermediate pages in the site that lead from the front page to the
current page. The methods supported by the class of these objects is described
below under "The Node Description Component Class".
=item 'nav_links_obj'
This points to a hash reference whose keys are link IDs for
the Firefox "Site Navigation Toolbar"
( L ) and compatible programs,
and its values are Node Description objects. (see "The Node Description
Class" below). Here's a sample code that renders the links as
Clink rel=...E> into the page header:
my $nav_links = $results->{'nav_links_obj'};
# Sort the keys so their order will be preserved
my @keys = (sort { $a cmp $b } keys(%$nav_links));
foreach my $key (@keys)
{
my $value = $nav_links->{$key};
my $url = CGI::escapeHTML($value->direct_url());
my $title = CGI::escapeHTML($value->title());
print {$fh} "\n";
}
=item 'nav_links'
This points to a hash reference whose keys are link IDs compatible with the
Firefox Site Navigation ( L ) and its
values are the URLs to these links. This key/value pair is provided for
backwards compatibility with older versions of HTML::Widgets::NavMenu. In new
code, one is recommended to use C<'nav_links_obj'> instead.
This sample code renders the links as Clink rel=...E> into the
page header:
my $nav_links = $results->{'nav_links'};
# Sort the keys so their order will be preserved
my @keys = (sort { $a cmp $b } keys(%$nav_links));
foreach my $key (@keys)
{
my $url = $nav_links->{$key};
print {$fh} "\n";
}
=back
=head2 $results = $nav_menu->render_jquery_treeview()
Renders a fully expanded tree suitable for input to JQuery's treeview plugin:
L - otherwise
the same as render() .
=head2 $text = $nav_menu->gen_site_map()
This function can be called to generate a site map based on the tree of
contents. It returns a reference to an array containing the tags of the
site map.
=head2 $url = $nav_menu->get_cross_host_rel_url_ref({...})
This function can be called to calculate a URL to a different part of the
site. It accepts four named arguments, passed as a hash-ref:
=over 8
=item 'host'
This is the host ID
=item 'host_url'
This is URL within the host.
=item 'url_type'
C<'rel'>, C<'full_abs'> or C<'site_abs'>.
=item 'url_is_abs'
A flag that indicates if C<'host_url'> is already absolute.
=back
=head2 $url = $nav_menu->get_cross_host_rel_url(...)
This is like get_cross_host_rel_url_ref() except that the arguments
are clobbered into the arguments list. It is kept here for compatibility
sake.
=begin comment
sub get_rel_url_from_coords
{
my $self = shift;
my $coords = shift;
my ($ptr,$host);
my $iterator = $self->_get_nav_menu_traverser();
my $node_ret = $iterator->find_node_by_coords($coords);
my $item = $node_ret->{'item'};
return $self->_get_url_to_item($item);
}
=end comment
=head1 The Input Tree of Contents
The input tree is a nested Perl data structure that represnets the tree
of the site. Each node is respresented as a Perl hash reference, with its
sub-nodes contained in an array reference of its C<'subs'> value. A
non-existent C<'subs'> means that the node is a leaf and has no sub-nodes.
The top-most node is mostly a dummy node, that just serves as the father
of all other nodes.
Following is a listing of the possible values inside a node hash and what
their respective values mean.
=over 4
=item 'host'
This is the host-ID of the host as found in the C<'hosts'> key to the
navigation menu object constructor. It implicitly propagates downwards in the
tree. (i.e: all nodes of the sub-tree spanning from the node will implicitly
have it as their value by default.)
Generally, a host must always be specified and so the first node should
specify it.
=item 'url'
This contains the URL of the node within the host. The URL should not
contain a leading slash. This value does not propagate further.
The URL should be specified for every nodes except separators and the such.
=item 'text'
This is the text that will be presented to the user as the text of the
link inside the navigation bar. E.g.: if C<'text'> is "Hi There", then the
link will look something like this:
Hi There
Or
Hi There
if it's the current page. Not that this text is rendered into HTML
as is, and so should be escaped to prevent HTML-injection attacks.
=item 'title'
This is the text of the link tag's title attribute. It is also not
processed and so the user of the module should make sure it is escaped
if needed, to prevent HTML-injection attacks. It is optional, and if not
specified, no title will be presented.
=item 'subs'
This item, if specified, should point to an array reference containing the
sub-nodes of this item, in order.
=item 'separator'
This key if specified and true indicate that the item is a separator, which
should just leave a blank line in the HTML. It is best to accompany it with
C<'skip'> (see below).
If C<'separator'> is specified, it is usually meaningless to specify all
other node keys except C<'skip'>.
=item 'skip'
This key if true, indicates that the node should be skipped when traversing
site using the Mozilla navigation links. Instead the navigation will move
to the next or previous nodes.
=item 'hide'
This key if true indicates that the item should be part of the site's flow
and site map, but not displayed in the navigation menu.
=item 'role'
This indicates a role of an item. It is similar to a CSS class, or to
DocBook's "role" attribute, only induces different HTML markup. The vanilla
HTML::Widgets::NavMenu does not distinguish between any roles, but see
L.
=item 'expand'
This specifies a predicate (a Perl value that is evaluated to a boolean
value, see "Predicate Values" below.) to be matched against the path and
current host to determine if the navigation menu should be expanded at this
node. If it does, all of the nodes up to it will expand as well.
=item 'show_always'
This value if true, indicates that the node and all nodes below it (until
'show_always' is explicitly set to false) must be always displayed. Its
function is similar to C<'expand_re'> but its propagation semantics the
opposite.
=item 'url_type'
This specifies the URL type to use to render this item. It can be:
1. C<"rel"> - the default. This means a fully relative URL (if possible), like
C<"../../me/about.html">.
2. C<"site_abs"> - this uses a URL absolute to the site, using a slash at
the beginning. Like C<"/~shlomif/me/about.html">. For this to work the current
host needs to have a C<'trailing_url_base'> value set.
3. C<"full_abs"> - this uses a fully qualified URL (e.g: with C at
the beginning, even if both the current path and the pointed path belong
to the same host. Something like C.
=item 'rec_url_type'
This is similar to C<'url_type'> only it recurses, to the sub-tree of the
node. If both C<'url_type'> and C<'rec_url_type'> are specified for a node,
then the value of C<'url_type'> will hold.
=item 'url_is_abs'
This flag, if true, indicates that the URL specified by the C<'url'> key
is an absolute URL like C and should not be
treated as a path within the site. All links to the page associated with
this node will contain the URL verbatim.
Note that using absolute URLs as part of the site flow is discouraged
because once they are accessed, the navigation within the primary site
is lost. A better idea would be to create a separate page within the
site, that will link to the external URL.
=item li_id
This is the HTML ID attribute that will be assigned to the specific
C<<
>> tag of the navigation menu. So if you have:
'tree_contents' =>
{
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'expand_re' => "",
'subs' =>
[
{
'text' => "Home",
'url' => "",
},
{
'text' => "About Me",
'title' => "About Myself",
'url' => "me/",
'li_id' => 'about_me',
},
],
},
Then the HTML for the About me will look something like:
=back
=head1 Predicate Values
An explicitly specified predicate value is a hash reference that contains
one of the following three keys with their appropriate values:
=over 4
=item 'cb' => \&predicate_func
This specifies a sub-routine reference (or "callback" or "cb"), that will be
called to determine the result of the predicate. It accepts two named arguments
- C<'path_info'> which is the path of the current page (without the leading
slash) and C<'current_host'> which is the ID of the current host.
Here is an example for such a callback:
sub predicate_cb1
{
my %args = (@_);
my $host = $args{'current_host'};
my $path = $args{'path_info'};
return (($host eq "true") && ($path eq "mypath/"));
}
=item 're' => $regexp_string
This specifies a regular expression to be matched against the path_info
(regardless of what current_host is), to determine the result of the
predicate.
=item 'bool' => [ 0 | 1 ]
This specifies the constant boolean value of the predicate.
=back
Note that if C<'cb'> is specified then both C<'re'> and C<'bool'> will
be ignored, and C<'re'> over-rides C<'bool'>.
Orthogonal to these keys is the C<'capt'> key which specifies whether this
expansion "captures" or not. This is relevant to the behaviour in the
breadcrumbs' trails, if one wants the item to appear there or not. The
default value is true.
If the predicate is not a hash reference, then HTML::Widgets::NavMenu will
try to guess what it is. If it's a sub-routine reference, it will be an
implicit callback. If it's one of the values C<"0">, C<"1">, C<"yes">,
C<"no">, C<"true">, C<"false">, C<"True">, C<"False"> it will be considered
a boolean. If it's a different string, a regular expression match will
be attempted. Else, an excpetion will be thrown.
Here are some examples for predicates:
# Always expand.
'expand' => { 'bool' => 1, };
# Never expand.
'expand' => { 'bool' => 0, };
# Expand under home/
'expand' => { 're' => "^home/" },
# Expand under home/ when the current host is "foo"
sub expand_path_home_host_foo
{
my %args = (@_);
my $host = $args{'current_host'};
my $path = $args{'path_info'};
return (($host eq "foo") && ($path =~ m!^home/!));
}
'expand' => { 'cb' => \&expand_path_home_host_foo, },
=head1 The Node Description Class
When retrieving the leading path or the C, an array of objects
is returned. This section describes the class of these objects, so one will
know how to use them.
Basically, it is an object that has several accessors. The accessors are:
=over 4
=item host
The host ID of this node.
=item host_url
The URL of the node within the host. (one given in its 'url' key).
=item label
The label of the node. (one given in its 'text' key). This is not
SGML-escaped.
=item title
The title of the node. (that can be assigned to the URL 'title' attribute).
This is not SGML-escaped.
=item direct_url
A direct URL (usable for inclusion in an A tag ) from the current page to this
page.
=item url_type
This is the C (see above) that holds for this node.
=back
=head1 SEE ALSO
See the article Shlomi Fish wrote for Perl.com for a gentle introduction to
HTML-Widgets-NavMenu:
L
=over 4
=item L
An HTML::Widgets::NavMenu sub-class that contains support for another
role. Used for the navigation menu in L.
=item L
A module written by Yosef Meller for maintaining a navigation menu.
HTML::Widgets::NavMenu originally utilized it, but no longer does. This module
does not makes links relative on its own, and tends to generate a lot of
JavaScript code by default. It also does not have too many automated test
scripts.
=item L
A module by Don Owens for generating hierarchical HTML menus. I could not
quite understand its tree traversal semantics, so I ended up not using it.
It also seems to require that each of the tree nodes will have a unique ID.
=item L
This module also generates a navigation menu. The CPAN version is relatively
old, and the author sent me a newer version. After playing with it a bit, I
realized that I could not get it to do what I want (but I cannot recall
why), so I abandoned it.
=back
=head1 AUTHORS
Shlomi Fish, Eshlomif@cpan.orgE, L .
=head1 THANKS
Thanks to Yosef Meller (L) for writing
the module HTML::Widget::SideBar on which initial versions of these modules
were based. (Albeit his code is no longer used here.)
=head1 COPYRIGHT AND LICENSE
Copyright 2004, Shlomi Fish. All rights reserved.
You can use, modify and distribute this module under the terms of the MIT Expat
license. ( L ).
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
trailing-space.t 100644 000764 000764 1034 14247414065 23037 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/xt/release #!perl
use strict;
use warnings;
use Test::More;
eval "use Test::TrailingSpace";
if ($@)
{
plan skip_all => "Test::TrailingSpace required for trailing space test.";
}
else
{
plan tests => 1;
}
# TODO: add .pod, .PL, the README/Changes/TODO/etc. documents and possibly
# some other stuff.
my $finder = Test::TrailingSpace->new(
{
root => '.',
filename_regex => qr#(?:\.(?:t|pm|pl|xs|c|h|txt|pod|PL)|README|Changes|TODO|LICENSE)\z#,
},
);
# TEST
$finder->no_trailing_space(
"No trailing space was found."
);
NavMenu 000755 000764 000764 0 14247414065 22030 5 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets Url.pm 100644 000764 000764 13442 14247414065 23314 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu package HTML::Widgets::NavMenu::Url;
$HTML::Widgets::NavMenu::Url::VERSION = '1.1000';
use strict;
use warnings;
use parent 'HTML::Widgets::NavMenu::Object';
__PACKAGE__->mk_acc_ref(
[
qw(
_url
_is_dir
_mode
)
]
);
sub _init
{
my $self = shift;
my ( $url, $is_dir, $mode ) = @_;
# TODO - extract a method.
$self->_url(
( ref($url) eq "ARRAY" )
? [@$url]
: [ split( /\//, $url ) ]
);
$self->_is_dir( $is_dir || 0 );
$self->_mode( $mode || 'server' );
return 0;
}
sub _get_url
{
my $self = shift;
return [ @{ $self->_url() } ];
}
sub _get_relative_url
{
my $base = shift;
my $url = $base->_get_url_worker(@_);
return ( ( $url eq "" ) ? "./" : $url );
}
sub _get_url_worker
{
my $base = shift;
my $to = shift;
my $slash_terminated = shift;
my $no_leading_dot = shift;
my $prefix = ( $no_leading_dot ? "" : "./" );
my @this_url = @{ $base->_get_url() };
my @other_url = @{ $to->_get_url() };
my $ret;
my @this_url_bak = @this_url;
my @other_url_bak = @other_url;
while (scalar(@this_url)
&& scalar(@other_url)
&& ( $this_url[0] eq $other_url[0] ) )
{
shift(@this_url);
shift(@other_url);
}
if ( ( !@this_url ) && ( !@other_url ) )
{
if ( ( !$base->_is_dir() ) ne ( !$to->_is_dir() ) )
{
die "Two identical URLs with non-matching _is_dir()'s";
}
if ( !$base->_is_dir() )
{
if ( scalar(@this_url_bak) )
{
return $prefix . $this_url_bak[-1];
}
else
{
die "Root URL is not a directory";
}
}
}
if ( ( $base->_mode() eq "harddisk" ) && ( $to->_is_dir() ) )
{
push @other_url, "index.html";
}
$ret = "";
if ($slash_terminated)
{
if ( ( scalar(@this_url) == 0 ) && ( scalar(@other_url) == 0 ) )
{
$ret = $prefix;
}
else
{
if ( !$base->_is_dir() )
{
pop(@this_url);
}
$ret .= join( "/", ( map { ".." } @this_url ), @other_url );
if ( $to->_is_dir() && ( $base->_mode() ne "harddisk" ) )
{
$ret .= "/";
}
}
}
else
{
my @components =
( ( map { ".." } @this_url[ 1 .. $#this_url ] ), @other_url );
$ret .= ( $prefix . join( "/", @components ) );
if ( ( $to->_is_dir() )
&& ( $base->_mode() ne "harddisk" )
&& scalar(@components) )
{
$ret .= "/";
}
}
#if (($to->_is_dir()) && (scalar(@other_url) || $slash_terminated))
return $ret;
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
HTML::Widgets::NavMenu::Url - URL manipulation class.
=head1 VERSION
version 1.1000
=head1 SYNOPSIS
For internal use only.
=head1 METHODS
=head1 COPYRIGHT & LICENSE
Copyright 2006 Shlomi Fish, all rights reserved.
This program is released under the following license: MIT X11.
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
Error.pm 100644 000764 000764 5554 14247414065 23630 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu package HTML::Widgets::NavMenu::Error;
$HTML::Widgets::NavMenu::Error::VERSION = '1.1000';
use strict;
use warnings;
use parent "HTML::Widgets::NavMenu::Object";
1;
__END__
=pod
=encoding UTF-8
=head1 VERSION
version 1.1000
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
Object.pm 100644 000764 000764 10570 14247414065 23757 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu package HTML::Widgets::NavMenu::Object;
$HTML::Widgets::NavMenu::Object::VERSION = '1.1000';
use strict;
use warnings;
use Class::XSAccessor ();
sub new
{
my $class = shift;
my $self = {};
bless $self, $class;
$self->_init(@_);
return $self;
}
sub _init
{
my $self = shift;
return 0;
}
sub destroy_
{
my $self = shift;
return 0;
}
sub DESTROY
{
my $self = shift;
$self->destroy_();
}
sub mk_accessors
{
my $package = shift;
return $package->mk_acc_ref( [@_] );
}
sub mk_acc_ref
{
my $package = shift;
my $names = shift;
my $mapping = +{ map { $_ => $_ } @$names };
## no critic
eval <<"EOF";
package $package;
Class::XSAccessor->import(
accessors => \$mapping,
);
EOF
## use critic
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
HTML::Widgets::NavMenu::Object - a base object for HTML::Widgets::NavMenu
=head1 VERSION
version 1.1000
=head1 SYNOPSIS
For internal use only
=head2 __PACKAGE__->mk_accessors(qw(method1 method2 method3))
Equivalent to L's mk_accessors only using Class::XSAccessor.
It beats running an ugly script on my code, and can be done at run-time.
Gotta love dynamic languages like Perl 5.
=head2 __PACKAGE__->mk_acc_ref([qw(method1 method2 method3)])
Creates the accessors in the array-ref of names at run-time.
=head1 FUNCTIONS
=head2 my $obj = HTML::Widgets::NavMenu::Object->new(@args)
Instantiates a new object. Calls C<$obj-E_init()> with C<@args>.
=head2 my $obj = HTML::Widgets::NavMenu::Object->destroy_();
A method that can be used to explicitly destroy an object.
=head1 COPYRIGHT & LICENSE
Copyright 2006 Shlomi Fish, all rights reserved.
This program is released under the following license: MIT X11.
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
TagGen.pm 100644 000764 000764 10015 14247414065 23710 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu package HTML::Widgets::NavMenu::TagGen;
$HTML::Widgets::NavMenu::TagGen::VERSION = '1.1000';
use strict;
use warnings;
use parent 'HTML::Widgets::NavMenu::Object';
use HTML::Widgets::NavMenu::EscapeHtml qw/ escape_html /;
__PACKAGE__->mk_acc_ref( [qw(name attributes)] );
sub _init
{
my ( $self, $args ) = @_;
$self->name( $args->{'name'} );
$self->attributes( $args->{'attributes'} );
return 0;
}
sub gen
{
my $self = shift;
my $attr_values = shift;
my $is_standalone = shift || 0;
my @tag_list = keys(%$attr_values);
@tag_list = ( grep { defined( $attr_values->{$_} ) } @tag_list );
@tag_list = ( sort { $a cmp $b } @tag_list );
my $attr_spec = $self->attributes();
return "<" . $self->name() . join(
"",
map {
" $_=\""
. (
$attr_spec->{$_}->{'escape'}
? escape_html( $attr_values->{$_} )
: $attr_values->{$_}
)
. "\""
} @tag_list
) . ( $is_standalone ? " /" : "" ) . ">";
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
HTML::Widgets::NavMenu::TagGen - class to generate tags.
=head1 VERSION
version 1.1000
=head1 SYNOPSIS
For internal use only.
=head1 METHODS
=head2 name
For internal use.
=head2 attributes
For internal use.
=head2 $self->gen($attribute_values, $is_standalone)
Generate the tag.
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
ExpandVal.pm 100644 000764 000764 7243 14247414065 24416 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu package HTML::Widgets::NavMenu::ExpandVal;
$HTML::Widgets::NavMenu::ExpandVal::VERSION = '1.1000';
use strict;
use warnings;
use parent 'HTML::Widgets::NavMenu::Object';
__PACKAGE__->mk_acc_ref( [qw(_capture)], );
sub _init
{
my ( $self, $args ) = @_;
$self->_capture( $args->{'capture'} );
return 0;
}
sub is_capturing
{
my $self = shift;
return $self->_capture();
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
HTML::Widgets::NavMenu::ExpandVal - an expand value that differentiates among
different expands
For internal use only.
=head1 VERSION
version 1.1000
=head1 SYNOPSIS
my $expand_val = HTML::Widgets::NavMenu::ExpandVal->new('capture' => $bool);
=head1 FUNCTIONS
=head2 my $expand_val = HTML::Widgets::NavMenu::ExpandVal->new('capture' => $bool);
Creates a new object.
=head2 $expand_val->is_capturing()
Returns whether or not it is a capturing expansion.
=head1 COPYRIGHT & LICENSE
Copyright 2006 Shlomi Fish, all rights reserved.
This program is released under the following license: MIT X11.
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
Predicate.pm 100644 000764 000764 14625 14247414065 24456 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu package HTML::Widgets::NavMenu::Predicate;
$HTML::Widgets::NavMenu::Predicate::VERSION = '1.1000';
use strict;
use warnings;
use parent 'HTML::Widgets::NavMenu::Object';
__PACKAGE__->mk_acc_ref( [qw(type bool regexp callback _capture)], );
use HTML::Widgets::NavMenu::ExpandVal;
sub _init
{
my $self = shift;
my %args = (@_);
my $spec = $args{'spec'};
$self->_process_spec($spec);
return 0;
}
my %true_vals = ( map { $_ => 1 } (qw(1 yes true True)) );
sub _is_true_bool
{
my $self = shift;
my $val = shift;
return exists( $true_vals{$val} );
}
my %false_vals = ( map { $_ => 1 } (qw(0 no false False)) );
sub _is_false_bool
{
my $self = shift;
my $val = shift;
return exists( $false_vals{$val} );
}
sub _get_normalized_spec
{
my $self = shift;
my $spec = shift;
if ( ref($spec) eq "HASH" )
{
return $spec;
}
if ( ref($spec) eq "CODE" )
{
return +{ 'cb' => $spec };
}
if ( $self->_is_true_bool($spec) )
{
return +{ 'bool' => 1, };
}
if ( $self->_is_false_bool($spec) )
{
return +{ 'bool' => 0, };
}
# Default to regular expression
if ( ref($spec) eq "" )
{
return +{ 're' => $spec, };
}
die "Unknown spec type!";
}
sub _process_spec
{
my $self = shift;
my $spec = shift;
# TODO: Replace me with the real logic.
$self->_assign_spec( $self->_get_normalized_spec( $spec, ), );
}
sub _assign_spec
{
my $self = shift;
my $spec = shift;
if ( exists( $spec->{'cb'} ) )
{
$self->type("callback");
$self->callback( $spec->{'cb'} );
}
elsif ( exists( $spec->{'re'} ) )
{
$self->type("regexp");
$self->regexp( $spec->{'re'} );
}
elsif ( exists( $spec->{'bool'} ) )
{
$self->type("bool");
$self->bool( $spec->{'bool'} );
}
else
{
die "Neither 'cb' nor 're' nor 'bool' were specified in the spec.";
}
$self->_capture( ( ( !exists( $spec->{capt} ) ) ? 1 : $spec->{capt} ) );
}
sub _evaluate_bool
{
my ( $self, $args ) = @_;
my $path_info = $args->{'path_info'};
my $current_host = $args->{'current_host'};
my $type = $self->type();
if ( $type eq "callback" )
{
return $self->callback()->(%$args);
}
elsif ( $type eq "bool" )
{
return $self->bool();
}
else # $type eq "regexp"
{
my $re = $self->regexp();
return ( ( $re eq "" ) || ( $path_info =~ /$re/ ) );
}
}
sub evaluate
{
my $self = shift;
my $bool = $self->_evaluate_bool( {@_} );
if ( !$bool )
{
return $bool;
}
else
{
return HTML::Widgets::NavMenu::ExpandVal->new(
{
capture => $self->_capture()
},
);
}
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
HTML::Widgets::NavMenu::Predicate - a predicate object for
HTML::Widgets::NavMenu
=head1 VERSION
version 1.1000
=head1 SYNOPSIS
my $pred = HTML::Widgets::NavMenu::Predicate->new('spec' => $spec);
=head1 FUNCTIONS
=head2 my $pred = HTML::Widgets::NavMenu::Predicate->new('spec' => $spec)
Creates a new object.
=head2 $pred->evaluate( 'path_info' => $path_info, 'current_host' => $current_host )
Evaluates the predicate in the context of C<$path_info> and C<$current_host>
and returns the result.
=head2 $pred->type()
The type of the predicate.
=head2 $pred->bool()
Sets/gets the boolean value in case the type is a boolean.
=head2 $pred->callback()
Sets/gets the callback in case the type is callback.
=head2 $pred->regexp()
Sets/gets the regular expression in case the type is "regexp".
=head1 COPYRIGHT & LICENSE
Copyright 2006 Shlomi Fish, all rights reserved.
This program is released under the following license: MIT X11.
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
Tree 000755 000764 000764 0 14247414065 22727 5 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu Node.pm 100644 000764 000764 14731 14247414065 24340 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu/Tree package HTML::Widgets::NavMenu::Tree::Node;
$HTML::Widgets::NavMenu::Tree::Node::VERSION = '1.1000';
use strict;
use warnings;
use parent 'HTML::Widgets::NavMenu::Object';
__PACKAGE__->mk_acc_ref(
[
qw(
CurrentlyActive expanded hide host li_id role rec_url_type
separator show_always skip subs text title url url_is_abs url_type
)
]
);
use HTML::Widgets::NavMenu::ExpandVal ();
sub _init
{
my $self = shift;
$self->subs( [] );
return $self;
}
sub expand
{
my $self = shift;
my $v =
@_
? ( shift(@_) )
: HTML::Widgets::NavMenu::ExpandVal->new( { capture => 1 } );
# Don't set it to something if it's already capture_expanded(),
# otherwise it can set as a non-capturing expansion.
if ( !$self->capture_expanded() )
{
$self->expanded($v);
}
return 0;
}
sub mark_as_current
{
my $self = shift;
$self->expand();
$self->CurrentlyActive(1);
return 0;
}
sub _process_new_sub
{
my $self = shift;
my $sub = shift;
$self->update_based_on_sub($sub);
}
sub update_based_on_sub
{
my $self = shift;
my $sub = shift;
if ( my $expand_val = $sub->expanded() )
{
$self->expand($expand_val);
}
}
sub add_sub
{
my $self = shift;
my $sub = shift;
push( @{ $self->subs }, $sub );
$self->_process_new_sub($sub);
return 0;
}
sub get_nth_sub
{
my $self = shift;
my $idx = shift;
return $self->subs()->[$idx];
}
sub _num_subs
{
my $self = shift;
return scalar( @{ $self->subs() } );
}
sub list_regular_keys
{
my $self = shift;
return (
qw(host li_id rec_url_type role show_always text title url url_type));
}
sub list_boolean_keys
{
my $self = shift;
return (qw(hide separator skip url_is_abs));
}
sub set_values_from_hash_ref
{
my $self = shift;
my $sub_contents = shift;
foreach my $key ( $self->list_regular_keys() )
{
if ( exists( $sub_contents->{$key} ) )
{
$self->$key( $sub_contents->{$key} );
}
}
foreach my $key ( $self->list_boolean_keys() )
{
if ( $sub_contents->{$key} )
{
$self->$key(1);
}
}
}
sub capture_expanded
{
my $self = shift;
if ( my $e = $self->expanded() )
{
return $e->is_capturing();
}
else
{
return;
}
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
HTML::Widgets::NavMenu::Tree::Node - an iterator for HTML.
=head1 VERSION
version 1.1000
=head1 SYNOPSIS
For internal use only.
=head1 METHODS
=head2 CurrentlyActive
Internal use.
=head2 expanded
Internal use.
=head2 CurrentlyActive
Internal use.
=head2 hide
Internal use.
=head2 host
Internal use.
=head2 li_id
Internal use.
=head2 role
Internal use.
=head2 rec_url_type
Internal use.
=head2 separator
Internal use.
=head2 show_always
Internal use.
=head2 skip
Internal use.
=head2 subs
Internal use.
=head2 text
Internal use.
=head2 title
Internal use.
=head2 url
Internal use.
=head2 url_is_abs
Internal use.
=head2 url_type
Internal use.
=head2 $self->expand()
Expands the node.
=head2 $self->mark_as_current()
Marks the node as the current node.
=head2 $self->update_based_on_sub
Propagate changes.
=head2 $self->add_sub()
Adds a new subroutine.
=head2 $self->get_nth_sub($idx)
Get the $idx sub.
=head2 $self->list_regular_keys()
Customisation to list the regular keys.
=head2 $self->list_boolean_keys()
Customisation to list the boolean keys.
=head2 $self->set_values_from_hash_ref($hash)
Set the values from the hash ref.
=head2 my $bool = $self->capture_expanded()
Tests whether the node is expanded and in a capturing way.
=head1 COPYRIGHT & LICENSE
Copyright 2006 Shlomi Fish, all rights reserved.
This program is released under the following license: MIT X11.
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
HeaderRole.pm 100644 000764 000764 10000 14247414065 24547 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu package HTML::Widgets::NavMenu::HeaderRole;
$HTML::Widgets::NavMenu::HeaderRole::VERSION = '1.1000';
use strict;
use warnings;
use parent 'HTML::Widgets::NavMenu';
require HTML::Widgets::NavMenu::Iterator::NavMenu::HeaderRole;
sub _get_nav_menu_traverser
{
my $self = shift;
return HTML::Widgets::NavMenu::Iterator::NavMenu::HeaderRole->new(
$self->_get_nav_menu_traverser_args() );
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
HTML::Widgets::NavMenu::HeaderRole - A Specialized HTML::Widgets::NavMenu
sub-class
=head1 VERSION
version 1.1000
=head1 DESCRIPTION
This module is constructed and invoked similarly to HTML::Widgets::NavMenu.
The only difference is that it is meaningful to specify C<"header"> as the
value of the C<'role'>.
In that case, the link or bolded label will be rendered within its own
Ch2E> header. The HTML will look something like this:
An example of this use can be found on the Perl Beginners Site
( L ).
=head1 SYNOPOSIS
Mostly the same as L except for the ability to
specify C<'role' =E "header"> as one of the node attributes.
=head1 SEE ALSO
L for the complete documentation of the super-class.
=head1 AUTHORS
Shlomi Fish, L .
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
EscapeHtml.pm 100644 000764 000764 6745 14247414065 24567 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu package HTML::Widgets::NavMenu::EscapeHtml;
$HTML::Widgets::NavMenu::EscapeHtml::VERSION = '1.1000';
use strict;
use warnings;
use parent qw(Exporter);
use vars qw(@EXPORT_OK);
@EXPORT_OK = (qw(escape_html));
sub escape_html
{
my $string = shift;
$string =~ s{&}{&}gso;
$string =~ s{<}{<}gso;
$string =~ s{>}{>}gso;
$string =~ s{"}{"}gso;
return $string;
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
HTML::Widgets::NavMenu::EscapeHtml - provides a function to escape HTML.
=head1 VERSION
version 1.1000
=head1 SYNOPSIS
use HTML::Widgets::NavMenu::EscapeHtml qw/ escape_html /;
my $escaped_html = escape_html($html);
=head2 escape_html()
Escapes the HTML.
=head1 COPYRIGHT & LICENSE
Copyright 2006 Shlomi Fish, all rights reserved.
This program is released under the following license: MIT X11.
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
Test 000755 000764 000764 0 14247414065 23212 5 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/t/lib/HTML/Widgets/NavMenu Util.pm 100644 000764 000764 1436 14247414065 24631 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/t/lib/HTML/Widgets/NavMenu/Test package HTML::Widgets::NavMenu::Test::Util;
use strict;
use warnings;
use Exporter;
use vars qw(@ISA);
@ISA = qw(Exporter);
use vars qw(@EXPORT);
@EXPORT = qw(compare_string_arrays);
sub compare_string_arrays
{
my $arr1 = shift;
my $arr2 = shift;
my $len_cmp = ( @$arr1 <=> @$arr2 );
if ($len_cmp)
{
print STDERR "Len is not the same: Expected "
. scalar(@$arr1)
. " vs. Result "
. scalar(@$arr2) . "\n";
return $len_cmp;
}
for my $i ( keys @$arr1 )
{
my $item_cmp = $arr1->[$i] cmp $arr2->[$i];
if ($item_cmp)
{
print STDERR
"Item[$i] is not the same:\nExpected: $arr1->[$i]\nResult: $arr2->[$i]\n";
return $item_cmp;
}
}
return 0;
}
1;
Data.pm 100644 000764 000764 72613 14247414065 24612 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/t/lib/HTML/Widgets/NavMenu/Test package HTML::Widgets::NavMenu::Test::Data;
use strict;
use warnings;
use Exporter;
use vars qw(@ISA);
@ISA = qw(Exporter);
use vars qw(@EXPORT);
@EXPORT = qw(get_test_data);
my @minimal_nav_menu = (
'current_host' => "default",
'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, },
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "About Me",
'title' => "About Myself",
'url' => "me/",
},
],
},
);
my @two_sites_data = (
'current_host' => "default",
'hosts' => {
'default' => {
'base_url' => "http://www.hello.com/",
},
'other' => {
'base_url' => "http://www.other-url.co.il/~shlomif/",
},
},
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "About Me",
'title' => "About Myself",
'url' => "me/",
'subs' => [
{
'url' => "round/hello/personal.html",
'text' => "Bio",
'title' => "Biography of Myself",
},
{
'url' => "round/toto/",
'text' => "Gloria",
'title' => "A Useful Conspiracy",
},
],
},
{
'text' => "Tam Tam Drums",
'title' => "Drumming is good for your health",
'url' => "hoola/",
'host' => "other",
'subs' => [
{
'url' => "hello/hoop.html",
'title' => "Hoola Hoops Rulez and Ownz!",
'text' => "Hoola Hoops",
'host' => "default",
},
{
'url' => "tetra/",
'text' => "Tetrahedron",
'subs' => [
{
'url' => "tetra/one/",
'text' => "Tetra One",
'title' => "Tetra One Title",
},
],
},
],
},
],
},
);
my @expand_re_nav_menu = (
'current_host' => "default",
'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, },
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "About Me",
'title' => "About Myself",
'url' => "me/",
},
{
'text' => "Foo",
'title' => "Fooish",
'url' => "foo/",
'subs' => [
{
'text' => "Expanded",
'title' => "Expanded",
'url' => "foo/expanded/",
'expand' => { 're' => "", },
},
],
}
],
},
);
my @show_always_nav_menu = (
'current_host' => "default",
'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, },
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "About Me",
'title' => "About Myself",
'url' => "me/",
},
{
'text' => "Show Always",
'url' => "show-always/",
'show_always' => 1,
'subs' => [
{
'text' => "Gandalf",
'url' => "show-always/gandalf/",
},
{
'text' => "Robin",
'url' => "robin/",
'subs' => [
{
'text' => "Hood",
'url' => "robin/hood/",
},
],
},
{
'text' => "Queen Esther",
'url' => "esther/",
'subs' => [
{
'text' => "Haman",
'url' => "haman/",
},
],
},
],
},
],
},
);
my @items_in_sub_nav_menu = (
'current_host' => "default",
'hosts' => {
'default' => {
'base_url' => "http://www.hello.com/",
},
},
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "About Me",
'title' => "About Myself",
'url' => "me/",
'subs' => [
{
'url' => "me/bio.html",
'text' => "Bio",
'title' => "Biography of Myself",
},
{
'url' => "me/gloria/",
'text' => "Gloria",
'title' => "A Useful Conspiracy",
},
],
},
{
'text' => "Tam Tam Drums",
'title' => "Drumming is good for your health",
'url' => "hoola/",
},
],
},
);
my @separator_nav_menu = (
'current_host' => "default",
'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, },
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "About Me",
'title' => "About Myself",
'url' => "me/",
'subs' => [
{
'text' => "Group Hug",
'url' => "me/group-hug/",
},
{
'text' => "Cool I/O",
'url' => "me/cool-io/",
},
{
'separator' => 1,
'skip' => 1,
},
{
'text' => "Resume",
'url' => "resume.html",
},
],
},
{
'separator' => 1,
'skip' => 1,
},
{
'text' => "Halifax",
'url' => "halifax/",
},
],
},
);
my @hidden_item_nav_menu = (
'current_host' => "default",
'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, },
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "About Me",
'title' => "About Myself",
'url' => "me/",
'subs' => [
{
'text' => "Visible",
'url' => "me/visible/",
},
{
'text' => "Hidden",
'url' => "me/hidden/",
'hide' => 1,
},
{
'text' => "Visible Too",
'url' => "me/visible-too/",
},
],
},
],
},
);
my @with_ids_nav_menu = (
'current_host' => "default",
'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, },
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "About Me",
'title' => "About Myself",
'url' => "me/",
li_id => "about_me",
'subs' => [
{
'text' => "Visible",
'url' => "me/visible/",
li_id => "visible",
},
{
'text' => "Hidden",
'url' => "me/hidden/",
'hide' => 1,
},
{
'text' => "Visible Too",
'url' => "me/visible-too/",
li_id => "FooBar",
},
],
},
],
},
);
my @header_role_nav_menu = (
'current_host' => "default",
'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, },
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "About Me",
'title' => "About Myself",
'url' => "me/",
'role' => "header",
'show_always' => 1,
'subs' => [
{
'text' => "Sub Me",
'url' => "me/sub-me1/",
},
{
'text' => "Sub Me 2",
'url' => "me/sub-me-two/",
},
],
},
{
'text' => "Hello",
'url' => "aloha/",
'show_always' => 1,
'role' => "notexist",
'subs' => [
{
'text' => "OBKB",
'url' => "aloha/obkb/",
},
],
},
],
},
);
my @selective_expand_nav_menu = (
'current_host' => "default",
'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, },
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "About Me",
'title' => "About Myself",
'url' => "me/",
'expand' => { 're' => "^me/", },
'subs' => [
{
'text' => "Group Hug",
'url' => "me/group-hug/",
},
{
'text' => "Cool I/O",
'url' => "me/cool-io/",
},
{
'text' => "Resume",
'url' => "resume.html",
},
],
},
{
'text' => "Halifax",
'url' => "halifax/",
},
{
'text' => "Software",
'title' => "Open Source Software I Wrote",
'url' => "open-source/",
'expand' => { 're' => "^open-source/", },
'subs' => [
{
'text' => "Fooware",
'url' => "open-source/fooware/",
},
{
'text' => "Condor-Man",
'title' => "Kwalitee",
'url' => "open-source/condor-man/",
},
],
},
],
},
);
my @url_type_menu = (
'current_host' => "default",
'hosts' => {
'default' => {
'base_url' => "http://www.hello.com/",
'trailing_url_base' => "/",
},
},
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "About Me",
'title' => "About Myself",
'url' => "me/",
'url_type' => "site_abs",
},
{
'text' => "Yowza",
'url' => "yowza/",
'url_type' => "full_abs",
},
],
},
);
my @rec_url_type_menu = (
'current_host' => "default",
'hosts' => {
'default' => {
'base_url' => "http://www.hello.com/~shlomif/",
'trailing_url_base' => "/~shlomif/",
},
},
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'rec_url_type' => "full_abs",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "About Me",
'title' => "About Myself",
'url' => "me/",
'url_type' => "site_abs",
},
{
'text' => "Hoola",
'url' => "tedious/to/write/",
},
{
'text' => "Yowza",
'url' => "yowza/",
'url_type' => "rel",
'show_always' => 1,
'subs' => [
{
'url' => "yowza/howza/",
'text' => "This should be full_abs again",
},
],
},
],
},
);
my @url_is_abs_nav_menu = (
'current_host' => "default",
'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, },
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "Link to Google",
'title' => "Google it!",
'url' => "http://www.google.com/",
'url_is_abs' => 1,
'expand' => { 'bool' => 0, },
'subs' => [
{
'url' => "sub-dir/",
'text' => "Sub Directory",
},
],
},
],
},
);
sub mixed_expand_nav_menu_cb1
{
my %args = (@_);
my $host = $args{'current_host'};
my $path_info = $args{'path_info'};
return ( ( $host eq "other" ) && ( $path_info =~ m!^open-source/! ) );
}
sub mixed_expand_nav_menu_cb2
{
my %args = (@_);
my $host = $args{'current_host'};
my $path_info = $args{'path_info'};
return ( ( $host eq "default" ) && ( $path_info =~ m!^me/! ) );
}
my @mixed_expand_nav_menu = (
'hosts' => {
'default' => { 'base_url' => "http://www.default.net/", },
'other' => { 'base_url' => "http://www.other.org/", },
},
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "About Me",
'title' => "About Myself",
'url' => "me/",
'expand' => { 'cb' => \&mixed_expand_nav_menu_cb2, },
'subs' => [
{
'text' => "Group Hug",
'url' => "me/group-hug/",
},
{
'text' => "Cool I/O",
'url' => "me/cool-io/",
},
{
'text' => "Resume",
'url' => "resume.html",
},
],
},
{
'text' => "Halifax",
'url' => "halifax/",
},
{
'text' => "Software",
'title' => "Open Source Software I Wrote",
'url' => "open-source/",
'host' => "other",
'expand' => { 'cb' => \&mixed_expand_nav_menu_cb1, },
'subs' => [
{
'text' => "Fooware",
'url' => "open-source/fooware/",
},
{
'text' => "Condor-Man",
'title' => "Kwalitee",
'url' => "open-source/condor-man/",
},
],
},
],
},
);
my @special_chars_nav_menu = (
'current_host' => "default",
'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, },
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "Special Chars",
'url' => "&\"you\"/",
},
{
'text' => "Non-special",
'url' => "non-special/",
},
],
},
);
my @with_skips_nav_menu = (
'current_host' => "default",
'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, },
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "About Me",
'title' => "About Myself",
'url' => "me/",
'expand' => { 're' => "^me/", },
'subs' => [
{
'text' => "Group Hug",
'url' => "me/group-hug/",
},
{
'text' => "Cool I/O",
'url' => "me/cool-io/",
},
{
'text' => "Resume",
'url' => "resume.html",
},
],
},
{
'text' => "Halifax",
'url' => "halifax/",
'skip' => 1,
},
{
'text' => "Software",
'title' => "Open Source Software I Wrote",
'url' => "open-source/",
'expand' => { 're' => "^open-source/", },
'subs' => [
{
'text' => "Fooware",
'url' => "open-source/fooware/",
'skip' => 1,
},
{
'text' => "Condor-Man",
'title' => "Kwalitee",
'url' => "open-source/condor-man/",
},
],
},
],
},
);
my @root_path_not_slash = (
'current_host' => "default",
'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, },
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "puzzles/",
subs => [
{
url => "puzzles/foo/",
'text' => "The Foo Puzzle",
},
{
url => "puzzles/bar/",
text => "The Bar Puzzle",
},
],
},
{
'text' => "About Me",
'title' => "About Myself",
'url' => "puzzles/me/",
},
],
},
);
my @non_capturing_expand = (
'current_host' => "default",
'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, },
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "Humour",
'url' => "humour/",
'expand' => { 're' => "^humour/", },
'title' => "My Humorous Creations",
'subs' => [
{
'text' => "Stories",
'url' => "humour/stories/",
'title' => "Large-Scale Stories I Wrote",
'expand' => { 're' => "^humour/", capt => 0, },
'subs' => [
{
'text' => "The Enemy",
'url' => "humour/TheEnemy/",
},
{
'text' => "TOW The Fountainhead",
'url' => "humour/TOWTF/",
},
],
},
{
'text' => "By Others",
'url' => "humour/by-others/",
'expand' => { 're' => "^humour/by-others/", },
},
],
}
],
},
);
my @non_capturing_expand_reversed = (
'current_host' => "default",
'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, },
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "Humour",
'url' => "humour/",
'expand' => { 're' => "^humour/", },
'title' => "My Humorous Creations",
'subs' => [
{
'text' => "Stories",
'url' => "humour/stories/",
'title' => "Large-Scale Stories I Wrote",
'subs' => [
{
'text' => "The Enemy",
'url' => "humour/TheEnemy/",
},
{
'text' => "TOW The Fountainhead",
'url' => "humour/TOWTF/",
},
],
},
{
'text' => "By Others",
'url' => "humour/by-others/",
'expand' => { 're' => "^humour/", capt => 0, },
subs => [
{
text => "Foo",
url => "humour/by-others/foo.html",
},
],
},
],
}
],
},
);
my @non_capturing_expand_nested = (
'current_host' => "default",
'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, },
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "Humour",
'url' => "humour/",
'expand' => { 're' => "^humour/", },
'title' => "My Humorous Creations",
'subs' => [
{
'text' => "Stories",
'url' => "humour/stories/",
'expand' => { 're' => "^humour/", 'capt' => 0 },
'title' => "Large-Scale Stories I Wrote",
'subs' => [
{
'text' => "The Enemy",
'url' => "humour/TheEnemy/",
},
{
'text' => "TOW The Fountainhead",
'url' => "humour/TOWTF/",
},
],
},
{
'text' => "By Others",
'url' => "humour/by-others/",
'expand' => { 're' => "^humour/", capt => 0, },
subs => [
{
text => "Foo",
url => "humour/by-others/foo.html",
},
],
},
],
}
],
},
);
my @header_role_with_empty_cat_nav_menu = (
'current_host' => "default",
'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, },
'tree_contents' => {
'host' => "default",
'text' => "Top 1",
'title' => "T1 Title",
'subs' => [
{
'text' => "Home",
'url' => "",
},
{
'text' => "Empty Category",
'url' => "empty-cat/",
'role' => "header",
'show_always' => 1,
},
{
'text' => "About Me",
'title' => "About Myself",
'url' => "me/",
'role' => "header",
'show_always' => 1,
'subs' => [
{
'text' => "Sub Me",
'url' => "me/sub-me1/",
},
{
'text' => "Sub Me 2",
'url' => "me/sub-me-two/",
},
],
},
{
'text' => "Hello",
'url' => "aloha/",
'show_always' => 1,
'role' => "notexist",
'subs' => [
{
'text' => "OBKB",
'url' => "aloha/obkb/",
},
],
},
],
},
);
sub get_test_data
{
return {
'two_sites' => \@two_sites_data,
'minimal' => \@minimal_nav_menu,
'expand_re' => \@expand_re_nav_menu,
'show_always' => \@show_always_nav_menu,
'items_in_sub' => \@items_in_sub_nav_menu,
'separator' => \@separator_nav_menu,
'hidden_item' => \@hidden_item_nav_menu,
'header_role' => \@header_role_nav_menu,
'selective_expand' => \@selective_expand_nav_menu,
'url_type_menu' => \@url_type_menu,
'rec_url_type_menu' => \@rec_url_type_menu,
'url_is_abs_menu' => \@url_is_abs_nav_menu,
'mixed_expand_menu' => \@mixed_expand_nav_menu,
'special_chars_menu' => \@special_chars_nav_menu,
'with_skips' => \@with_skips_nav_menu,
'with_ids_nav_menu' => \@with_ids_nav_menu,
'root_path_not_slash' => \@root_path_not_slash,
'non_capturing_expand' => \@non_capturing_expand,
'non_capturing_expand_reversed' => \@non_capturing_expand_reversed,
'non_capturing_expand_nested' => \@non_capturing_expand_nested,
'header_role_with_empty_cat' => \@header_role_with_empty_cat_nav_menu
};
}
1;
Iterator 000755 000764 000764 0 14247414065 23621 5 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu Html.pm 100644 000764 000764 12164 14247414065 25247 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu/Iterator package HTML::Widgets::NavMenu::Iterator::Html;
$HTML::Widgets::NavMenu::Iterator::Html::VERSION = '1.1000';
use strict;
use warnings;
use HTML::Widgets::NavMenu::Iterator::Html::Item ();
use parent qw(HTML::Widgets::NavMenu::Iterator::Base);
use HTML::Widgets::NavMenu::EscapeHtml qw/ escape_html /;
sub _construct_new_item
{
my $self = shift;
my $args = shift;
return HTML::Widgets::NavMenu::Iterator::Html::Item->new( $args, );
}
sub _is_top_separator
{
return $_[0]->top->{_node}->{separator};
}
sub node_start
{
my $self = shift;
if ( $self->{_is_root} )
{
return $self->_start_root();
}
elsif ( $self->_is_top_separator() )
{
# _start_sep() is short for start_separator().
return $self->_start_sep();
}
else
{
return $self->_start_regular();
}
}
sub node_end
{
my $self = shift;
if ( $self->{_is_root} )
{
return $self->end_root();
}
elsif ( $self->_is_top_separator() )
{
return $self->_end_sep();
}
else
{
return $self->_end_regular();
}
}
sub end_root
{
my $self = shift;
$self->_add_tags("
");
}
sub _end_regular
{
my $self = shift;
if ( $self->top()->_num_subs() && $self->_is_expanded() )
{
$self->_add_tags("");
}
$self->_add_tags("");
}
sub node_should_recurse
{
my $self = shift;
return $self->_is_expanded();
}
# Get the HTML tag.
#
sub get_a_tag
{
my $self = shift;
my $item = $self->top();
my $node = $item->_node;
my $tag = "title;
$tag .= " href=\""
. escape_html( $self->nav_menu()->_get_url_to_item($item) ) . "\"";
if ( defined($title) )
{
$tag .= " title=\"$title\"";
}
$tag .= ">" . $node->text() . "";
return $tag;
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
HTML::Widgets::NavMenu::Iterator::Html - an iterator for HTML.
=head1 VERSION
version 1.1000
=head1 SYNOPSIS
For internal use only.
=head1 METHODS
=head2 $self->node_start()
Gets called upon node start.
=head2 $self->node_end()
Gets called upon node end.
=head2 $self->end_root()
End-root event.
=head2 $self->node_should_recurse()
Override to determine when one should recurse to the node.
=head2 $self->get_a_tag()
Renders the HTML for the opening a-tag.
=head1 COPYRIGHT & LICENSE
Copyright 2006 Shlomi Fish, all rights reserved.
This program is released under the following license: MIT X11.
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
Base.pm 100644 000764 000764 12431 14247414065 25212 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu/Iterator package HTML::Widgets::NavMenu::Iterator::Base;
$HTML::Widgets::NavMenu::Iterator::Base::VERSION = '1.1000';
use strict;
use warnings;
use parent qw(HTML::Widgets::NavMenu::Tree::Iterator);
__PACKAGE__->mk_acc_ref(
[
qw(
_html
nav_menu
)
]
);
sub _init
{
my $self = shift;
my $args = shift;
$self->SUPER::_init($args);
$self->nav_menu( $args->{'nav_menu'} )
or die "nav_menu not specified!";
$self->_html( [] );
return 0;
}
sub _add_tags
{
my $self = shift;
push( @{ $self->_html() }, @_ );
}
sub _is_root
{
my $self = shift;
return ( $self->stack->len() == 1 );
}
sub get_initial_node
{
my $self = shift;
return $self->nav_menu->_get_traversed_tree();
}
sub get_node_subs
{
my ( $self, $args ) = @_;
my $node = $args->{'node'};
return [ @{ $node->subs() } ];
}
# TODO : This method is too long - refactor.
sub get_new_accum_state
{
my ( $self, $args ) = @_;
my $parent_item = $args->{'item'};
my $node = $args->{'node'};
my $prev_state;
if ( defined($parent_item) )
{
$prev_state = $parent_item->_accum_state();
}
else
{
$prev_state = +{};
}
my $show_always = 0;
if ( exists( $prev_state->{'show_always'} ) )
{
$show_always = $prev_state->{'show_always'};
}
if ( defined( $node->show_always() ) )
{
$show_always = $node->show_always();
}
my $rec_url_type;
if ( exists( $prev_state->{'rec_url_type'} ) )
{
$rec_url_type = $prev_state->{'rec_url_type'};
}
if ( defined( $node->rec_url_type() ) )
{
$rec_url_type = $node->rec_url_type();
}
return {
'host' => ( $node->host() ? $node->host() : $prev_state->{'host'} ),
'show_always' => $show_always,
'rec_url_type' => $rec_url_type,
};
}
sub get_results
{
my $self = shift;
return [ @{ $self->_html() } ];
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
HTML::Widgets::NavMenu::Iterator::Base - base class for the iterator.
=head1 VERSION
version 1.1000
=head1 SYNOPSIS
For internal use only.
=head1 METHODS
=head2 nav_menu
Internal use.
=head2 $self->get_initial_node()
Gets the initial node.
=head2 $self->get_node_subs({ node => $node})
Gets the subs of the node.
=head2 $self->get_new_accum_state( { item => $item, node => $node } )
Gets the new accumulated state.
=head2 my $array_ref = $self->get_results()
Returns an array reference with the resultant HTML.
=head1 COPYRIGHT & LICENSE
Copyright 2006 Shlomi Fish, all rights reserved.
This program is released under the following license: MIT X11.
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
Iterator.pm 100644 000764 000764 16414 14247414065 25244 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu/Tree package HTML::Widgets::NavMenu::Tree::Iterator;
$HTML::Widgets::NavMenu::Tree::Iterator::VERSION = '1.1000';
use strict;
use warnings;
use parent qw(HTML::Widgets::NavMenu::Object);
use HTML::Widgets::NavMenu::Tree::Iterator::Stack ();
use HTML::Widgets::NavMenu::Tree::Iterator::Item ();
__PACKAGE__->mk_acc_ref(
[
qw(
coords
stack
_top
)
]
);
sub _init
{
my $self = shift;
$self->stack( HTML::Widgets::NavMenu::Tree::Iterator::Stack->new() );
$self->{_top} = undef();
return 0;
}
sub top
{
return shift(@_)->{_top};
}
sub _construct_new_item
{
my ( $self, $args ) = @_;
return HTML::Widgets::NavMenu::Tree::Iterator::Item->new($args);
}
sub get_new_item
{
my ( $self, $args ) = @_;
my $node = $args->{'node'};
my $parent_item = $args->{'parent_item'};
return $self->_construct_new_item(
{
'node' => $node,
'subs' => $self->get_node_subs( { 'node' => $node } ),
'accum_state' => $self->get_new_accum_state(
{
'item' => $parent_item,
'node' => $node,
}
),
}
);
}
sub traverse
{
my $self = shift;
my $_items = $self->stack->_items;
my $push = sub {
push @{$_items},
(
$self->{_top} = $self->get_new_item(
{
'node' => shift(@_),
'parent_item' => $self->{_top},
}
)
);
};
$push->( $self->get_initial_node() );
$self->{_is_root} = ( scalar(@$_items) == 1 );
my $co = $self->coords( [] );
MAIN_LOOP: while ( my $top_item = $self->{_top} )
{
my $visited = $top_item->_is_visited();
if ( !$visited )
{
$self->node_start();
}
my $sub_item = (
$self->node_should_recurse()
? $top_item->_visit()
: undef
);
if ( defined($sub_item) )
{
push @$co, $top_item->_visited_index();
$push->(
$self->get_node_from_sub(
{
'item' => $top_item,
'sub' => $sub_item,
}
),
);
$self->{_is_root} = ( scalar(@$_items) == 1 );
next MAIN_LOOP;
}
else
{
$self->node_end();
pop @$_items;
$self->{_top} = $_items->[-1];
$self->{_is_root} = ( scalar(@$_items) == 1 );
pop @$co;
}
}
return 0;
}
sub get_node_from_sub
{
return $_[1]->{'sub'};
}
sub find_node_by_coords
{
my $self = shift;
my $coords = shift;
my $callback = shift || ( sub { } );
my $idx = 0;
my $item = $self->get_new_item(
{
'node' => $self->get_initial_node(),
}
);
my $internal_callback = sub {
$callback->(
'idx' => $idx,
'item' => $item,
'self' => $self,
);
};
$internal_callback->();
foreach my $c (@$coords)
{
$item = $self->get_new_item(
{
'node' => $self->get_node_from_sub(
{
'item' => $item,
'sub' => $item->_get_sub($c),
}
),
'parent_item' => $item,
}
);
++$idx;
$internal_callback->();
}
return +{ 'item' => $item, };
}
sub get_coords
{
my $self = shift;
return $self->coords();
}
sub _is_root
{
my $self = shift;
return $self->{_is_root};
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
HTML::Widgets::NavMenu::Tree::Iterator - an iterator for HTML.
=head1 VERSION
version 1.1000
=head1 SYNOPSIS
For internal use only.
=head1 METHODS
=head2 coords
Internal use.
=head2 stack
Internal use.
=head2 $self->top()
Retrieves the stack top item.
=head2 $self->get_new_item({'node' => $node, 'parent_item' => $parent})
Gets the new item.
=head2 $self->traverse()
Traverses the tree.
=head2 $self->get_node_from_sub()
This function can be overridden to generate a node from the sub-nodes
returned by get_node_subs() in a different way than the default.
=head2 $self->find_node_by_coords($coords, $callback)
Finds a node by its coordinations.
=head2 $self->get_coords()
Returns the current coordinates of the object.
=head1 COPYRIGHT & LICENSE
Copyright 2006 Shlomi Fish, all rights reserved.
This program is released under the following license: MIT X11.
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
Stdout.pm 100644 000764 000764 367 14247414065 25160 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/t/lib/HTML/Widgets/NavMenu/Test use strict;
use warnings;
use IO::Scalar ();
open my $SAVEOUT, ">&STDOUT";
print {$SAVEOUT} "";
my $buffer = "";
tie *STDOUT, 'IO::Scalar', \$buffer;
sub reset_out_buffer
{
$buffer = "";
}
sub get_out_buffer
{
return $buffer;
}
1;
JQueryTreeView.pm 100644 000764 000764 7716 14247414065 25433 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu package HTML::Widgets::NavMenu::JQueryTreeView;
$HTML::Widgets::NavMenu::JQueryTreeView::VERSION = '1.1000';
use strict;
use warnings;
use parent 'HTML::Widgets::NavMenu';
require HTML::Widgets::NavMenu::Iterator::JQTreeView;
sub _get_nav_menu_traverser
{
my $self = shift;
return HTML::Widgets::NavMenu::Iterator::JQTreeView->new(
$self->_get_nav_menu_traverser_args() );
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
HTML::Widgets::NavMenu::JQueryTreeView - A Specialized HTML::Widgets::NavMenu
sub-class
=head1 VERSION
version 1.1000
=head1 DESCRIPTION
This module renders all nodes but places C< class="open" >
and C< class="close" > attributes in the opening C<<
>> tags.
An example of this use can be found in Shlomi Fish's Homepage
( L ).
=head1 SYNOPOSIS
Mostly the same as L execpt that it renders a fully
expanded tree suitable for input to JQuery's treeview plugin
=head1 SEE ALSO
L for the complete documentation of the super-class.
=head1 AUTHORS
Shlomi Fish ( L ).
=head1 COPYRIGHT AND LICENSE
Copyright 2004, Shlomi Fish. All rights reserved.
You can use, modify and distribute this module under the terms of the MIT X11
license. ( L ).
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
Error 000755 000764 000764 0 14247414065 23121 5 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu Redirect.pm 100644 000764 000764 6215 14247414065 25364 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu/Error package HTML::Widgets::NavMenu::Error::Redirect;
$HTML::Widgets::NavMenu::Error::Redirect::VERSION = '1.1000';
use strict;
use warnings;
use parent "HTML::Widgets::NavMenu::Error";
sub CGIpm_perform_redirect
{
my $self = shift;
my $cgi = shift;
print $cgi->redirect( $cgi->script_name() . $self->{-redirect_path} );
exit;
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
=head1 VERSION
version 1.1000
=head1 SYNOPSIS
=head1 DESCRIPTION
=head1 METHODS
=head2 CGIpm_perform_redirect()
B
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
NodeDescription.pm 100644 000764 000764 6560 14247414065 25626 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu package HTML::Widgets::NavMenu::NodeDescription;
$HTML::Widgets::NavMenu::NodeDescription::VERSION = '1.1000';
use strict;
use warnings;
use parent qw(HTML::Widgets::NavMenu::Object);
__PACKAGE__->mk_acc_ref( [qw(host host_url title label direct_url url_type)] );
sub _init
{
my ( $self, $args ) = @_;
while ( my ( $k, $v ) = each(%$args) )
{
$self->$k($v);
}
return 0;
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
=head1 VERSION
version 1.1000
=head1 SYNOPSIS
=head1 DESCRIPTION
=head1 METHODS
=head2 direct_url()
B
=head2 host()
B
=head2 host_url()
B
=head2 label()
B
=head2 title()
B
=head2 url_type()
B
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
NavMenu.pm 100644 000764 000764 16077 14247414065 25723 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu/Iterator package HTML::Widgets::NavMenu::Iterator::NavMenu;
$HTML::Widgets::NavMenu::Iterator::NavMenu::VERSION = '1.1000';
use strict;
use warnings;
use parent qw(HTML::Widgets::NavMenu::Iterator::Html);
use HTML::Widgets::NavMenu::EscapeHtml qw/ escape_html /;
__PACKAGE__->mk_acc_ref(
[
qw(
_ul_classes
)
]
);
sub _init
{
my $self = shift;
my $args = shift;
$self->SUPER::_init($args);
# Make a fresh copy just to be on the safe side.
$self->_ul_classes( [ @{ $args->{'ul_classes'} } ] );
return 0;
}
sub _calc_li_id_attr
{
my $self = shift;
my $li_id = $self->top()->_li_id;
return (
defined($li_id)
? qq/ id="/ . escape_html($li_id) . qq/"/
: q//
);
}
# Depth is 1 for the uppermost depth.
sub gen_ul_tag
{
my ( $self, $args ) = @_;
my $depth = $args->{'depth'};
my $class = $self->_get_ul_class( { 'depth' => $depth } );
return "
";
}
sub _get_ul_class
{
my ( $self, $args ) = @_;
my $depth = $args->{'depth'};
return $self->_ul_classes->[ $depth - 1 ];
}
sub get_currently_active_text
{
my $self = shift;
my $node = shift;
return "" . $node->text() . "";
}
sub get_link_tag
{
my $self = shift;
my $node = $self->top->_node();
if ( $node->CurrentlyActive() )
{
return $self->get_currently_active_text($node);
}
else
{
return $self->get_a_tag();
}
}
sub _start_root
{
my $self = shift;
$self->_add_tags(
$self->gen_ul_tag(
{
'depth' => $self->stack->len()
}
)
);
}
sub _start_sep
{
my $self = shift;
$self->_add_tags("
");
}
sub _start_handle_role
{
my $self = shift;
return $self->_start_handle_non_role();
}
sub get_open_sub_menu_tags
{
my $self = shift;
return ( " ",
$self->gen_ul_tag( { 'depth' => $self->stack->len() } ) );
}
sub _start_handle_non_role
{
my $self = shift;
my $top_item = $self->top;
my @tags_to_add =
( ( "
_calc_li_id_attr() . ">" ), $self->get_link_tag() );
if ( $top_item->_num_subs_to_go() && $self->_is_expanded() )
{
push @tags_to_add, ( $self->get_open_sub_menu_tags() );
}
$self->_add_tags(@tags_to_add);
}
sub _start_regular
{
my $self = shift;
my $top_item = $self->top;
my $node = $self->top->_node();
if ( $self->_is_hidden() )
{
# Do nothing
}
else
{
if ( $self->_is_role_specified() )
{
$self->_start_handle_role();
}
else
{
$self->_start_handle_non_role();
}
}
}
sub _end_sep
{
my $self = shift;
$self->_add_tags(
$self->gen_ul_tag(
{
'depth' => $self->stack->len() - 1
}
)
);
}
sub _end_handle_role
{
my $self = shift;
return $self->_end_handle_non_role();
}
sub _end_handle_non_role
{
my $self = shift;
return $self->SUPER::_end_regular();
}
sub _end_regular
{
my $self = shift;
if ( $self->_is_hidden() )
{
# Do nothing
}
elsif ( $self->_is_role_specified() )
{
$self->_end_handle_role();
}
else
{
$self->_end_handle_non_role();
}
}
sub _is_hidden
{
my $self = shift;
return $self->top->_node()->hide();
}
sub _is_expanded
{
my $self = shift;
my $node = $self->top->_node();
return ( $node->expanded() || $self->top->_accum_state->{'show_always'} );
}
sub get_role
{
my $self = shift;
return $self->top->_node->role();
}
sub _is_role_specified
{
my $self = shift;
return defined( $self->get_role() );
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
HTML::Widgets::NavMenu::Iterator::NavMenu - navmenu iterator.
=head1 VERSION
version 1.1000
=head1 SYNOPSIS
For internal use only.
=head1 METHODS
=head2 $self->gen_ul_tag({depth => $depth});
Generate a UL tag of depth $depth.
=head2 get_currently_active_text ( $node )
Calculates the highlighted text for the node C<$node>. Normally surrounds it
with C<<< ... >>> tags.
=head2 $self->get_link_tag()
Gets the tag for the link - an item in the menu.
=head2 my @tags = $self->get_open_sub_menu_tags()
Gets the tags to open a new sub menu.
=head2 $self->get_role()
Retrieves the current role.
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
SiteMap.pm 100644 000764 000764 7356 14247414065 25674 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu/Iterator package HTML::Widgets::NavMenu::Iterator::SiteMap;
$HTML::Widgets::NavMenu::Iterator::SiteMap::VERSION = '1.1000';
use strict;
use warnings;
use parent qw(HTML::Widgets::NavMenu::Iterator::Html);
sub _start_root
{
my $self = shift;
$self->_add_tags("
");
}
sub _start_sep
{
}
sub _start_regular
{
my $self = shift;
my $top_item = $self->top;
my $node = $self->top->_node();
$self->_add_tags("
");
my $tag = $self->get_a_tag();
my $title = $node->title();
if ( defined($title) )
{
$tag .= " - $title";
}
$self->_add_tags($tag);
if ( $top_item->_num_subs_to_go() )
{
$self->_add_tags(" ");
$self->_add_tags("
");
}
}
sub _end_sep
{
}
sub _is_expanded
{
return 1;
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
HTML::Widgets::NavMenu::Iterator::SiteMap - a site-map iterator.
=head1 VERSION
version 1.1000
=head1 SYNOPSIS
For internal use only.
=head1 METHODS
=head1 COPYRIGHT & LICENSE
Copyright 2006 Shlomi Fish, all rights reserved.
This program is released under the following license: MIT X11.
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
Html 000755 000764 000764 0 14247414065 24525 5 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu/Iterator Item.pm 100644 000764 000764 6375 14247414065 26134 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu/Iterator/Html package HTML::Widgets::NavMenu::Iterator::Html::Item;
$HTML::Widgets::NavMenu::Iterator::Html::Item::VERSION = '1.1000';
use strict;
use warnings;
use parent qw(HTML::Widgets::NavMenu::Tree::Iterator::Item);
sub get_url_type
{
my $item = shift;
return ( $item->_node()->url_type()
|| $item->_accum_state()->{'rec_url_type'}
|| "rel" );
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
HTML::Widgets::NavMenu::Iterator::Html::Item - an iterator item for HTML.
=head1 VERSION
version 1.1000
=head1 SYNOPSIS
For internal use only.
=head1 METHODS
=head2 get_url_type
For internal use only.
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
Iterator 000755 000764 000764 0 14247414065 24520 5 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu/Tree Item.pm 100644 000764 000764 10572 14247414065 26141 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu/Tree/Iterator package HTML::Widgets::NavMenu::Tree::Iterator::Item;
$HTML::Widgets::NavMenu::Tree::Iterator::Item::VERSION = '1.1000';
use strict;
use warnings;
use parent qw(HTML::Widgets::NavMenu::Object);
__PACKAGE__->mk_acc_ref(
[
qw(
_node
_subs
_sub_idx
_visited
_accum_state
)
]
);
sub _init
{
my ( $self, $args ) = @_;
$self->_node( $args->{'node'} )
or die "node not specified!";
$self->_subs( $args->{'subs'} )
or die "subs not specified!";
$self->_sub_idx(-1);
$self->_visited(0);
$self->_accum_state( $args->{'accum_state'} )
or die "accum_state not specified!";
return 0;
}
sub _is_visited
{
my $self = shift;
return $self->_visited();
}
sub _visit
{
my $self = shift;
$self->_visited(1);
if ( $self->_num_subs_to_go() )
{
return $self->_subs()->[ $self->_sub_idx( $self->_sub_idx() + 1 ) ];
}
else
{
return;
}
}
sub _visited_index
{
my $self = shift;
return $self->_sub_idx();
}
sub _num_subs_to_go
{
my $self = shift;
return $self->_num_subs() - $self->_sub_idx() - 1;
}
sub _num_subs
{
my $self = shift;
return scalar( @{ $self->_subs() } );
}
sub _get_sub
{
my $self = shift;
my $sub_num = shift;
return $self->_subs()->[$sub_num];
}
sub _li_id
{
return shift->_node->li_id();
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
HTML::Widgets::NavMenu::Tree::Iterator::Item - an item for the tree iterator.
=head1 VERSION
version 1.1000
=head1 SYNOPSIS
For internal use only.
=head1 COPYRIGHT & LICENSE
Copyright 2006 Shlomi Fish, all rights reserved.
This program is released under the following license: MIT X11.
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L
git clone git://github.com/shlomif/perl-HTML-Widgets-NavMenu.git
=head1 AUTHOR
Shlomi Fish
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2005 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
=cut
JQTreeView.pm 100644 000764 000764 11126 14247414065 26325 0 ustar 00shlomif shlomif 000000 000000 HTML-Widgets-NavMenu-1.1000/lib/HTML/Widgets/NavMenu/Iterator package HTML::Widgets::NavMenu::Iterator::JQTreeView;
$HTML::Widgets::NavMenu::Iterator::JQTreeView::VERSION = '1.1000';
use strict;
use warnings;
use HTML::Widgets::NavMenu::EscapeHtml qw/ escape_html /;
use parent qw(HTML::Widgets::NavMenu::Iterator::NavMenu);
sub _init
{
my $self = shift;
my $args = shift;
$self->SUPER::_init($args);
# Make a fresh copy just to be on the safe side.
$self->_ul_classes( [ @{ $args->{'ul_classes'} } ] );
return 0;
}
sub _calc_open_li_tag
{
my $self = shift;
my $id_attr = $self->_calc_li_id_attr();
return (
$self->_is_expanded_for_treeview()
? (qq{
})
: ("
")
);
return;
}
sub _start_handle_non_role
{
my $self = shift;
my $top_item = $self->top;
my @tags_to_add = ( $self->_calc_open_li_tag(), $self->get_link_tag() );
if ( $top_item->_num_subs_to_go() && $self->_is_expanded() )
{
push @tags_to_add, ( $self->get_open_sub_menu_tags() );
}
$self->_add_tags(@tags_to_add);
return;
}
sub _start_handle_role
{
my $self = shift;
return $self->_start_handle_non_role();
}
sub _is_expanded
{
return 1;
}
sub _is_expanded_for_treeview
{
my $self = shift;
my $node = $self->top->_node();
return ( $node->expanded() || $self->top->_accum_state->{'show_always'} );
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
HTML::Widgets::NavMenu::Iterator::JQTreeView - an iterator for JQuery
TreeView's navigation menus.
=head1 VERSION
version 1.1000
=head1 SYNOPSIS
See L .
For internal use only.
=head1 METHODS
=head2 get_currently_active_text ( $node )
Calculates the highlighted text for the node C<$node>. Normally surrounds it
with C<<< ... >>> tags.
=head1 COPYRIGHT & LICENSE
Copyright 2006 Shlomi Fish, all rights reserved.
This program is released under the following license: MIT X11.
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C, or through
the web interface at L