EPublisher-Target-Plugin-OTRSDoc
view release on metacpan or search on metacpan
lib/EPublisher/Target/Plugin/OTRSDoc.pm view on Meta::CPAN
## Change behavour of Pod::Simple::XHTML
## -------------------------------------------------------------------------- ##
{
no warnings 'redefine';
*Pod::Simple::XHTML::idify = sub {
my ($self, $t, $not_unique) = @_;
for ($t) {
s/<[^>]+>//g; # Strip HTML.
s/&[^;]+;//g; # Strip entities.
s/^([^a-zA-Z]+)$/pod$1/; # Prepend "pod" if no valid chars.
s/^[^a-zA-Z]+//; # First char must be a letter.
s/[^-a-zA-Z0-9_]+/-/g; # All other chars must be valid.
}
return $t if $not_unique;
my $i = '';
$i++ while $self->{ids}{"$t$i"}++;
return "$t$i";
};
*Pod::Simple::XHTML::start_Verbatim = sub {};
*Pod::Simple::XHTML::end_Verbatim = sub {
my ($self) = @_;
$self->{scratch} =~ s{ }{ }g;
$self->{scratch} =~ s{\n}{<br />}g;
#$self->{scratch} = '<div class="code">' . $self->{scratch} . '</div>';
$self->{scratch} = '<p><code class="code">' . $self->{scratch} . '</code></p>';
$self->emit;
};
*Pod::Simple::XHTML::start_L = sub {
# The main code is taken from Pod::Simple::XHTML.
my ( $self, $flags ) = @_;
my ( $type, $to, $section ) = @{$flags}{ 'type', 'to', 'section' };
my $url =
$type eq 'url' ? $to
: $type eq 'pod' ? $self->resolve_pod_page_link( $to, $section )
: $type eq 'man' ? $self->resolve_man_page_link( $to, $section )
: undef;
# This is the new/overridden section.
if ( defined $url ) {
$url = $self->encode_entities( $url );
}
# If it's an unknown type, use an attribute-less <a> like HTML.pm.
$self->{'scratch'} .= '<a' . ( $url ? ' href="' . $url . '">' : '>' );
};
*Pod::Simple::XHTML::start_Document = sub {
my ($self) = @_;
#my $xhtml_headers =
# qq{<?xml version="1.0" encoding="UTF-8"?>\n}
# . qq{<!DOCTYPE html\n}
# . qq{ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n}
# . qq{ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n} . qq{\n}
# . qq{<html xmlns="http://www.w3.org/1999/xhtml">\n}
# . qq{<head>\n}
# . qq{<title></title>\n}
# . qq{<meta http-equiv="Content-Type" }
# . qq{content="text/html; charset=utf-8"/>\n}
# . qq{<link rel="stylesheet" href="../styles/style.css" }
# . qq{type="text/css"/>\n}
# . qq{</head>\n} . qq{\n}
# . qq{<body>\n};
#$self->{'scratch'} .= $xhtml_headers;
$self->emit('nowrap');
};
}
1;
=pod
=encoding UTF-8
=head1 NAME
EPublisher::Target::Plugin::OTRSDoc - Create HTML version of OTRS documentation
=head1 VERSION
version 1.01
=head1 SYNOPSIS
use EPublisher::Target;
my $EPub = EPublisher::Target->new( { type => 'OTRSDoc' } );
$EPub->deploy;
=head1 METHODS
=head2 deploy
creates the output.
$EPub->deploy;
=head1 YAML SPEC
EPubTest:
source:
#...
target:
type: ÃTRSDoc
=head1 TODO
=head2 document methods
=head1 AUTHOR
Renee Bäcker <module@renee-baecker.de>
( run in 2.055 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )