This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Pod::Html - correctly link to =item's on the same page
authorYitzchak Scott-Thoennes <sthoenna@efn.org>
Mon, 4 Jul 2005 02:07:38 +0000 (19:07 -0700)
committerSteve Hay <SteveHay@planit.com>
Tue, 5 Jul 2005 16:55:29 +0000 (16:55 +0000)
Message-ID: <20050704090738.GA4056@efn.org>

(plus a new test, although it is currently marked TODO)

p4raw-id: //depot/perl@25083

MANIFEST
lib/Pod/Html.pm
lib/Pod/t/htmllink.pod [new file with mode: 0644]
lib/Pod/t/htmllink.t [new file with mode: 0644]

index 8041796..204ffe9 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -1864,6 +1864,8 @@ lib/Pod/Text/Termcap.pm           Convert POD data to ASCII text with format escapes
 lib/Pod/t/Functions.t          See if Pod::Functions works
 lib/Pod/t/htmlescp.pod         pod2html escape test input data
 lib/Pod/t/htmlescp.t           pod2html escape test
+lib/Pod/t/htmllink.pod         pod2html link test input data
+lib/Pod/t/htmllink.t           pod2html link test
 lib/Pod/t/htmlview.pod         pod2html render test input data
 lib/Pod/t/htmlview.t           pod2html render test
 lib/Pod/t/InputObjects.t       See if Pod::InputObjects works
index 0f7f380..b4949b6 100644 (file)
@@ -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 (file)
index 0000000..2113db7
--- /dev/null
@@ -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 (file)
index 0000000..27142e6
--- /dev/null
@@ -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>