Provider simplier validation and an example

This commit is contained in:
Andrey Mayorov 2016-01-26 14:41:59 +03:00
parent 1e1d42e062
commit 0a27d75a78
5 changed files with 99 additions and 4 deletions

31
README.md Normal file
View File

@ -0,0 +1,31 @@
# Plantuml toolset
A couple of helpful shortcuts to generate `svg` or `png` images out of [plantuml](http://plantuml.com) diagrams. Wacky skin included.
See it yourself:
<img src="examples/conversation.png" width="60%" />
## Using
It is better to include it in your handcrafted `Makefile` like that:
```
include plantuml-toolset/wsd.mk
...
```
After that you can invoke it in a number of ways:
```shell
# Find all *.wsd in the current directory and make svg's out of them
$ make
# Same but make png's
$ make FORMAT=png
# Make examples/conversation.png
$ make FORMAT=png examples/conversation.wsd
```
> _The more you know._ If you want to render png's properly be sure to install [Neucha](https://www.google.com/fonts/specimen/Neucha) system wide.

BIN
examples/conversation.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

45
examples/conversation.svg Normal file
View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="297px" style="width:187px;height:297px;" version="1.1" viewBox="0 0 187 297" width="187px">
<defs/>
<g>
<style type="text/css">
@font-face {
font-family: 'Neucha';
font-style: normal;
font-weight: 400;
src: local('Neucha'), url(https://fonts.gstatic.com/s/neucha/v8/kum-AEgHOi-eoGXxKfEluA.ttf) format('truetype');
}
</style>
<text fill="#606060" font-family="Neucha" font-size="12" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="124" x="35.25" y="19.7969">The Meaningless Coversation</text>
<polygon fill="#FFFFFF" points="21,146.9609,21,146.794,23,146.9306,25,146.9933,27,147.1062,29,147.0412,31,146.9609,31.1414,146.9609,31.0377,152.9609,31.0691,158.9609,30.8815,164.9609,31.1035,170.9609,31,176.9609,31,176.9613,29,176.9114,27,177.1229,25,176.9572,23,177.0314,21,176.9609,21.0686,176.9609,20.9162,170.9609,20.9636,164.9609,21.1252,158.9609,21.2053,152.9609,21,146.9609" style="stroke: #303030; stroke-width: 1.0;"/>
<path d="M26,60.6406 L25.7914,60.6406 L26.1803,68.3047 L25.7752,75.9688 L25.7404,83.6328 L25.7614,91.2969 L26,98.9609 " fill="none" style="stroke: #303030; stroke-width: 1.0;"/>
<path d="M26,98.9609 L25.7238,98.9609 L25.9597,104.5609 L25.9449,110.1609 L26.215,115.7609 L26.1781,121.3609 L26,126.9609 " fill="none" style="stroke: #303030; stroke-width: 1.0; stroke-dasharray: 1.0,4.0;"/>
<path d="M26,126.9609 L26.8298,126.9609 L25.1583,137.1319 L25.0141,147.303 L26.1129,157.474 L26.728,167.645 L25.163,177.816 L25.0275,187.987 L25.85,198.158 L26.4118,208.329 L26,218.5 " fill="none" style="stroke: #303030; stroke-width: 1.0;"/>
<path d="M26,218.5 L26.1829,218.5 L26.0097,226.5234 L25.9073,234.5469 L26.1272,242.5703 L26.079,250.5938 L26,258.6172 " fill="none" style="stroke: #303030; stroke-width: 1.0; stroke-dasharray: 1.0,4.0;"/>
<path d="M26,258.6172 L26.2909,258.6172 L25.9078,266.2813 L26.2641,273.9453 L25.9281,281.6094 L25.8524,289.2734 L26,296.9375 " fill="none" style="stroke: #303030; stroke-width: 1.0;"/>
<path d="M169.5,60.6406 L169.3585,60.6406 L169.221,68.3047 L169.4827,75.9688 L169.6324,83.6328 L169.2872,91.2969 L169.5,98.9609 " fill="none" style="stroke: #303030; stroke-width: 1.0;"/>
<path d="M169.5,98.9609 L169.175,98.9609 L169.2952,104.5609 L169.5507,110.1609 L169.2957,115.7609 L169.3527,121.3609 L169.5,126.9609 " fill="none" style="stroke: #303030; stroke-width: 1.0; stroke-dasharray: 1.0,4.0;"/>
<path d="M169.5,126.9609 L169.8869,126.9609 L170.4502,137.1319 L169.3177,147.303 L169.2605,157.474 L169.1604,167.645 L169.4447,177.816 L169.6274,187.987 L170.402,198.158 L168.9936,208.329 L169.5,218.5 " fill="none" style="stroke: #303030; stroke-width: 1.0;"/>
<path d="M169.5,218.5 L169.3083,218.5 L169.1721,226.5234 L169.4596,234.5469 L169.5334,242.5703 L169.6935,250.5938 L169.5,258.6172 " fill="none" style="stroke: #303030; stroke-width: 1.0; stroke-dasharray: 1.0,4.0;"/>
<path d="M169.5,258.6172 L169.2687,258.6172 L169.3894,266.2813 L169.3809,273.9453 L169.2589,281.6094 L169.2772,289.2734 L169.5,296.9375 " fill="none" style="stroke: #303030; stroke-width: 1.0;"/>
<polygon fill="#FEFEFE" points="8,30.2188,8,30.0509,15.2,30.29,22.4,29.9829,29.6,30.3604,36.8,30.4539,44,30.2188,44.1715,30.2188,43.7766,36.1031,44.1524,41.9875,44.1269,47.8719,43.893,53.7563,44,59.6406,44,59.4328,36.8,59.451,29.6,59.6809,22.4,59.5102,15.2,59.4589,8,59.6406,7.7608,59.6406,8.0046,53.7563,8.0842,47.8719,7.9447,41.9875,7.7537,36.1031,8,30.2188" style="stroke: #303030; stroke-width: 1.5;"/>
<text fill="#000000" font-family="Neucha" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="22" x="15" y="48.6484">Alice</text>
<polygon fill="#FEFEFE" points="153.5,30.2188,153.5,30.1512,160.1,30.0709,166.7,30.3422,173.3,30.1653,179.9,30.2539,186.5,30.2188,186.2622,30.2188,186.6535,36.1031,186.5861,41.9875,186.6387,47.8719,186.7393,53.7563,186.5,59.6406,186.5,59.6143,179.9,59.8203,173.3,59.853,166.7,59.8773,160.1,59.5924,153.5,59.6406,153.6968,59.6406,153.5317,53.7563,153.4521,47.8719,153.3679,41.9875,153.5615,36.1031,153.5,30.2188" style="stroke: #303030; stroke-width: 1.5;"/>
<text fill="#000000" font-family="Neucha" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="19" x="160.5" y="48.6484">Bob</text>
<polygon fill="#FFFFFF" points="21,146.9609,21,147.1415,23,146.8585,25,147.1843,27,147.1812,29,147.014,31,146.9609,31.1344,146.9609,30.8554,152.9609,30.887,158.9609,31.1405,164.9609,31.0155,170.9609,31,176.9609,31,177.0782,29,177.1426,27,177.1478,25,176.8098,23,177.0378,21,176.9609,20.7899,176.9609,20.7706,170.9609,21.0235,164.9609,20.8066,158.9609,20.9805,152.9609,21,146.9609" style="stroke: #303030; stroke-width: 1.0;"/>
<polygon fill="#303030" points="158,86.6406,158.0017,86.645,159.9274,87.2591,161.9551,88.1284,163.9343,88.8765,165.952,89.7206,168,90.6406,168.0826,90.8471,166.0534,91.574,164.0925,92.4718,162.0666,93.207,160.091,94.068,158,94.6406,158.172,94.8126,158.9405,93.9812,159.4681,92.9087,160.5615,92.4021,161.2988,91.5394,162,90.6406,161.998,90.6387,161.3685,90.0091,160.4029,89.0435,159.6995,88.3402,158.6482,87.2888,158,86.6406" style="stroke: #303030; stroke-width: 1.0;"/>
<path d="M26,90.6406 L26,89.686 L35.8571,90.071 L45.7143,90.9273 L55.5714,89.9716 L65.4286,91.4559 L75.2857,91.084 L85.1429,89.8822 L95,89.9979 L104.8571,90.5796 L114.7143,90.6958 L124.5714,90.2135 L134.4286,90.3049 L144.2857,91.2023 L154.1429,91.4263 L164,90.6406 " fill="none" style="stroke: #303030; stroke-width: 1.0;"/>
<text fill="#000000" font-family="Neucha" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="115" x="33" y="85.2539">Authentication Request</text>
<polygon fill="#303030" points="42,142.9609,41.9323,142.7916,39.933,143.5936,37.9957,144.5501,36.009,145.3835,34.0015,146.1648,32,146.9609,32.0703,147.1368,34.0024,147.767,35.9397,148.4103,38.0519,149.4906,40.0033,150.1693,42,150.9609,42.0221,150.9831,41.3708,150.3318,40.2616,149.2226,39.4521,148.413,38.8583,147.8192,38,146.9609,37.8878,146.8487,38.7219,146.0828,39.6297,145.3906,40.3994,144.5603,41.2739,143.8348,42,142.9609" style="stroke: #303030; stroke-width: 1.0;"/>
<path d="M36,146.9609 L36,146.3042 L46.2308,146.7267 L56.4615,147.4418 L66.6923,146.3533 L76.9231,147.6439 L87.1538,146.2267 L97.3846,146.8085 L107.6154,147.8682 L117.8462,147.7248 L128.0769,146.8254 L138.3077,147.9102 L148.5385,147.0292 L158.7692,146.6685 L169,146.9609 " fill="none" style="stroke: #303030; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;"/>
<text fill="#000000" font-family="Neucha" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="120" x="48" y="141.5742">Authentication Response</text>
<polygon fill="#CEEEFE" points="31,190.2813,31.1342,190.2813,31.1278,194.8813,30.957,199.4813,31.2386,204.0813,30.987,208.6813,31,213.2813,31,213.1329,40.5,213.0289,50,213.3605,59.5,212.6793,69,212.6069,78.5,213.9633,88,213.5709,97.5,213.8822,107,213.6465,116.5,213.6609,126,213.2813,126.1985,213.2813,125.7705,210.6813,126.1234,208.0813,125.886,205.4813,126.1531,202.8813,126,200.2813,126.0171,200.2983,123.9728,198.2541,121.9617,196.2429,119.8654,194.1467,117.8903,192.1715,116,190.2813,116,190.2062,106.5556,190.5208,97.1111,189.7273,87.6667,189.6189,78.2222,190.6198,68.7778,190.0911,59.3333,189.8205,49.8889,190.9415,40.4444,189.7997,31,190.2813" style="stroke: #303030; stroke-width: 1.0;"/>
<path d="M116,190.2813 L116.176,190.2813 L116.0481,192.2813 L115.9205,194.2813 L116.2807,196.2813 L115.9484,198.2813 L116,200.2813 " fill="#CEEEFE" style="stroke: #303030; stroke-width: 1.0;"/>
<path d="M126,200.2813 L126,200.0741 L124,200.498 L122,200.444 L120,200.5909 L118,200.3466 L116,200.2813 " fill="#CEEEFE" style="stroke: #303030; stroke-width: 1.0;"/>
<text fill="#000000" font-family="Neucha" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="74" x="37" y="205.0781">Drink that potion!</text>
<text fill="#000000" font-family="Neucha" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="61" x="67.5" y="241.4805">5 minutes later</text>
<polygon fill="#303030" points="37,274.6172,36.9515,274.4959,35.0702,275.5926,33.0752,276.4051,30.9555,276.9059,28.9547,277.7039,27,278.6172,26.9391,278.465,29.0496,279.5411,31.042,280.3221,32.9324,280.8481,34.9937,281.8014,37,282.6172,37.0366,282.6537,36.2786,281.8958,35.4431,281.0603,34.7229,280.3401,33.7454,279.3626,33,278.6172,32.9603,278.5775,33.7023,277.7195,34.703,277.1202,35.4881,276.3052,36.3686,275.5858,37,274.6172" style="stroke: #303030; stroke-width: 1.0;"/>
<path d="M31,278.6172 L31,278.5114 L40.8571,279.1931 L50.7143,277.8597 L60.5714,278.1669 L70.4286,277.8317 L80.2857,277.7244 L90.1429,278.7295 L100,279.1045 L109.8571,277.7188 L119.7143,278.0588 L129.5714,277.64 L139.4286,277.6536 L149.2857,278.4427 L159.1429,278.7615 L169,278.6172 " fill="none" style="stroke: #303030; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;"/>
<text fill="#000000" font-family="Neucha" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="20" x="43" y="273.2305">Bye!</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 9.0 KiB

19
examples/conversation.wsd Normal file
View File

@ -0,0 +1,19 @@
@startuml
!include "skin.iwsd"
title The Meaningless Coversation
hide footbox
Alice -> Bob: Authentication Request
...
Bob --> Alice: Authentication Response
activate Alice
note right of Alice
Drink that potion!
end note
deactivate Alice
... 5 minutes later ...
Bob --> Alice: Bye!
@enduml

8
wsd.mk
View File

@ -5,6 +5,8 @@ STYLE ?= style.isvg
.PHONY: all clean toolset force
validate = test -s $@ || { rm $@; exit 1; }
all: $(TARGETS)
clean:
@ -16,16 +18,14 @@ clean:
| xmllint --format - \
| sed -e "/<g>/r $(STYLE)" \
> $@
@$(MAKE) FILENAME=$@ validate
$(validate)
%.png: %.wsd
$(MAKE) $*.svg
mogrify -antialias -density 240 -format png $*.svg
rm -vf $*.svg
@$(MAKE) FILENAME=$@ validate
$(validate)
validate:
test -s $(FILENAME) || { rm $(FILENAME); exit 1; }
install-toolset: plantuml.tool xmllint.tool mogrify.tool
%.tool: force