Skip to content

Commit

Permalink
the anchor does not need an id (closes #867)
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Nov 3, 2015
1 parent d08d190 commit b42abdb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/Mojolicious/Plugin/PODRenderer.pm
Expand Up @@ -68,7 +68,7 @@ sub _html {
my $link = Mojo::URL->new->fragment($anchor);
push @{$parts[-1]}, my $text = $e->all_text, $link;
my $permalink = $c->link_to('#' => $link, class => 'permalink');
$e->content($permalink . $c->link_to($text => $toc, id => $anchor));
$e->content($permalink . $c->link_to($text => $toc));
}

# Try to find a title
Expand Down
21 changes: 11 additions & 10 deletions t/mojolicious/pod_renderer_lite_app.t
Expand Up @@ -52,33 +52,34 @@ $t->get_ok('/art')->status_is(200)->text_like('h2[id="art"]' => qr/art/)
$t->get_ok('/empty')->status_is(200)->content_is('');

# Perldoc browser (Welcome)
$t->get_ok('/perldoc')->status_is(200)->text_is('a[id="TUTORIAL"]', 'TUTORIAL')
->text_is('a[id="GUIDES"]', 'GUIDES')
$t->get_ok('/perldoc')->status_is(200)
->text_is('#TUTORIAL a:nth-of-type(2)', 'TUTORIAL')
->text_is('#GUIDES a:nth-of-type(2)', 'GUIDES')
->content_like(qr/Mojolicious guide to the galaxy/);

# Perldoc browser (Welcome with slash)
$t->get_ok('/perldoc/')->status_is(200)
->text_is('a[id="TUTORIAL"]', 'TUTORIAL')
->text_is('a[id="GUIDES"]', 'GUIDES')
->text_is('#TUTORIAL a:nth-of-type(2)', 'TUTORIAL')
->text_is('#GUIDES a:nth-of-type(2)', 'GUIDES')
->content_like(qr/Mojolicious guide to the galaxy/)
->content_unlike(qr/Pirates/);

# Perldoc browser (Mojo documentation)
$t->get_ok('/perldoc/Mojo')->status_is(200)
->text_is('h1 a[id="SYNOPSIS"]', 'SYNOPSIS')
->text_is('a[id="handler"]', 'handler')
->text_is('h1#SYNOPSIS a:nth-of-type(2)', 'SYNOPSIS')
->text_is('#handler a:nth-of-type(2)', 'handler')
->text_like('p', qr/Duct tape for the HTML5 web!/);

# Perldoc browser (Mojo documentation with format)
$t->get_ok('/perldoc/Mojo.html')->status_is(200)
->text_is('h1 a[id="SYNOPSIS"]', 'SYNOPSIS')
->text_is('a[id="handler"]', 'handler')
->text_is('h1#SYNOPSIS a:nth-of-type(2)', 'SYNOPSIS')
->text_is('#handler a:nth-of-type(2)', 'handler')
->text_like('p', qr/Duct tape for the HTML5 web!/);

# Perldoc browser (negotiated Mojo documentation)
$t->get_ok('/perldoc/Mojo' => {Accept => 'text/html'})->status_is(200)
->text_is('h1 a[id="SYNOPSIS"]', 'SYNOPSIS')
->text_is('a[id="handler"]', 'handler')
->text_is('h1#SYNOPSIS a:nth-of-type(2)', 'SYNOPSIS')
->text_is('#handler a:nth-of-type(2)', 'handler')
->text_like('p', qr/Duct tape for the HTML5 web!/);

# Perldoc browser (Mojo source with format)
Expand Down

0 comments on commit b42abdb

Please sign in to comment.