Skip to content
Browse files

Extracted EPUB formatter from HTML formatter.

  • Loading branch information...
1 parent e5d1eb5 commit ba7721760241db0770c9f08930c1db3060e4daad @chromatic committed Mar 24, 2012
Showing with 32 additions and 0 deletions.
  1. +32 −0 lib/Pod/PseudoPod/DOM/Role/EPUB.pm
View
32 lib/Pod/PseudoPod/DOM/Role/EPUB.pm
@@ -0,0 +1,32 @@
+package Pod::PseudoPod::DOM::Role::EPUB;
+# ABSTRACT: an EPUB XHTML formatter role for PseudoPod DOM trees
+
+use strict;
+use warnings;
+
+use Moose::Role;
+
+with 'Pod::PseudoPod::DOM::Role::HTML' =>
+{
+ -excludes => [qw( emit_anchor emit_index )],
+};
+
+sub emit_anchor
+{
+ my $self = shift;
+ return qq|<a id="|
+ . $self->emit_kids( encode => 'index_anchor' )
+ . qq|"></a>|;
+}
+
+sub emit_index
+{
+ my $self = shift;
+
+ my $content = $self->emit_kids( encode => 'index_anchor' );
+ $content .= $self->id if $self->type eq 'index';
+
+ return qq|<a id="$content"></a>|;
+}
+
+1;

0 comments on commit ba77217

Please sign in to comment.
Something went wrong with that request. Please try again.