App-pandoc-preprocess

 view release on metacpan or  search on metacpan

ppp-Documentation.html  view on Meta::CPAN

<h1 id="general-usage"><span class="header-section-number">2</span> General usage</h1>
<p>In each case, you will use pandoc’s verbatim environment, set the rendering engine and additional options:</p>
<pre><code>~~~~~ {.renderer .option1 .option2=value2}
 --- RENDERER-SPECIFIC MARKUP GOES HERE ---
~~~~~</code></pre>
<h2 id="general-renderers"><span class="header-section-number">2.1</span> General Renderers</h2>
<p>The renderers available to <code>ppp</code> are:</p>
<ul>
<li>ditaa</li>
<li>yuml diagrams:
<ul>
<li>class diagramas (cf. Figure )</li>
<li>usecase diagramas (cf. Figure )</li>
<li>activity diagramas (cf. Figure )</li>
</ul></li>
<li>dot</li>
<li>neato</li>
<li>rdfdot</li>
<li>plantuml</li>
</ul>
<h2 id="general-options"><span class="header-section-number">2.2</span> General Options</h2>
<p>This is a list of the general options, compatible with any type of renderer:</p>
<ul>
<li><code>.scale=90%</code></li>
<li><code>.label=fig:my-figure</code></li>
<li><code>.title=&quot;Some label for the figure&quot;</code></li>
</ul>
<hr />
<p></p>
<h1 id="ditaa-diagrams"><span class="header-section-number">3</span> ditaa Diagrams</h1>
<p>In order to generate <code>ditaa</code>-diagrams, ditaa needs to be installed.</p>
<p>For an exhaustive list of options and possibilities, please check the <a href="http://ditaa.sourceforge.net/">ditaa homepage</a>.</p>
<h2 id="ditaa-options"><span class="header-section-number">3.1</span> ditaa Options</h2>
<p>Apart from the <a href="#general-options">General Options</a>, the possible options specific to ditaa are:</p>
<ul>
<li><code>.rounded-corners</code></li>
<li><code>.no-shadows</code></li>
<li><code>.no-antialias</code></li>
<li><code>.no-separation</code></li>
</ul>
<h2 id="ditaa-examples"><span class="header-section-number">3.2</span> ditaa Examples</h2>
<p>Using ditaa, the following markup will produce Figure .</p>
<p></p>
<pre><code>~~~~~ {.ditaa .rounded-corners .no-shadows .scale=90%
       .title=&quot;The ppp and pandoc pipeline&quot;
       .label=fig:pipeline-overview 
       .no-antialias .no-separation}
# Caution! These lines actually would have to be on *one* line only!
+-----------------+       +--------+           +--------------------+
| markdown source |------&gt;| ppp    |------*---&gt;| pröcessed markdown |
+-----------------+       +--------+      |    +--------------------+
                              |           \---&gt;| image files        |
                    +------------------+       +--------------------+
                    | diagram creation |
                    +------------------+
                    | ditaa/dot/rdfdot |
                    +------------------+
~~~~~</code></pre>
<p></p>
<div class="figure">
<img src="tmp/ppp-render-816xh/image-1.png" alt="The ppp and pandoc pipeline" /><p class="caption">“The ppp and pandoc pipeline”</p>
</div>
<div class="figure">
<img src="tmp/ppp-render-816xh/image-2.png" alt="The ppp and pandoc pipeline" /><p class="caption">“The ppp and pandoc pipeline”</p>
</div>
<p>As a contrast, turning off several options, ditaa will produce an output as in Figure :</p>
<p></p>
<pre><code>~~~~~ {.ditaa .scale=90% .title=&quot;The ppp and pandoc pipeline #2&quot; .label=fig:pipeline-overview-2}
+-----------------+       +--------+           +--------------------+
| markdown source |------&gt;| ppp    |------*---&gt;| pröcessed markdown |
+-----------------+       +--------+      |    +--------------------+
                              |           \---&gt;| image files        |
                    +------------------+       +--------------------+
                    | diagram creation |
                    +------------------+
                    | ditaa/dot/rdfdot |
                    +------------------+
~~~~~</code></pre>
<p></p>
<div class="figure">
<img src="tmp/ppp-render-816xh/image-3.png" alt="The ppp and pandoc pipeline #2" /><p class="caption">“The ppp and pandoc pipeline #2”</p>
</div>
<hr />
<p></p>
<h1 id="dot-diagrams"><span class="header-section-number">4</span> dot Diagrams</h1>
<p><code>dot</code> rendering is done through <a href="http://www.graphviz.org/">GraphViz</a>’s engine. Please cf. <a href="http://www.graphviz.org/Documentation.php">Graphviz’s Documentation</a> for exact usage specifics on the usage of <code>do...
<h2 id="dot-options"><span class="header-section-number">4.1</span> dot Options</h2>
<ul>
<li>currently none apart from the <a href="#general-options">General Options</a></li>
</ul>
<h2 id="dot-examples"><span class="header-section-number">4.2</span> dot Examples</h2>
<p>With <code>dot</code> as the <em>renderer</em>, the following markup produces the figure as seen in Figure .</p>
<p></p>
<pre><code>~~~~~ {.dot .scale=50% .title=dot Finite State Automaton .label=fig:dot-fsa}
digraph finite_state_machine {
  rankdir=LR;
  node [shape = doublecircle]; LR_0 LR_3 LR_4 LR_8;
  node [shape = circle];
  LR_0 -&gt; LR_2 [ label = &quot;SS(B)&quot; ];
  LR_0 -&gt; LR_1 [ label = &quot;SS(S)&quot; ];
  LR_1 -&gt; LR_3 [ label = &quot;S($end)&quot; ];
  LR_2 -&gt; LR_6 [ label = &quot;SS(b)&quot; ];
  LR_2 -&gt; LR_5 [ label = &quot;SS(a)&quot; ];
  LR_2 -&gt; LR_4 [ label = &quot;S(A)&quot; ];
  LR_5 -&gt; LR_7 [ label = &quot;S(b)&quot; ];
  LR_5 -&gt; LR_5 [ label = &quot;S(a)&quot; ];
  LR_6 -&gt; LR_6 [ label = &quot;S(b)&quot; ];
  LR_6 -&gt; LR_5 [ label = &quot;S(a)&quot; ];
  LR_7 -&gt; LR_8 [ label = &quot;S(b)&quot; ];
  LR_7 -&gt; LR_5 [ label = &quot;S(a)&quot; ];
  LR_8 -&gt; LR_6 [ label = &quot;S(b)&quot; ];
  LR_8 -&gt; LR_5 [ label = &quot;S(a)&quot; ];
}
~~~~~</code></pre>
<p></p>
<div class="figure">
<img src="tmp/ppp-render-816xh/image-4.png" alt="dot Finite State Automaton" /><p class="caption">dot Finite State Automaton</p>
</div>
<hr />
<p></p>
<h1 id="neato-diagrams"><span class="header-section-number">5</span> neato Diagrams</h1>
<p><code>neato</code> diagrams behave very similarly to <a href="#dot-diagrams">dot Diagrams</a>. Please cf <a href="#dot-diagrams">dot Diagrams</a> for more information</p>
<h2 id="neato-options"><span class="header-section-number">5.1</span> neato Options</h2>
<ul>
<li>same as <a href="#dot-options">dot Options</a></li>
</ul>
<h2 id="neato-examples"><span class="header-section-number">5.2</span> neato Examples</h2>
<p>The following example produces Figure .</p>
<p></p>
<pre><code>~~~~~ {.neato .scale=80% .title=neato diagram .label=fig:neato-diagram}
graph G {
  n0 -- n1 -- n2 -- n3 -- n0;
}
~~~~~</code></pre>
<p></p>
<div class="figure">
<img src="tmp/ppp-render-816xh/image-5.png" alt="neato diagram" /><p class="caption">neato diagram</p>
</div>
<hr />
<p></p>
<h1 id="yuml"><span class="header-section-number">6</span> yUML</h1>
<p>yUML needs a network connection and uses http://yuml.me as the rendering service.</p>
<h2 id="yuml-options"><span class="header-section-number">6.1</span> yUML Options</h2>
<p>Options specific to yUML can be:</p>
<ul>
<li><code>.type=</code>: any of <code>[</code> <code>class</code>, <code>activity</code>, <code>usecase</code> <code>]</code></li>
<li><code>.style=</code>: any of <code>[</code> <code>scruffy</code>, <code>nofunky</code>, <code>plain</code> <code>]</code></li>
<li><code>.direction=</code>: any of <code>[</code> <code>LR</code>, <code>RL</code>, <code>TD</code>, <code>]</code></li>
</ul>
<!-- * `.format=`: `png`, `pdf`, `jpg`, `svg` -->
<!-- * `.scale=`: `10%`-`200%` -->

<h2 id="yuml-examples"><span class="header-section-number">6.2</span> yUML Examples</h2>
<h3 id="yuml-class-diagrams"><span class="header-section-number">6.2.1</span> yUML Class diagrams</h3>
<p>With <em>yUML</em> as the renderer, setting <code>.type=class</code> and using the style <code>.style=nofunky</code>, the following markup produces Figure .</p>
<p></p>
<pre><code>~~~~ {.yuml .style=nofunky .type=class .direction=LR .scale=100% .title=yUML class diagram .label=fig:yuml-class-diagram}
[Customer] +1 -&gt;        *[Order]
[Order]   ++1 -items&gt;   *[LineItem]
[Order]       -0..1&gt;     [PaymentMethod]
~~~~</code></pre>
<p></p>
<div class="figure">
<img src="tmp/ppp-render-816xh/image-6.png" alt="yUML class diagram" /><p class="caption">yUML class diagram</p>
</div>
<p></p>
<h3 id="yuml-usecase-diagrams"><span class="header-section-number">6.2.2</span> yuml Usecase diagrams</h3>
<p>With <code>scruffy</code> style and <code>.type=usecase</code>, the following example produces Figure .</p>
<p></p>
<pre><code>~~~~ {.yuml .style=scruffy .type=usecase .title=yUML usecase diagram .label=fig:yuml-usecase-diagram}
// Cool Use Case Diagram
[Customer]-(Make Cup of Tea)
(Make Cup of Tea)&lt;(Add Milk)
(Make Cup of Tea)&gt;(Add Tea Bag)
~~~~</code></pre>
<p></p>
<div class="figure">
<img src="tmp/ppp-render-816xh/image-7.png" alt="yUML usecase diagram" /><p class="caption">yUML usecase diagram</p>
</div>
<p></p>
<h3 id="yuml-activity-diagrams"><span class="header-section-number">6.2.3</span> yuml Activity diagrams</h3>
<p>Lastly, using <code>.type=activity</code> and <code>.style=plain</code> the following example produces Figure .</p>
<p></p>
<pre><code>~~~~ {.yuml .style=plain .type=activity .title=yUML activity Diagram .label=fig:yuml-activity-diagram}
(start)-&gt;|a|,|a|-&gt;(Make Coffee)-&gt;|b|,|a|-&gt;(Make Breakfast)-&gt;|b|,|b|-&gt;&lt;c&gt;[want more coffee]-&gt;(Make Coffee),&lt;c&gt;[satisfied]-&gt;(end)
~~~~</code></pre>
<p></p>
<div class="figure">
<img src="tmp/ppp-render-816xh/image-8.png" alt="yUML activity Diagram" /><p class="caption">yUML activity Diagram</p>
</div>
<!-- ~~~~ {.yuml .style=nofunky .type=class }
[               Company
             <<singleton>>
 ===================================
 +give_me_a_rise (employee : Person)
 +please_hire_me (prospect : Person) ]

[        Person
 -----------------------
 -name : String
 -----------------------
 +you_re_fired () : void ]

[Company] 1 employer <@>--- "< works for" employee 1..n [Person] 1 boss --- flunkies 1..* [Person]
~~~~ -->

<hr />
<p></p>
<h1 id="plantuml"><span class="header-section-number">7</span> plantuml</h1>
<p>plantuml – based on graphviz –, has an extensive feature set</p>
<h2 id="plantuml-options"><span class="header-section-number">7.1</span> plantuml Options</h2>
<ul>
<li><em>General Options</em></li>
</ul>
<h2 id="plantuml-examples"><span class="header-section-number">7.2</span> plantuml Examples</h2>
<h3 id="plantuml-example-1"><span class="header-section-number">7.2.1</span> plantuml Example 1</h3>
<p>With <em>plantuml</em> as the renderer, the following markup produces Figure .</p>
<p></p>
<pre><code>~~~~ {.plantuml .scale=60% .title=PlantUML Example 1 .label=fig:plantuml-example-1}
@startuml
scale 350 width
[*] --&gt; NotShooting

state NotShooting {
  [*] --&gt; Idle
  Idle --&gt; Configuring : EvConfig
  Configuring --&gt; Idle : EvConfig
}

state Configuring {
  [*] --&gt; NewValueSelection
  NewValueSelection --&gt; NewValuePreview : EvNewValue
  NewValuePreview --&gt; NewValueSelection : EvNewValueRejected
  NewValuePreview --&gt; NewValueSelection : EvNewValueSaved

  state NewValuePreview {
     State1 -&gt; State2
  }

}
@enduml
~~~~</code></pre>
<p></p>
<div class="figure">
<img src="tmp/ppp-render-816xh/image-9.png" alt="PlantUML Example 1" /><p class="caption">PlantUML Example 1</p>
</div>
<p></p>
<h3 id="plantuml-example-2"><span class="header-section-number">7.2.2</span> plantuml Example 2</h3>
<p>If the colors don’t match your taste exactly, add <code>skinparam monochrome true</code> to retrieve Figure .</p>
<p></p>
<pre><code>~~~~ {.plantuml .scale=120% .title=PlantUML Example 2 .label=fig:plantuml-example-2}
@startuml

skinparam monochrome true

actor User
participant &quot;First Class&quot; as A
participant &quot;Second Class&quot; as B
participant &quot;Last Class&quot; as C

User -&gt; A: DoWork
activate A

A -&gt; B: Create Request
activate B

B -&gt; C: DoWork
activate C
C --&gt; B: WorkDone
destroy C

B --&gt; A: Request Created
deactivate B

A --&gt; User: Done
deactivate A

@enduml
~~~~</code></pre>
<p></p>
<div class="figure">
<img src="tmp/ppp-render-816xh/image-10.png" alt="PlantUML Example 2" /><p class="caption">PlantUML Example 2</p>
</div>
<p></p>
<hr />
<p></p>
<h1 id="rdfdot-diagrams"><span class="header-section-number">8</span> rdfdot Diagrams</h1>
<h2 id="rdfdot-options"><span class="header-section-number">8.1</span> rdfdot Options</h2>
<ul>
<li>currently none apart from the <a href="#general-options">General Options</a></li>
</ul>
<h2 id="rdfdot-examples"><span class="header-section-number">8.2</span> rdfdot Examples</h2>
<p>The following example produces Figure  on page .</p>
<p></p>
<pre><code>~~~~~ {.rdfdot .scale=150% .title=rdfdot Diagram .label=&quot;fig:rdfdot-diagram&quot;}
@prefix foaf: &lt;http://xmlns.com/foaf/0.1/&gt; .
@base &lt;http://example.com/&gt; .
&lt;alice&gt; foaf:name &quot;Alice&quot; ;
        foaf:knows [ foaf:name &quot;Bob&quot; ] .
~~~~~</code></pre>
<p></p>
<div class="figure">
<img src="tmp/ppp-render-816xh/image-11.png" alt="rdfdot Diagram" /><p class="caption">rdfdot Diagram</p>
</div>
<p></p>
<h1 id="list-of-options"><span class="header-section-number">9</span> List of options</h1>
<table>
<caption>List of options</caption>
<col width="30%" />
<col width="36%" />
<col width="27%" />
<thead>
<tr class="header">
<th align="center">Renderer</th>
<th align="center">Option</th>
<th align="center">possible values</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="center"><em>General</em></td>
<td align="center"><code>.scale</code></td>
<td align="center">e.g. <code>120%</code></td>
</tr>
<tr class="even">
<td align="center"></td>
<td align="center"><code>.label</code></td>
<td align="center"><code>fig:my-figure</code></td>
</tr>
<tr class="odd">
<td align="center"></td>
<td align="center"><code>.title</code></td>
<td align="center"><code>&quot;Some label for the figure&quot;</code></td>
</tr>
<tr class="even">
<td align="center">ditaa</td>
<td align="center"><code>.rounded-corners</code></td>
<td align="center"></td>
</tr>
<tr class="odd">
<td align="center"></td>
<td align="center"><code>.no-shadows</code></td>
<td align="center"></td>
</tr>
<tr class="even">
<td align="center"></td>
<td align="center"><code>.no-antialias</code></td>
<td align="center"></td>
</tr>
<tr class="odd">
<td align="center"></td>
<td align="center"><code>.no-separation</code></td>
<td align="center"></td>
</tr>
<tr class="even">
<td align="center">dot</td>
<td align="center">N/A</td>
<td align="center"></td>
</tr>
<tr class="odd">
<td align="center">neato</td>
<td align="center">N/A</td>
<td align="center"></td>



( run in 0.581 second using v1.01-cache-2.11-cpan-788537b7465 )