App-Basis-ConvertText2

 view release on metacpan or  search on metacpan

bin/ct2  view on Meta::CPAN

);
$format->clean_cache() if ( $opt{clean} );

# be in the same dir as the input file in case there are an files in plugins
# that act on relative paths
my $current = Path::Tiny->cwd;
chdir($basedir);

my $data = $format->parse($story);

# decide on output filename from any format keyword
# all the keywords are in UPPER-CASE
my $keywords = $format->replace;
if ( !$opt{output} && $keywords->{FORMAT} ) {

    # same name as input
    $opt{output} = $opt{filename};

    # change extension
    $opt{output} =~ s/\.md$/.$keywords->{FORMAT}/i;
}

lib/App/Basis/ConvertText2.pm  view on Meta::CPAN

# ----------------------------------------------------------------------------

=item new

Create a new instance of a of a data formating object

B<Parameters>  passed in a HASH
    name        - name of this formatting action - required
    basedir     - root directory of document being processed
    cache_dir   - place to store cache files - optional
    use_cache   - decide if you want to use a cache or not
    template    - HTML template to use, must contain %_CONTENTS_%
    replace     - hashref of extra keywords to use as replaceable variables
    verbose     - be verbose
    embed       - embed images, do not create links to them

=cut

sub BUILD {
    my $self = shift;

lib/App/Basis/ConvertText2/Plugin/Text.pm  view on Meta::CPAN

    my $out = "<table ";
    $out .= "class='$params->{class}' " if ( $params->{class} );
    $out .= "id='$params->{id}' "       if ( $params->{id} );
    $out .= "width='$params->{width}' " if ( $params->{width} );
    $out .= "class='$params->{style}' " if ( $params->{style} );
    $out .= ">\n";

    for ( my $i = 0; $i < scalar(@data); $i++ ) {
        $out .= "<tr>";

        # decide if the top row has the legends
        my $tag = ( !$i && $params->{legends} ) ? 'th' : 'td';
        map { $out .= "<$tag>$_</$tag>"; } @{ $data[$i] };
        $out .= "</tr>\n";
    }

    $out .= "</table>\n";
    return $out;
}

# ----------------------------------------------------------------------------

lib/App/Basis/ConvertText2/Plugin/Text.pm  view on Meta::CPAN

    }

    # make them nice and sorted
    map { $ul .= $uls{$_} } sort keys %uls;
    $ul .= "</ul>\n";

    return "\n" . $references . "\n" . $ul . "\n";
}

# ----------------------------------------------------------------------------
# decide which simple hanlder should process this request

sub process {
    my $self = shift;
    my ( $tag, $content, $params, $cachedir ) = @_;

    if ( $self->can($tag) ) {
        return $self->$tag(@_);
    }
    return undef;
}

lib/App/Basis/ConvertText2/Plugin/Venn.pm  view on Meta::CPAN

    # lose any leading spaces
    $content =~ s/^\s+//s;

    # Set a title, colors and a legend for our chart
    my $colors = $_colour_schemes{ $params->{scheme} } ? $_colour_schemes{ $params->{scheme} } : $_colour_schemes{default};

    $venn_chart->set_options( -title => $params->{title}, -colors => $colors );

    my @legends;

    # decide how to split the legends
    if ( $params->{legends} =~ /,/ ) {
        @legends = map { my $n = $_; $n =~ s/^\s+//; $n } split( /,/, $params->{legends} );
    }
    else {
        @legends = split( /\s/, $params->{legends} );
    }

    # get the venn data, max 3 lines of it
    my $lines = 0;
    my @data;



( run in 1.143 second using v1.01-cache-2.11-cpan-de7293f3b23 )