Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Support xhtml output
Depend on latest Perl6::Perldoc::To::Ansi and Pod::Xhtml as well.
  • Loading branch information
hinrik committed Jul 1, 2009
1 parent dcc11d1 commit b1e7f47
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 2 additions & 0 deletions Changes
@@ -1,4 +1,6 @@
0.08
- Support xhtml output
- Depend on latest Perl6::Perldoc::To::Ansi
- Fix pager execution on Win32. azawawi++
- Depend on Win32::Console::ANSI on Win32 systems

Expand Down
3 changes: 2 additions & 1 deletion Makefile.PL
Expand Up @@ -17,8 +17,9 @@ requires ('IO::Interactive' => '0');
requires ('File::ShareDir' => '0');
requires ('File::Temp' => '0');
requires ('Perl6::Perldoc' => '0.0.5');
requires ('Perl6::Perldoc::To::Ansi' => '0.03');
requires ('Perl6::Perldoc::To::Ansi' => '0.05');
requires ('Pod::Usage' => '0');
requires ('Pod::Xhtml' => '0');
requires ('Win32::Console::ANSI' => '0') if $^O eq 'MSWin32';
test_requires ('Test::More' => '0');
test_requires ('Test::Script' => '0');
Expand Down
4 changes: 0 additions & 4 deletions lib/App/Grok.pm
Expand Up @@ -49,10 +49,6 @@ sub get_options {
'v|version' => sub { print "grok $VERSION\n"; exit },
) or pod2usage();

if ($opt{format} ne 'text' && $opt{format} ne 'ansi') {
die "Format '$opt{format}' is unsupported\n";
}

die "Too few arguments\n" if !defined $opt{file} && !@ARGV;
}

Expand Down
4 changes: 3 additions & 1 deletion lib/App/Grok/Pod5.pm
Expand Up @@ -15,7 +15,9 @@ sub render {

my $formatter = $format eq 'ansi'
? 'Pod::Text::Color'
: 'Pod::Text'
: $format eq 'xhtml'
? 'Pod::Xhtml'
: 'Pod::Text'
;

eval "require $formatter";
Expand Down
10 changes: 5 additions & 5 deletions lib/App/Grok/Pod6.pm
Expand Up @@ -16,14 +16,14 @@ sub new {
sub render {
my ($self, $file, $format) = @_;

$format eq 'ansi'
? require Perl6::Perldoc::To::Ansi
: require Perl6::Perldoc::To::Text
;
die "Format $format unsupported" if $format !~ /^(?:ansi|text|xhtml)$/;
eval "require Perl6::Perldoc::To::\u$format";
die $@ if $@;

my $method = "to_$format";
return Perl6::Perldoc::Parser->parse($file, {all_pod=>'auto'})
->report_errors()
->to_text();
->$method();
}

1;
Expand Down
2 changes: 1 addition & 1 deletion script/grok
Expand Up @@ -17,7 +17,7 @@ B<grok> <options> <target>
Options:
-F FILE, --file=FILE A file to read Pod 6 from
-f FORMAT, --format=FORMAT The output format, ansi(default) or text
-f FORMAT, --format=FORMAT The output format, ansi/text/xhtml
-h, --help Print this help message
-l, --only Only print the path to the target file
-T, --no-pager Send output to STDOUT without any pager
Expand Down

0 comments on commit b1e7f47

Please sign in to comment.