Add support for anchors
authorMarius Gavrilescu <marius@ieval.ro>
Thu, 1 Jan 2015 16:24:29 +0000 (18:24 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Thu, 1 Jan 2015 16:24:29 +0000 (18:24 +0200)
lib/Zeal/Docset.pm
lib/Zeal/Document.pm

index c3f2f36a3decf4f7bb6f0dd4deb5bb376d24eb62..0857aeeb4f263dfe22d4fdc2d6fd1e13c53e4443 100644 (file)
@@ -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 {
index 4d80226fd8f7d5827cc120a6f069f7e7e805c406..d4156702349d482ecd9e5b6b5ca03b619c44a83b 100644 (file)
@@ -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<docset_root/Contents/Resources/Documents/>. This can also be a HTTP
 URL.
 
+=item $doc->B<anchor>
+
+The URL anchor/fragment identifier of this document.
+
 =item $doc->B<fetch>
 
 The HTML content of this document, retrieved from the file system or
This page took 0.011718 seconds and 4 git commands to generate.