From: Marius Gavrilescu Date: Thu, 1 Jan 2015 16:24:29 +0000 (+0200) Subject: Add support for anchors X-Git-Tag: 0.000_003~4 X-Git-Url: http://git.ieval.ro/?p=zeal.git;a=commitdiff_plain;h=04ee5ba7deed4b0d2479ddd4139ae1999b69d3ca Add support for anchors --- 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