App-Basis-ConvertText2

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN


Sometimes you may either want to repeatedly use the same information or may want to use the output from one of the fenced code-blocks .

To store data we use the **to_buffer** argument to any code-block.

**Example**

~~~~{.buffer to_buffer='spark_data'}
1,4,5,20,4,5,3,1
~~~~

    ~~~~{.buffer to_buffer='spark_data'}
    1,4,5,20,4,5,3,1
    ~~~~

If the code-block would normally produce some output that we do not want displayed at the current location then we would need to use the **no_output** argument.

**Example**

~~~~{.sparkline title='green sparkline' scheme='green'
    from_buffer='spark_data' to_buffer='greenspark' no_output=1}
~~~~

    ~~~~{.sparkline title='green sparkline' scheme='green'
        from_buffer='spark_data' to_buffer='greenspark' no_output=1}
    ~~~~

We can also have the content of a code-block replaced with content from a buffer by using the **from_buffer** argument. This is also displayed in the example above.

To use the contents (or output of a buffered code-block) we wrap the name of the buffer
once again with percent '%' symbols, once again we force upper case.

**Example**

    _%SPARK_DATA% has content %SPARK_DATA%
    _%GREENSPARK% has a generated image %GREENSPARK%

Buffering also allows us to add content into markdown constructs like bullets.

**Example**

    * _%SPARK_DATA%
    * _%GREENSPARK%

**Output**

* %SPARK_DATA%
* %GREENSPARK%

## Sparklines

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**

    ~~~~{.buffer to_buffer='spark_data'}
    1,4,5,20,4,5,3,1
    ~~~~

    here is a standard sparkline

    ~~~~{.sparkline title='basic sparkline' }
    1,4,5,20,4,5,3,1
    ~~~~

    or we can draw the sparkline using buffered data

    ~~~~{.sparkline title='blue sparkline' scheme='blue' from_buffer='spark_data'}
    ~~~~

**Output**

~~~~{.buffer to_buffer='spark_data'}
1,4,5,20,4,5,3,1
~~~~

here is a standard sparkline

~~~~{.sparkline title='basic sparkline' }
1,4,5,20,4,5,3,1
~~~~

or we can draw the sparkline using buffered data

~~~~{.sparkline title='blue sparkline' scheme='blue' from_buffer='spark_data'}
~~~~

## Charts

Displaying charts is very important when creating reports, so we have a simple **chart** code-block.

The various arguments to the code-block are shown in the examples below, hopefully they are self explanatory.

~~~~{.buffer to='chart_data'}
apples,bananas,cake,cabbage,edam,fromage,tomatoes,chips
1,2,3,5,11,22,33,55
1,2,3,5,11,22,33,55
1,2,3,5,11,22,33,55
1,2,3,5,11,22,33,55
~~~~

We will buffer some data to start

**Example**

README.md  view on Meta::CPAN

The content for this code-block comprises a number of sections, each section then makes a row in the generated table.

    version YYYY-MM-DD
       change text
       more changes

The version may be any string, YYYY-MM-DD shows the date the change took place.
Alternate date formats is DD-MM-YYYY and '/' may also be used as a field separator.

* class
    * HTML/CSS class name
* id
    * HTML/CSS class
* width
    * width of the table
* style
    * style the table if not doing anything else

**Example**

    ~~~~{.version class='versiontable' width='100%'}
    0.1 2014-04-12
      * removed ConvertFile.pm
      * using Path::Tiny rather than other things
      * changed to use pandoc fences
        ~~~~{.tag} rather than xml format <tag>
    0.006 2014-04-10
      * first release to github
    ~~~~

**Output**

~~~~{.version class='versiontable' width='100%'}
0.1 2014-04-12
  * removed ConvertFile.pm
  * using Path::Tiny rather than other things
  * changed to use pandoc fences ~~~~{.tag} rather than xml format <tag>
0.006 2014-04-10
  * first release to github
~~~~

## Start a new page - page

Nice and simple, starts a new page

**Example**

    ~~~~{.page}
    ~~~~

## Gle / glx

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))
       x from 0 to 20 step 0.5
       y from 0 to 20 step 0.5
    end letz

    amove pagewidth()/2 pageheight()-0.1
    write "Saddle Plot (3D)"

    begin object saddle
       begin surface
          size 10 9
          data "saddle.z"
          xtitle "X-axis" hei 0.35 dist 0.7
          ytitle "Y-axis" hei 0.35 dist 0.7
          ztitle "Z-axis" hei 0.35 dist 0.9
          top color blue
          zaxis ticklen 0.1 min 0 hei 0.25
          xaxis hei 0.25 dticks 4 nolast nofirst
          yaxis hei 0.25 dticks 4
       end surface
    end object

    amove pagewidth()/2 0.2
    draw "saddle.bc"
    ~~~~

**Output**

~~~~{.gle}
size 10 9

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))
   x from 0 to 20 step 0.5
   y from 0 to 20 step 0.5
end letz

amove pagewidth()/2 pageheight()-0.1
write "Saddle Plot (3D)"

begin object saddle
   begin surface
      size 10 9
      data "saddle.z"
      xtitle "X-axis" hei 0.35 dist 0.7
      ytitle "Y-axis" hei 0.35 dist 0.7
      ztitle "Z-axis" hei 0.35 dist 0.9
      top color blue



( run in 3.074 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )