stas 02/01/30 08:55:04
Modified: lib/DocSet Config.pm Doc.pm DocSet.pm
lib/DocSet/Source HTML.pm
Log:
- sync with DocSet 0.10
-----------------------
- fix a bug where hidden chapters were added to the generated PDFs.
- fixed paths like .././foo to be ../foo when handed to the templates.
- src HTML docs are parsed for:
<head>
...
<meta name="description" content="abstract goes here">
...
</head>
so now in templates we have doc.meta.abstract if provided by the
source doc.
Revision Changes Path
1.3 +0 -1 modperl-docs/lib/DocSet/Config.pm
Index: Config.pm
===================================================================
RCS file: /home/cvs/modperl-docs/lib/DocSet/Config.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Config.pm 24 Jan 2002 18:11:24 -0000 1.2
+++ Config.pm 30 Jan 2002 16:55:04 -0000 1.3
@@ -212,7 +212,6 @@
# as long as it's set in the config file
$self->{dir}{abs_doc_root} =
join '/', ("..") x ($self->{dir}{dst_html} =~ tr|/|/|);
-
}
}
1.3 +2 -1 modperl-docs/lib/DocSet/Doc.pm
Index: Doc.pm
===================================================================
RCS file: /home/cvs/modperl-docs/lib/DocSet/Doc.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Doc.pm 24 Jan 2002 18:11:24 -0000 1.2
+++ Doc.pm 30 Jan 2002 16:55:04 -0000 1.3
@@ -39,7 +39,8 @@
my $rel_doc_root = $self->{rel_doc_root};
my $abs_doc_root = $self->{abs_doc_root};
- $abs_doc_root .= "/$rel_doc_root" if defined $rel_doc_root;
+ $abs_doc_root .= "/$rel_doc_root"
+ if defined $rel_doc_root and $rel_doc_root ne '.';
$self->{dir} = {
abs_doc_root => $abs_doc_root,
1.3 +6 -6 modperl-docs/lib/DocSet/DocSet.pm
Index: DocSet.pm
===================================================================
RCS file: /home/cvs/modperl-docs/lib/DocSet/DocSet.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DocSet.pm 24 Jan 2002 18:11:24 -0000 1.2
+++ DocSet.pm 30 Jan 2002 16:55:04 -0000 1.3
@@ -209,15 +209,15 @@
# destination paths
my $rel_dst_path = "$basename.$trg_ext";
- my $rel_doc_root = "./";
$rel_dst_path =~ s|^\./||; # strip the leading './'
- $rel_doc_root .= join '/', ("..") x ($rel_dst_path =~ tr|/|/|);
- $rel_doc_root =~ s|/$||; # remove the last '/'
my $dst_path = "$dst_root/$rel_dst_path";
- # push to the list of final chapter paths
- # e.g. used by PS/PDF build, which needs all the chapters
- $self->trg_chapters($rel_dst_path);
+ my $rel_doc_root = join '/', ("..") x ($rel_dst_path =~ tr|/|/|);
+ $rel_doc_root = "." unless $rel_doc_root;
+
+ # push to the list of final chapter paths e.g. used by PS/PDF
+ # build, which needs all the non-hidden chapters
+ $self->trg_chapters($rel_dst_path) unless $hidden;
### to rebuild or not to rebuild
my($should_update, $reason) = should_update($src_path, $dst_path);
1.3 +18 -10 modperl-docs/lib/DocSet/Source/HTML.pm
Index: HTML.pm
===================================================================
RCS file: /home/cvs/modperl-docs/lib/DocSet/Source/HTML.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HTML.pm 24 Jan 2002 18:11:24 -0000 1.2
+++ HTML.pm 30 Jan 2002 16:55:04 -0000 1.3
@@ -19,37 +19,45 @@
#print Pod::POM::View::HTML->print($pom);
my $title = $self->{parsed_tree}->{title};
+
$self->{meta} =
{
- title => $title,
- stitle => $title, # stitle is the same in docs
- link => $self->{rel_dst_path},
+ title => $title,
+ stitle => $title, # stitle is the same as title in docs
+ abstract => $self->{parsed_tree}->{abstract} || '',
+ link => $self->{rel_dst_path},
};
# there is no autogenerated TOC for HTML files
}
+# currently retrieves these parts from the source HTML
+# head.title
+# head.meta.description
+# body
sub parse {
my($self) = @_;
# already parsed
return if exists $self->{parsed_tree} && $self->{parsed_tree};
- # print ${ $self->{content} };
- #my %segments = map {$_ => ''} qw(title body);
-
# this one retrievs the body and the title of the given html
require HTML::Parser;
- sub start_h {}
+ sub start_h {
+ my($self, $tagname, $attr) = @_;
+ if ($tagname eq 'meta' && lc $attr->{name} eq 'description') {
+ $self->{parsed_tree}->{abstract} = $attr->{content};
+ }
+ }
sub end_h {
my($self, $tagname, $skipped_text) = @_;
# use $p itself as a tmp storage (ok according to the docs)
$self->{parsed_tree}->{$tagname} = $skipped_text;
}
my $p = HTML::Parser->new(api_version => 3,
- report_tags => [qw(title body)],
- start_h => [\&start_h],
- end_h => [\&end_h,
"self,tagname,skipped_text"],
+ report_tags => [qw(title body meta)],
+ start_h => [\&start_h, "self,tagname,attr"],
+ end_h => [\&end_h,
"self,tagname,skipped_text"],
);
# Parse document text chunk by chunk
$p->parse(${ $self->{content} });
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]