App-Basis-ConvertText2

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN


Sparklines are simple horizontal charts to give an indication of things, sometimes they are barcharts but we have nice smooth lines.

The only valid contents of the code-block is a single line of comma separated numbers.

The full set of optional arguments is

* title
    * used as the generated images 'alt' argument
* bgcolor
    * background color in hex (123456) or transparent
* line
    * color or the line, in hex (abcdef)
* color
    * area under the line, in hex (abcdef)
* scheme
    * color scheme, only things in red blue green orange mono are valid
* size
    * size of image, default 80x20, widthxheight

**Example**

README.md  view on Meta::CPAN


This is a complex graph/chart drawing package available from http://glx.sourceforge.net/

The full set of optional arguments is

* title
    * used as the generated images 'alt' argument
* size
    * size of image, default 720x540, widthxheight, size is approximate
* transparent
    * flag to use a transparent background

**Example**

    ~~~~{.gle}

    set font texcmr hei 0.5 just tc

    begin letz
       data "saddle.z"
       z = 3/2*(cos(3/5*(y-1))+5/4)/(1+(((x-4)/3)^2))

docs/README.html  view on Meta::CPAN

            table.box
            {
                margin: 5px;
                text-align: left;
                border-collapse: collapse;
            }
            table.box tr { vertical-align:top;}
            table.box th
            {
                padding: 0px 10px 0px 10px;
                background-color: #ccc;
                font-weight: bold;
                text-align: center;
                border: 1px solid black;
            }
            table.box td
            {
                padding: 0px 10px 0px 10px;
                border: 1px solid black;
            }

docs/README.html  view on Meta::CPAN

<p>Sparklines are simple horizontal charts to give an indication of things, sometimes they are barcharts but we have nice smooth lines.</p>
<p>The only valid contents of the code-block is a single line of comma separated numbers.</p>
<p>The full set of optional arguments is</p>
<ul>
<li>title
<ul>
<li>used as the generated images ‘alt’ argument</li>
</ul></li>
<li>bgcolor
<ul>
<li>background color in hex (123456) or transparent</li>
</ul></li>
<li>line
<ul>
<li>color or the line, in hex (abcdef)</li>
</ul></li>
<li>color
<ul>
<li>area under the line, in hex (abcdef)</li>
</ul></li>
<li>scheme

docs/README.html  view on Meta::CPAN

<li>title
<ul>
<li>used as the generated images ‘alt’ argument</li>
</ul></li>
<li>size
<ul>
<li>size of image, default 720x540, widthxheight, size is approximate</li>
</ul></li>
<li>transparent
<ul>
<li>flag to use a transparent background</li>
</ul></li>
</ul>
<p><strong>Example</strong></p>
<pre><code>~~~~{.gle}

set font texcmr hei 0.5 just tc

begin letz
   data &quot;saddle.z&quot;
   z = 3/2*(cos(3/5*(y-1))+5/4)/(1+(((x-4)/3)^2))

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


create a simple gle image

 parameters
    data   - gle text      
    filename - filename to save the created image as 

 hashref params of
        title       - title to use for image alt attribute
        size        - size of image, widthxheight - optional, default 720x512
        transparent - flag to set background transparent - optional

=cut

sub process {
    my $self = shift;
    my ( $tag, $content, $params, $cachedir ) = @_;
    $params->{size} ||= "720x512";
    my ( $x, $y ) = ( $params->{size} =~ /^\s*(\d+)\s*x\s*(\d+)\s*$/ );

    # strip any ending linefeed

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


=item process (sparkline)

create a simple sparkline image, with some nice defaults

 parameters
    text   - comma separated list of integers for the sparkline
    filename - filename to save the created sparkline image as 

    hashref params of
        bgcolor - background color in hex (123456) or transparent - optional
        line    - color or the line, in hex (abcdef) - optional
        color   - area under the line, in hex (abcdef) - optional
        scheme  - color scheme, only things in red blue green orange mono are valid - optional
        size    - size of image, default 80x20, widthxheight - optional

=cut

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

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

        if ( $content !~ /\n$/sm ) {    # make sure we have a trailing new line
            $content .= "\n";
        }

        if ($scheme) {
            $scheme = lc $scheme;
            if ( !$_colour_schemes{$scheme} ) {
                warn "Unknown color scheme $params->{scheme}";
                $scheme = ( sort keys %_colour_schemes )[0];
            }
            $b = $_colour_schemes{ $params->{scheme} }{b};    # background color
            $a = $_colour_schemes{ $params->{scheme} }{a};    # area under line color
            $l = $_colour_schemes{ $params->{scheme} }{l};    # top line color
        }
        else {
            $b ||= 'transparent';
            $a = 'cccccc';
            $l = '333333';
        }

        my $args = { b => $b, a => $a, l => $l, s => $content, w => $w, h => $h };

t/02_plugins.t  view on Meta::CPAN

}
';
        $obj    = App::Basis::ConvertText2::Plugin::Mscgen->new();
        $params = undef;
        $out    = $obj->process( 'mscgen', $content, $params, $TEST_DIR );
        ok( has_file($out), 'mscgen created a file' );

        # uml
        $content = "'start/enduml tags are optional
\@startuml
skinparam backgroundcolor AntiqueWhite
left to right direction
skinparam packageStyle rect
actor customer
actor clerk
rectangle checkout {
  customer -- (checkout)
  (checkout) .> (payment) : include
  (help) .> (checkout) : extends
  (checkout) -- clerk
}



( run in 0.602 second using v1.01-cache-2.11-cpan-fe3c2283af0 )