From 04ee5ba7deed4b0d2479ddd4139ae1999b69d3ca Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Thu, 1 Jan 2015 18:24:29 +0200 Subject: [PATCH] Add support for anchors --- lib/Zeal/Docset.pm | 6 +++++- lib/Zeal/Document.pm | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/Zeal/Docset.pm b/lib/Zeal/Docset.pm index c3f2f36..0857aee 100644 --- a/lib/Zeal/Docset.pm +++ b/lib/Zeal/Docset.pm @@ -40,7 +40,11 @@ sub new { sub _blessdocs { my ($self, $docsref) = @_; - map { Zeal::Document->new(+{%$_, docset => $self}) } @$docsref; + map { + my %hash = (%$_, docset => $self); + ($hash{path}, $hash{anchor}) = split /#/s, $hash{path}; + Zeal::Document->new(\%hash); + } @$docsref; } sub fetch { diff --git a/lib/Zeal/Document.pm b/lib/Zeal/Document.pm index 4d80226..d415670 100644 --- a/lib/Zeal/Document.pm +++ b/lib/Zeal/Document.pm @@ -7,7 +7,7 @@ use warnings; our $VERSION = '0.000_002'; use parent qw/Class::Accessor::Fast/; -__PACKAGE__->mk_accessors(qw/id name type path docset/); +__PACKAGE__->mk_accessors(qw/id name type path anchor docset/); sub fetch { my ($self) = @_; @@ -60,6 +60,10 @@ The path of this document, relative to F. This can also be a HTTP URL. +=item $doc->B + +The URL anchor/fragment identifier of this document. + =item $doc->B The HTML content of this document, retrieved from the file system or -- 2.39.2