liquid-diagrams 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +15 -16
- data/features/diagrams/bitfield.feature +48 -0
- data/features/diagrams/blockdiag.feature +19 -0
- data/features/diagrams/erd.feature +19 -0
- data/features/diagrams/graphviz.feature +19 -0
- data/features/diagrams/mermaid.feature +20 -0
- data/features/diagrams/netlistsvg.feature +27 -0
- data/features/diagrams/nomnoml.feature +19 -0
- data/features/diagrams/plantuml.feature +17 -0
- data/features/diagrams/smcat.feature +23 -0
- data/features/diagrams/svgbob.feature +19 -0
- data/features/diagrams/syntrax.feature +20 -0
- data/features/diagrams/vega.feature +23 -0
- data/features/diagrams/vegalite.feature +23 -0
- data/features/diagrams/wavedrom.feature +24 -0
- data/features/step_definitions/diagrams.rb +21 -0
- data/features/support/env.rb +15 -0
- data/lib/liquid_diagrams.rb +9 -17
- data/lib/liquid_diagrams/basic_block.rb +12 -42
- data/lib/liquid_diagrams/basic_renderer.rb +43 -1
- data/lib/liquid_diagrams/blocks.rb +14 -0
- data/lib/liquid_diagrams/renderers.rb +10 -0
- data/lib/liquid_diagrams/renderers/bitfield_renderer.rb +9 -13
- data/lib/liquid_diagrams/renderers/blockdiag_renderer.rb +7 -15
- data/lib/liquid_diagrams/renderers/erd_renderer.rb +7 -15
- data/lib/liquid_diagrams/renderers/graphviz_renderer.rb +10 -10
- data/lib/liquid_diagrams/renderers/mermaid_renderer.rb +2 -9
- data/lib/liquid_diagrams/renderers/netlistsvg_renderer.rb +13 -0
- data/lib/liquid_diagrams/renderers/nomnoml_renderer.rb +0 -4
- data/lib/liquid_diagrams/renderers/plantuml_renderer.rb +5 -5
- data/lib/liquid_diagrams/renderers/smcat_renderer.rb +0 -10
- data/lib/liquid_diagrams/renderers/svgbob_renderer.rb +0 -10
- data/lib/liquid_diagrams/renderers/syntrax_renderer.rb +0 -10
- data/lib/liquid_diagrams/renderers/vega_renderer.rb +9 -23
- data/lib/liquid_diagrams/renderers/vegalite_renderer.rb +19 -0
- data/lib/liquid_diagrams/renderers/wavedrom_renderer.rb +1 -1
- data/lib/liquid_diagrams/rendering.rb +8 -6
- data/lib/liquid_diagrams/utils.rb +21 -14
- data/lib/liquid_diagrams/version.rb +1 -1
- data/spec/liquid_diagrams/basic_block_spec.rb +25 -62
- data/spec/liquid_diagrams/basic_renderer_spec.rb +27 -5
- data/spec/liquid_diagrams/blocks_spec.rb +0 -0
- data/spec/liquid_diagrams/renderers/bitfield_renderer_spec.rb +1 -19
- data/spec/liquid_diagrams/renderers/blockdiag_renderer_spec.rb +3 -31
- data/spec/liquid_diagrams/renderers/erd_renderer_spec.rb +3 -37
- data/spec/liquid_diagrams/renderers/graphviz_renderer_spec.rb +11 -21
- data/spec/liquid_diagrams/renderers/mermaid_renderer_spec.rb +3 -19
- data/spec/liquid_diagrams/renderers/netlistsvg_renderer_spec.rb +9 -0
- data/spec/liquid_diagrams/renderers/nomnoml_renderer_spec.rb +1 -7
- data/spec/liquid_diagrams/renderers/plantuml_renderer_spec.rb +4 -14
- data/spec/liquid_diagrams/renderers/smcat_renderer_spec.rb +1 -25
- data/spec/liquid_diagrams/renderers/svgbob_renderer_spec.rb +1 -23
- data/spec/liquid_diagrams/renderers/syntrax_renderer_spec.rb +1 -23
- data/spec/liquid_diagrams/renderers/vega_renderer_spec.rb +3 -21
- data/spec/liquid_diagrams/renderers/vegalite_renderer_spec.rb +15 -0
- data/spec/liquid_diagrams/renderers/wavedrom_renderer_spec.rb +3 -3
- data/spec/liquid_diagrams/utils_spec.rb +20 -8
- data/spec/liquid_diagrams_spec.rb +52 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/support/shared_examples.rb +8 -19
- data/vendor/{mermaid_puppeteer_config.json → puppeteer.json} +0 -0
- metadata +70 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f509267c783705d06c2de382fcdc3c6438b3301b263fcc4ec05242fe1b395427
|
4
|
+
data.tar.gz: b0bb12b012cd8e65f5fd159f88916157d243166b6dd8863a97e384e53ee66c98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9868d981fab84249f42023676e6f0bedd4673230a32361fb395e18792de26f6207bf3d5d2b10967e0800119491fef595962fd5dd39409e1e52ce7851077c2a68
|
7
|
+
data.tar.gz: e5306fa06220c4ffd2a449ccb1b5c923212587ff6d546f885b60425399302e89dc60bb6d1439bca45504dbc591d584f8f924f9dfa72da86e28282ed3c4487ecb
|
data/README.md
CHANGED
@@ -7,22 +7,7 @@
|
|
7
7
|
[](https://coveralls.io/github/zhustec/liquid-diagrams)
|
8
8
|
[](https://github.com/zhustec/liquid-diagrams/blob/master/LICENSE)
|
9
9
|
|
10
|
-
Liquid Diagrams is a liquid plugins for
|
11
|
-
|
12
|
-
- [**Blockdiag**](http://blockdiag.com/en/)
|
13
|
-
- [**Bitfield**](https://github.com/wavedrom/bitfield)
|
14
|
-
- [**Erd**](https://github.com/BurntSushi/erd)
|
15
|
-
- [**GraphViz**](http://graphviz.org/)
|
16
|
-
- [**Mermaid**](https://mermaid-js.github.io/mermaid/)
|
17
|
-
- [**Nomnoml**](http://nomnoml.com/)
|
18
|
-
- [**PlantUML**](https://plantuml.com/)
|
19
|
-
- [**Svgbob**](https://ivanceras.github.io/svgbob-editor/)
|
20
|
-
- [**Syntrax**](https://kevinpt.github.io/syntrax/)
|
21
|
-
- [**Vega**](https://vega.github.io/vega/)
|
22
|
-
- [**Vegalite**](https://vega.github.io/vega-lite/)
|
23
|
-
- [**Wavedrom**](https://wavedrom.com/).
|
24
|
-
|
25
|
-
**NOTE:** This project is under development currently.
|
10
|
+
Liquid Diagrams is a liquid plugins for rendering svg diagrams, it is inspired by [asciidoctor-diagram](https://github.com/asciidoctor/asciidoctor-diagram). Currently support: [**Blockdiag**](http://blockdiag.com/en/), [**Bitfield**](https://github.com/wavedrom/bitfield), [**Erd**](https://github.com/BurntSushi/erd), [**GraphViz**](http://graphviz.org/), [**Mermaid**](https://mermaid-js.github.io/mermaid/), [**Nomnoml**](http://nomnoml.com/), [**Netlistsvg**](https://github.com/nturley/netlistsvg), [**PlantUML**](https://plantuml.com/), [**Svgbob**](https://ivanceras.github.io/svgbob-editor/), [**Syntrax**](https://kevinpt.github.io/syntrax/), [**Vega**](https://vega.github.io/vega/), [**Vegalite**](https://vega.github.io/vega-lite/), [**Wavedrom**](https://wavedrom.com/).
|
26
11
|
|
27
12
|
- [Installation](#installation)
|
28
13
|
- [Usage](#usage)
|
@@ -37,12 +22,14 @@ Liquid Diagrams is a liquid plugins for creating diagrams, it is inspired by [as
|
|
37
22
|
- [Erd](#erd)
|
38
23
|
- [Graphviz](#graphviz)
|
39
24
|
- [Mermaid](#mermaid)
|
25
|
+
- [Netlistsvg](#netlistsvg)
|
40
26
|
- [Nomnoml](#nomnoml)
|
41
27
|
- [PlantUML](#plantuml)
|
42
28
|
- [State Machine Cat](#state-machine-cat)
|
43
29
|
- [Svgbob](#svgbob)
|
44
30
|
- [Syntrax](#syntrax)
|
45
31
|
- [Vega](#vega)
|
32
|
+
- [Vegalite](#vegalite)
|
46
33
|
- [Wavedrom](#wavedrom)
|
47
34
|
- [Contributing](#contributing)
|
48
35
|
- [License](#license)
|
@@ -161,6 +148,8 @@ You still need to install some dependencies, please refer to [Prerequisites](Pre
|
|
161
148
|
|
162
149
|
## Configurations
|
163
150
|
|
151
|
+
**Warning:** All default configuration are provided by upstream, so it maybe different from here.
|
152
|
+
|
164
153
|
### Blockdiag
|
165
154
|
|
166
155
|
| Config | Type | Default | Description |
|
@@ -218,6 +207,10 @@ Available values:
|
|
218
207
|
| `backgroundColor` | `string` | white | Background color |
|
219
208
|
| `theme` | `string` | default | Theme of the chart |
|
220
209
|
|
210
|
+
### Netlistsvg
|
211
|
+
|
212
|
+
Currently no configurations
|
213
|
+
|
221
214
|
### Nomnoml
|
222
215
|
|
223
216
|
Currently no configurations
|
@@ -263,6 +256,12 @@ Available values:
|
|
263
256
|
| ------- | ----- | ------- | ----------- |
|
264
257
|
| `scale` | `int` | 1 | Scale image |
|
265
258
|
|
259
|
+
### Vegalite
|
260
|
+
|
261
|
+
| Config | Type | Default | Description |
|
262
|
+
| ------- | ----- | ------- | ----------- |
|
263
|
+
| `scale` | `int` | 1 | Scale image |
|
264
|
+
|
266
265
|
### Wavedrom
|
267
266
|
|
268
267
|
Currently no configurations
|
@@ -0,0 +1,48 @@
|
|
1
|
+
@diagrams
|
2
|
+
Feature: Bitfield
|
3
|
+
|
4
|
+
As a liquid user, I want to use bitfield diagram
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I have a liquid template with:
|
8
|
+
"""
|
9
|
+
{% bitfield %}
|
10
|
+
[
|
11
|
+
{ "name": "IPO", "bits": 8, "attr": "RO" },
|
12
|
+
{ "bits": 7 },
|
13
|
+
{ "name": "BRK", "bits": 5, "attr": "RW", "type": 4 },
|
14
|
+
{ "name": "CPK", "bits": 1 },
|
15
|
+
{ "name": "Clear", "bits": 3 },
|
16
|
+
{ "bits": 8 }
|
17
|
+
]
|
18
|
+
{% endbitfield %}
|
19
|
+
"""
|
20
|
+
|
21
|
+
Scenario: Basic Rendering
|
22
|
+
When I render it
|
23
|
+
Then the output should contains 'viewBox="0 0 640 160"'
|
24
|
+
|
25
|
+
Scenario: Configuration
|
26
|
+
When I render it with 'bitfield' options:
|
27
|
+
| hspace | 800 |
|
28
|
+
| vspace | 100 |
|
29
|
+
Then the output should contains 'viewBox="0 0 800 200"'
|
30
|
+
|
31
|
+
Scenario: Inline options
|
32
|
+
Given I have a liquid template with:
|
33
|
+
"""
|
34
|
+
{% bitfield hspace=840 vspace=120 %}
|
35
|
+
[
|
36
|
+
{ "name": "IPO", "bits": 8, "attr": "RO" },
|
37
|
+
{ "bits": 7 },
|
38
|
+
{ "name": "BRK", "bits": 5, "attr": "RW", "type": 4 },
|
39
|
+
{ "name": "CPK", "bits": 1 },
|
40
|
+
{ "name": "Clear", "bits": 3 },
|
41
|
+
{ "bits": 8 }
|
42
|
+
]
|
43
|
+
{% endbitfield %}
|
44
|
+
"""
|
45
|
+
When I render it with 'bitfield' options:
|
46
|
+
| hspace | 800 |
|
47
|
+
| vspace | 100 |
|
48
|
+
Then the output should contains 'viewBox="0 0 840 240"'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
@diagrams
|
2
|
+
Feature: Blockdiag
|
3
|
+
|
4
|
+
As a liquid user, I want to use blockdiag diagram
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I have a liquid template with:
|
8
|
+
"""
|
9
|
+
{% blockdiag %}
|
10
|
+
blockdiag {
|
11
|
+
A -> B -> C -> D;
|
12
|
+
A -> E -> F -> G;
|
13
|
+
}
|
14
|
+
{% endblockdiag %}
|
15
|
+
"""
|
16
|
+
|
17
|
+
Scenario: Basic Rendering
|
18
|
+
When I render it
|
19
|
+
Then the output should contains '<svg'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
@diagrams
|
2
|
+
@slow
|
3
|
+
Feature: Erd
|
4
|
+
|
5
|
+
As a liquid user, I want to use erd diagram
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I have a liquid template with:
|
9
|
+
"""
|
10
|
+
{% erd %}
|
11
|
+
[Person]
|
12
|
+
name
|
13
|
+
height
|
14
|
+
{% enderd %}
|
15
|
+
"""
|
16
|
+
|
17
|
+
Scenario: Basic Rendering
|
18
|
+
When I render it
|
19
|
+
Then the output should contains '<svg'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
@diagrams
|
2
|
+
Feature: Graphviz
|
3
|
+
|
4
|
+
As a liquid user, I want to use graphviz diagram
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I have a liquid template with:
|
8
|
+
"""
|
9
|
+
{% graphviz %}
|
10
|
+
digraph {
|
11
|
+
A -> B;
|
12
|
+
}
|
13
|
+
{% endgraphviz %}
|
14
|
+
"""
|
15
|
+
|
16
|
+
Scenario: Basic Rendering
|
17
|
+
When I render it
|
18
|
+
Then the output should contains '<svg'
|
19
|
+
And the output should not contains '<\?xml'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
@diagrams
|
2
|
+
Feature: Mermaid
|
3
|
+
|
4
|
+
As a liquid user, I want to use mermaid diagram
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I have a liquid template with:
|
8
|
+
"""
|
9
|
+
{% mermaid %}
|
10
|
+
sequenceDiagram
|
11
|
+
participant John
|
12
|
+
participant Alice
|
13
|
+
Alice->>John: Hello John, how are you?
|
14
|
+
John-->>Alice: Great!
|
15
|
+
{% endmermaid %}
|
16
|
+
"""
|
17
|
+
|
18
|
+
Scenario: Basic Rendering
|
19
|
+
When I render it
|
20
|
+
Then the output should contains '<svg'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
@diagrams
|
2
|
+
Feature: Netlistsvg
|
3
|
+
|
4
|
+
As a liquid user, I want to use netlistsvg diagram
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I have a liquid template with:
|
8
|
+
"""
|
9
|
+
{% netlistsvg %}
|
10
|
+
{
|
11
|
+
modules: {
|
12
|
+
up3down5: {
|
13
|
+
cells: {
|
14
|
+
"$add$input.v:17$3": {
|
15
|
+
type: "$add",
|
16
|
+
connections: {}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
{% endnetlistsvg %}
|
23
|
+
"""
|
24
|
+
|
25
|
+
Scenario: Basic Rendering
|
26
|
+
When I render it
|
27
|
+
Then the output should contains '<svg'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
@diagrams
|
2
|
+
Feature: Nomnoml
|
3
|
+
|
4
|
+
As a liquid user, I want to use nomnoml diagram
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I have a liquid template with:
|
8
|
+
"""
|
9
|
+
{% nomnoml %}
|
10
|
+
[Pirate|eyeCount: Int|raid();pillage()|
|
11
|
+
[beard]--[parrot]
|
12
|
+
[beard]-:>[foul mouth]
|
13
|
+
]
|
14
|
+
{% endnomnoml %}
|
15
|
+
"""
|
16
|
+
|
17
|
+
Scenario: Basic Rendering
|
18
|
+
When I render it
|
19
|
+
Then the output should contains '<svg'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
@diagrams
|
2
|
+
Feature: Plantuml
|
3
|
+
|
4
|
+
As a liquid user, I want to use plantuml diagram
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I have a liquid template with:
|
8
|
+
"""
|
9
|
+
{% plantuml %}
|
10
|
+
Bob->Alice : hello
|
11
|
+
{% endplantuml %}
|
12
|
+
"""
|
13
|
+
|
14
|
+
Scenario: Basic Rendering
|
15
|
+
When I render it
|
16
|
+
Then the output should contains '<svg'
|
17
|
+
And the output should not contains '<\?xml'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
@diagrams
|
2
|
+
Feature: Smcat
|
3
|
+
|
4
|
+
As a liquid user, I want to use smcat diagram
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I have a liquid template with:
|
8
|
+
"""
|
9
|
+
{% smcat %}
|
10
|
+
playing {
|
11
|
+
resting => walking;
|
12
|
+
walking => resting;
|
13
|
+
};
|
14
|
+
|
15
|
+
playing => playing: ingest food;
|
16
|
+
playing => playing [type=internal]: ingest drink;
|
17
|
+
{% endsmcat %}
|
18
|
+
"""
|
19
|
+
|
20
|
+
Scenario: Basic Rendering
|
21
|
+
When I render it
|
22
|
+
Then the output should contains '<svg'
|
23
|
+
And the output should not contains '<\?xml'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
@diagrams
|
2
|
+
@slow
|
3
|
+
Feature: Svgbob
|
4
|
+
|
5
|
+
As a liquid user, I want to use svgbob diagram
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I have a liquid template with:
|
9
|
+
"""
|
10
|
+
{% svgbob %}
|
11
|
+
+------+
|
12
|
+
| |
|
13
|
+
+------+
|
14
|
+
{% endsvgbob %}
|
15
|
+
"""
|
16
|
+
|
17
|
+
Scenario: Basic Rendering
|
18
|
+
When I render it
|
19
|
+
Then the output should contains '<svg'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
@diagrams
|
2
|
+
Feature: Syntrax
|
3
|
+
|
4
|
+
As a liquid user, I want to use syntrax diagram
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I have a liquid template with:
|
8
|
+
"""
|
9
|
+
{% syntrax %}
|
10
|
+
indentstack(10,
|
11
|
+
line(opt('-'), choice('0', line('1-9', loop(None, '0-9'))),
|
12
|
+
opt('.', loop('0-9', None))),
|
13
|
+
line(opt(choice('e', 'E'), choice(None, '+', '-'), loop('0-9', None)))
|
14
|
+
)
|
15
|
+
{% endsyntrax %}
|
16
|
+
"""
|
17
|
+
|
18
|
+
Scenario: Basic Rendering
|
19
|
+
When I render it
|
20
|
+
Then the output should contains '<svg'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
@diagrams
|
2
|
+
Feature: Vega
|
3
|
+
|
4
|
+
As a liquid user, I want to use vega diagram
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I have a liquid template with:
|
8
|
+
"""
|
9
|
+
{% vega %}
|
10
|
+
{
|
11
|
+
"data": {
|
12
|
+
"values": [
|
13
|
+
{"a": "A", "b": 28}
|
14
|
+
]
|
15
|
+
},
|
16
|
+
"mark": "bar"
|
17
|
+
}
|
18
|
+
{% endvega %}
|
19
|
+
"""
|
20
|
+
|
21
|
+
Scenario: Basic Rendering
|
22
|
+
When I render it
|
23
|
+
Then the output should contains '<svg'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
@diagrams
|
2
|
+
Feature: Vegalite
|
3
|
+
|
4
|
+
As a liquid user, I want to use vegalite diagram
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I have a liquid template with:
|
8
|
+
"""
|
9
|
+
{% vegalite %}
|
10
|
+
{
|
11
|
+
"data": {
|
12
|
+
"values": [
|
13
|
+
{"a": "A", "b": 28}
|
14
|
+
]
|
15
|
+
},
|
16
|
+
"mark": "bar"
|
17
|
+
}
|
18
|
+
{% endvegalite %}
|
19
|
+
"""
|
20
|
+
|
21
|
+
Scenario: Basic Rendering
|
22
|
+
When I render it
|
23
|
+
Then the output should contains '<svg'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
@diagrams
|
2
|
+
Feature: Wavedrom
|
3
|
+
|
4
|
+
As a liquid user, I want to use wavedrom diagram
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I have a liquid template with:
|
8
|
+
"""
|
9
|
+
{% wavedrom %}
|
10
|
+
{
|
11
|
+
signal: [
|
12
|
+
{ name: "clk", wave: "p.....|..." },
|
13
|
+
{ name: "Data", wave: "x.345x|=.x", data: ["head", "body", "tail", "data"] },
|
14
|
+
{ name: "Request", wave: "0.1..0|1.0" },
|
15
|
+
{},
|
16
|
+
{ name: "Acknowledge", wave: "1.....|01." }
|
17
|
+
]
|
18
|
+
}
|
19
|
+
{% endwavedrom %}
|
20
|
+
"""
|
21
|
+
|
22
|
+
Scenario: Basic Rendering
|
23
|
+
When I render it
|
24
|
+
Then the output should contains '<svg'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Given('I have a liquid template with:') do |content|
|
4
|
+
@content = content
|
5
|
+
end
|
6
|
+
|
7
|
+
When('I render it') do
|
8
|
+
@output = render_liquid(@content)
|
9
|
+
end
|
10
|
+
|
11
|
+
When('I render it with {string} options:') do |key, options|
|
12
|
+
@output = render_liquid(@content, key.to_sym => Hash[options.raw])
|
13
|
+
end
|
14
|
+
|
15
|
+
Then('the output should contains {string}') do |pattern|
|
16
|
+
expect(@output).to match Regexp.new(pattern)
|
17
|
+
end
|
18
|
+
|
19
|
+
Then('the output should not contains {string}') do |pattern|
|
20
|
+
expect(@output).not_to match Regexp.new(pattern)
|
21
|
+
end
|