summaryrefslogtreecommitdiff
path: root/lib/Pod
diff options
context:
space:
mode:
authorYitzchak Scott-Thoennes <sthoenna@efn.org>2005-07-03 19:07:38 -0700
committerSteve Hay <SteveHay@planit.com>2005-07-05 16:55:29 +0000
commit6e38a594fb2312d48815b72c0456fcd281ea8917 (patch)
treeb52ce3d003b98cc2679c1739238a524b8eb578e7 /lib/Pod
parentd5426c8880e92e46cbbcf96f8bac03a7f2eab6c3 (diff)
downloadperl-6e38a594fb2312d48815b72c0456fcd281ea8917.tar.gz
Pod::Html - correctly link to =item's on the same page
Message-ID: <20050704090738.GA4056@efn.org> (plus a new test, although it is currently marked TODO) p4raw-id: //depot/perl@25083
Diffstat (limited to 'lib/Pod')
-rw-r--r--lib/Pod/Html.pm2
-rw-r--r--lib/Pod/t/htmllink.pod107
-rw-r--r--lib/Pod/t/htmllink.t129
3 files changed, 237 insertions, 1 deletions
diff --git a/lib/Pod/Html.pm b/lib/Pod/Html.pm
index 0f7f380a7b..b4949b6ae8 100644
--- a/lib/Pod/Html.pm
+++ b/lib/Pod/Html.pm
@@ -1883,7 +1883,7 @@ sub coderef($$){
my( $url );
my $fid = fragment_id( $item );
- if( defined( $page ) ){
+ if( defined( $page ) && $page ne "" ){
# we have been given a $page...
$page =~ s{::}{/}g;
diff --git a/lib/Pod/t/htmllink.pod b/lib/Pod/t/htmllink.pod
new file mode 100644
index 0000000000..2113db7462
--- /dev/null
+++ b/lib/Pod/t/htmllink.pod
@@ -0,0 +1,107 @@
+=head1 NAME
+
+htmllink - Test HTML links
+
+=head1 LINKS
+
+L</"section1">
+
+L</"section 2">
+
+L</"section three">
+
+L</"item1">
+
+L</"item 2">
+
+L</"item three">
+
+L</section1>
+
+L</section 2>
+
+L</section three>
+
+L</item1>
+
+L</item 2>
+
+L</item three>
+
+L<"section1">
+
+L<"section 2">
+
+L<"section three">
+
+L<"item1">
+
+L<"item 2">
+
+L<"item three">
+
+L<text|/"section1">
+
+L<text|/"section 2">
+
+L<text|/"section three">
+
+L<text|/"item1">
+
+L<text|/"item 2">
+
+L<text|/"item three">
+
+L<text|/section1>
+
+L<text|/section 2>
+
+L<text|/section three>
+
+L<text|/item1>
+
+L<text|/item 2>
+
+L<text|/item three>
+
+L<text|"section1">
+
+L<text|"section 2">
+
+L<text|"section three">
+
+L<text|"item1">
+
+L<text|"item 2">
+
+L<text|"item three">
+
+=head1 TARGETS
+
+=head2 section1
+
+This is section one.
+
+=head2 section 2
+
+This is section two.
+
+=head2 section three
+
+This is section three.
+
+=over 4
+
+=item item1
+
+This is item one.
+
+=item item 2
+
+This is item two.
+
+=item item three
+
+This is item three.
+
+=back
diff --git a/lib/Pod/t/htmllink.t b/lib/Pod/t/htmllink.t
new file mode 100644
index 0000000000..27142e698b
--- /dev/null
+++ b/lib/Pod/t/htmllink.t
@@ -0,0 +1,129 @@
+#!/usr/bin/perl -w # -*- perl -*-
+
+BEGIN {
+ chdir 't' if -d 't';
+ unshift @INC, '../lib';
+ unshift @INC, '../lib/Pod/t';
+ require "pod2html-lib.pl";
+}
+
+use strict;
+use Test::More tests => 1;
+
+TODO: {
+ local $TODO = "item 2 doesn't work as expected";
+ convert_n_test("htmllink", "html links");
+}
+
+__DATA__
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>htmllink - Test HTML links</title>
+<link rev="made" href="mailto:" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+
+<ul>
+
+ <li><a href="#name">NAME</a></li>
+ <li><a href="#links">LINKS</a></li>
+ <li><a href="#targets">TARGETS</a></li>
+ <ul>
+
+ <li><a href="#section1">section1</a></li>
+ <li><a href="#section_2">section 2</a></li>
+ <li><a href="#section_three">section three</a></li>
+ </ul>
+
+</ul>
+<!-- INDEX END -->
+
+<hr />
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>htmllink - Test HTML links</p>
+<p>
+</p>
+<hr />
+<h1><a name="links">LINKS</a></h1>
+<p><a href="#section1">section1</a></p>
+<p><a href="#section_2">section 2</a></p>
+<p><a href="#section_three">section three</a></p>
+<p><a href="#item_item1">item1</a></p>
+<p><a href="#item_item_2">item 2</a></p>
+<p><a href="#item_item_three">item three</a></p>
+<p><a href="#section1">section1</a></p>
+<p><a href="#section_2">section 2</a></p>
+<p><a href="#section_three">section three</a></p>
+<p><a href="#item_item1">item1</a></p>
+<p><a href="#item_item_2">item 2</a></p>
+<p><a href="#item_item_three">item three</a></p>
+<p><a href="#section1">section1</a></p>
+<p><a href="#section_2">section 2</a></p>
+<p><a href="#section_three">section three</a></p>
+<p><a href="#item_item1">item1</a></p>
+<p><a href="#item_item_2">item 2</a></p>
+<p><a href="#item_item_three">item three</a></p>
+<p><a href="#section1">text</a></p>
+<p><a href="#section_2">text</a></p>
+<p><a href="#section_three">text</a></p>
+<p><a href="#item_item1">text</a></p>
+<p><a href="#item_item_2">text</a></p>
+<p><a href="#item_item_three">text</a></p>
+<p><a href="#section1">text</a></p>
+<p><a href="#section_2">text</a></p>
+<p><a href="#section_three">text</a></p>
+<p><a href="#item_item1">text</a></p>
+<p><a href="#item_item_2">text</a></p>
+<p><a href="#item_item_three">text</a></p>
+<p><a href="#section1">text</a></p>
+<p><a href="#section_2">text</a></p>
+<p><a href="#section_three">text</a></p>
+<p><a href="#item_item1">text</a></p>
+<p><a href="#item_item_2">text</a></p>
+<p><a href="#item_item_three">text</a></p>
+<p>
+</p>
+<hr />
+<h1><a name="targets">TARGETS</a></h1>
+<p>
+</p>
+<h2><a name="section1">section1</a></h2>
+<p>This is section one.</p>
+<p>
+</p>
+<h2><a name="section_2">section 2</a></h2>
+<p>This is section two.</p>
+<p>
+</p>
+<h2><a name="section_three">section three</a></h2>
+<p>This is section three.</p>
+<dl>
+<dt><strong><a name="item_item1">item1</a></strong><br />
+</dt>
+<dd>
+This is item one.
+</dd>
+<p></p>
+<dt><strong><a name="item_item_2">item 2</a></strong><br />
+</dt>
+<dd>
+This is item two.
+</dd>
+<p></p>
+<dt><strong><a name="item_item_three">item three</a></strong><br />
+</dt>
+<dd>
+This is item three.
+</dd>
+<p></p></dl>
+
+</body>
+
+</html>