/
ppp-Documentation.html
480 lines (463 loc) · 19 KB
/
ppp-Documentation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<meta name="author" content="Daniel Bruder" />
<title>ppp Documentation</title>
<style type="text/css">code{white-space: pre;}</style>
</head>
<body>
<div id="header">
<h1 class="title"><code>ppp</code> Documentation</h1>
<h2 class="author">Daniel Bruder</h2>
<h3 class="date">Version 0.9.0</h3>
</div>
<!-- <#ifdef HANDOUT>
Explanation of the gpp feature ...
<#endif>
-->
<p></p>
<h1 id="abstract"><span class="header-section-number">1</span> Abstract</h1>
<p><em><code>ppp</code> allows you to use pandoc in new ways by rendering ASCII-markup to beautiful pictures right from within pandoc’s verbatim environments.</em></p>
<p><em>See below for illustrative examples and detailed usage instructions.</em></p>
<p><em>Bonus on top: Leaving out <code>ppp</code> form the typesetting pipeline will still render your document and the verbatims with the ASCII-markup will still stay readable!</em></p>
<hr />
<p></p>
<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="Some label for the figure"</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="The ppp and pandoc pipeline"
.label=fig:pipeline-overview
.no-antialias .no-separation}
# Caution! These lines actually would have to be on *one* line only!
+-----------------+ +--------+ +--------------------+
| markdown source |------>| ppp |------*--->| pröcessed markdown |
+-----------------+ +--------+ | +--------------------+
| \--->| 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="The ppp and pandoc pipeline #2" .label=fig:pipeline-overview-2}
+-----------------+ +--------+ +--------------------+
| markdown source |------>| ppp |------*--->| pröcessed markdown |
+-----------------+ +--------+ | +--------------------+
| \--->| 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>dot</code>.</p>
<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 -> LR_2 [ label = "SS(B)" ];
LR_0 -> LR_1 [ label = "SS(S)" ];
LR_1 -> LR_3 [ label = "S($end)" ];
LR_2 -> LR_6 [ label = "SS(b)" ];
LR_2 -> LR_5 [ label = "SS(a)" ];
LR_2 -> LR_4 [ label = "S(A)" ];
LR_5 -> LR_7 [ label = "S(b)" ];
LR_5 -> LR_5 [ label = "S(a)" ];
LR_6 -> LR_6 [ label = "S(b)" ];
LR_6 -> LR_5 [ label = "S(a)" ];
LR_7 -> LR_8 [ label = "S(b)" ];
LR_7 -> LR_5 [ label = "S(a)" ];
LR_8 -> LR_6 [ label = "S(b)" ];
LR_8 -> LR_5 [ label = "S(a)" ];
}
~~~~~</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 -> *[Order]
[Order] ++1 -items> *[LineItem]
[Order] -0..1> [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)<(Add Milk)
(Make Cup of Tea)>(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)->|a|,|a|->(Make Coffee)->|b|,|a|->(Make Breakfast)->|b|,|b|-><c>[want more coffee]->(Make Coffee),<c>[satisfied]->(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
[*] --> NotShooting
state NotShooting {
[*] --> Idle
Idle --> Configuring : EvConfig
Configuring --> Idle : EvConfig
}
state Configuring {
[*] --> NewValueSelection
NewValueSelection --> NewValuePreview : EvNewValue
NewValuePreview --> NewValueSelection : EvNewValueRejected
NewValuePreview --> NewValueSelection : EvNewValueSaved
state NewValuePreview {
State1 -> 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 "First Class" as A
participant "Second Class" as B
participant "Last Class" as C
User -> A: DoWork
activate A
A -> B: Create Request
activate B
B -> C: DoWork
activate C
C --> B: WorkDone
destroy C
B --> A: Request Created
deactivate B
A --> 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="fig:rdfdot-diagram"}
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@base <http://example.com/> .
<alice> foaf:name "Alice" ;
foaf:knows [ foaf:name "Bob" ] .
~~~~~</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>"Some label for the figure"</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>
</tr>
<tr class="even">
<td align="center">yUML</td>
<td align="center"><code>.type=</code></td>
<td align="center">any of <code>[</code> <code>class</code>, <code>activity</code>, <code>usecase</code> <code>]</code></td>
</tr>
<tr class="odd">
<td align="center"></td>
<td align="center"><code>.style=</code></td>
<td align="center">any of <code>[</code> <code>scruffy</code>, <code>nofunky</code>, <code>plain</code> <code>]</code></td>
</tr>
<tr class="even">
<td align="center"></td>
<td align="center"><code>.direction=</code></td>
<td align="center">any of <code>[</code> <code>LR</code>, <code>RL</code>, <code>TD</code>, <code>]</code></td>
</tr>
<tr class="odd">
<td align="center">rdfdot</td>
<td align="center">N/A</td>
<td align="center"></td>
</tr>
</tbody>
</table>
<p></p>
<h1 id="list-of-homepages-and-documentation-to-renderers"><span class="header-section-number">10</span> List of homepages and documentation to renderers</h1>
<table>
<caption>List of options</caption>
<col width="15%" />
<col width="84%" />
<thead>
<tr class="header">
<th align="left">Renderer</th>
<th align="left">Links</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">ppp</td>
<td align="left">(this document)</td>
</tr>
<tr class="even">
<td align="left"></td>
<td align="left"><a href="https://metacpan.org/release/App-pandoc-preprocess">https://metacpan.org/release/App-pandoc-preprocess</a></td>
</tr>
<tr class="odd">
<td align="left"></td>
<td align="left"><a href="https://github.com/xdbr/p5-App-pandoc-preprocess">https://github.com/xdbr/p5-App-pandoc-preprocess</a></td>
</tr>
<tr class="even">
<td align="left">ditaa</td>
<td align="left"><a href="http://ditaa.sourceforge.net/">http://ditaa.sourceforge.net/</a></td>
</tr>
<tr class="odd">
<td align="left">dot</td>
<td align="left"><a href="http://www.graphviz.org/">http://www.graphviz.org/</a></td>
</tr>
<tr class="even">
<td align="left">neato</td>
<td align="left"><a href="http://www.graphviz.org/">http://www.graphviz.org/</a></td>
</tr>
<tr class="odd">
<td align="left">yUML</td>
<td align="left"><a href="http://yuml.me/">http://yuml.me/</a></td>
</tr>
<tr class="even">
<td align="left"></td>
<td align="left"><a href="https://github.com/wandernauta/yuml">https://github.com/wandernauta/yuml</a></td>
</tr>
<tr class="odd">
<td align="left">rdfdot</td>
<td align="left"><a href="https://metacpan.org/pod/RDF::Trine::Exporter::GraphViz">https://metacpan.org/pod/RDF::Trine::Exporter::GraphViz</a></td>
</tr>
<tr class="even">
<td align="left">plantuml</td>
<td align="left"><a href="http://plantuml.sourceforge.net/">http://plantuml.sourceforge.net/</a></td>
</tr>
</tbody>
</table>
<h1 id="credits-and-further-references"><span class="header-section-number">11</span> Credits and further references</h1>
<ul>
<li><a href="http://www.asciiflow.com/#Draw">http://www.asciiflow.com/#Draw</a>: an excellent helper for all things diagram</li>
<li><a href="http://randomdeterminism.wordpress.com/2012/06/01/how-i-stopped-worring-and-started-using-markdown-like-tex/">http://randomdeterminism.wordpress.com/2012/06/01/how-i-stopped-worring-and-started-using-markdown-like-tex/</a>: general introduction to another approach to typesetting and using <code>gpp</code></li>
<li><a href="https://github.com/nichtich/ditaa-markdown">https://github.com/nichtich/ditaa-markdown</a>: This is where the original idea came from</li>
<li>gpp: <a href="http://files.nothingisreal.com/software/gpp/gpp.html">http://files.nothingisreal.com/software/gpp/gpp.html</a></li>
</ul>
<p></p>
<hr />
</body>
</html>