Doc-Simply

 view release on metacpan or  search on metacpan

lib/Doc/Simply/Assembler.pm  view on Meta::CPAN


sub assemble {
    my $self = shift;
    my $comments = shift;

    my (@blocks, @block);
    my $normalizer = $self->normalizer;

    for my $comment (@$comments) {
        my ($type, $content) = @$comment;
        my @content = split m/\n/, $content;
        if ($type eq "line") {
            @content = map { $normalizer->($_) } @content;
            push @block, @content;
        }
        else {
            push @blocks, [ @block ] if @block;
            undef @block;
            # Normalize leading whitespace
            my $shortest;
            for (@content) {

lib/Doc/Simply/Extractor.pm  view on Meta::CPAN


    return unless $source;

    my (@source, @comments)
    ;
    if (ref $source eq "ARRAY") {
        @source = @$source;
    }
    elsif (ref $source eq "") {
        $source = $fixer->fix_eol($source);
        @source = split m/\n/, $source;
    }
    else {
        croak "Don't understand source $source";
    }

    my $filter = $self->filter;

    {
        local $_;
        for my $line (@source) {

t/004-parser.t  view on Meta::CPAN


use Doc::Simply;
use Doc::Simply::Extractor;
use Doc::Simply::Assembler;
use Doc::Simply::Parser;

plan qw/no_plan/;

sub normalize {
    local $_ = shift;
    return join "\n", map { s/^\s*//; s/\s*$//; $_ } split m/\n/;
}

{
    my $content;
    my $source = <<'_END_';
/* 
 * @head2 This is a node
 */

// This should not be



( run in 0.621 second using v1.01-cache-2.11-cpan-71847e10f99 )