jekyll-diagrams 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +32 -20
  3. data/features/blockdiag.feature +1 -2
  4. data/features/graphviz.feature +58 -6
  5. data/features/mermaid.feature +1 -2
  6. data/features/nomnoml.feature +2 -22
  7. data/features/plantuml.feature +17 -8
  8. data/features/smcat.feature +10 -15
  9. data/features/support/env.rb +11 -5
  10. data/features/syntrax.feature +1 -2
  11. data/features/vega.feature +24 -12
  12. data/features/wavedrom.feature +2 -8
  13. data/lib/jekyll-diagrams.rb +64 -1
  14. data/lib/jekyll-diagrams/block.rb +33 -8
  15. data/lib/jekyll-diagrams/blockdiag.rb +8 -6
  16. data/lib/jekyll-diagrams/erd.rb +7 -1
  17. data/lib/jekyll-diagrams/errors.rb +25 -0
  18. data/lib/jekyll-diagrams/graphviz.rb +2 -1
  19. data/lib/jekyll-diagrams/mermaid.rb +4 -5
  20. data/lib/jekyll-diagrams/nomnoml.rb +2 -2
  21. data/lib/jekyll-diagrams/plantuml.rb +3 -4
  22. data/lib/jekyll-diagrams/rendering.rb +67 -0
  23. data/lib/jekyll-diagrams/smcat.rb +2 -2
  24. data/lib/jekyll-diagrams/vega.rb +3 -1
  25. data/lib/jekyll-diagrams/version.rb +1 -1
  26. data/test/block_test.rb +6 -0
  27. data/test/blockdiag_test.rb +28 -0
  28. data/test/erd_test.rb +5 -2
  29. data/test/rendering_test.rb +20 -0
  30. data/test/svgbob_test.rb +22 -0
  31. data/test/test_helper.rb +12 -3
  32. metadata +118 -39
  33. data/.coveralls.yml +0 -1
  34. data/.github/workflows/test.yml +0 -83
  35. data/.gitignore +0 -4
  36. data/.rubocop.yml +0 -22
  37. data/.simplecov +0 -5
  38. data/.travis.yml +0 -50
  39. data/Dockerfile +0 -53
  40. data/Gemfile +0 -8
  41. data/Rakefile +0 -28
  42. data/features/svgbob.feature +0 -22
  43. data/jekyll-diagrams.gemspec +0 -31
  44. data/lib/jekyll-diagrams/util.rb +0 -95
  45. data/test/util_test.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70d7e4b5b99f04cfb2ec1220c4f123948bf4079aac701b914017764d3dcab1cf
4
- data.tar.gz: 1ed3c24302bdb6382c27809f3aad1b4b9c061d83843edd09adb107e2c2d26bb0
3
+ metadata.gz: e01b0efc75e18e6fc6eb105f1bdbd31380407a653bdf3972b61f96e69495d2f2
4
+ data.tar.gz: 8e505b39fa89147623fb456f6e08ba20837b92f77e4f612177f0bb25e7f2aa21
5
5
  SHA512:
6
- metadata.gz: fba79417016f438fc537b513c70c0885777f4e32b98e89ba9b9668c1d30fc4f8a9ab489819ca9b05265d316bccd8e303e34cf6667634395b70373358db437251
7
- data.tar.gz: edbaca323b8ff81769e9c9fedd4dee495a87c5ed8e1af8cb28001b8f4c8b140b32437a3b6014c630dc10d8f44813ee4401244ed7760188a57269e7263142949d
6
+ metadata.gz: 2cb41b3ca6850ed7be3389369fc928cb52d7b128fef27568858a28d9ba3ade5a3b024dca39828ff875f0e69f0e6b4c0b3f9806b0c39b044f8ebc38cd5b5e7f25
7
+ data.tar.gz: 7a52d3fdb72daf02efb5ecc89f86f4c791c2ec8281a5787165997385baa9b156d37105fbd973a13ed6d0ad01deea22c553ead6059a80894259f97a10664a15b0
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # Jekyll Diagrams
2
2
 
3
- [![Gem](https://img.shields.io/gem/v/jekyll-diagrams.svg?style=flat-square)](https://rubygems.org/gems/jekyll-diagrams)
4
- [![Depfu](https://img.shields.io/depfu/zhustec/jekyll-diagrams.svg?style=flat-square)](https://depfu.com/repos/zhustec/jekyll-diagrams)
5
- [![GitHub Action](https://img.shields.io/github/workflow/status/zhustec/jekyll-diagrams/Test?label=Github%20Action&style=flat-square)](https://github.com/zhustec/jekyll-diagrams/actions?query=workflow%3ATest)
6
- [![Travis](https://img.shields.io/travis/zhustec/jekyll-diagrams.svg?style=flat-square)](https://travis-ci.com/zhustec/jekyll-diagrams)
7
- [![Coveralls](https://img.shields.io/coveralls/github/zhustec/jekyll-diagrams?style=flat-square)](https://coveralls.io/github/zhustec/jekyll-diagrams?branch=master)
8
- [![License](https://img.shields.io/github/license/zhustec/jekyll-diagrams.svg?style=flat-square)](https://github.com/zhustec/jekyll-diagrams/blob/master/LICENSE)
3
+ [![Gem](https://img.shields.io/gem/v/jekyll-diagrams.svg?label=Gem&style=flat-square)](https://rubygems.org/gems/jekyll-diagrams)
4
+ [![Test](https://img.shields.io/github/workflow/status/zhustec/jekyll-diagrams/Test?label=Test&style=flat-square)](https://github.com/zhustec/jekyll-diagrams/actions?query=workflow%3ATest)
5
+ [![Travis](https://img.shields.io/travis/zhustec/jekyll-diagrams.svg?label=Travis&style=flat-square)](https://travis-ci.com/zhustec/jekyll-diagrams)
6
+ [![Linter](https://img.shields.io/github/workflow/status/zhustec/jekyll-diagrams/Linter?label=Linter&style=flat-square)](https://github.com/zhustec/jekyll-diagrams/actions?query=workflow%3ALinter)
7
+ [![Coverage](https://img.shields.io/coveralls/github/zhustec/jekyll-diagrams?label=Coverage&style=flat-square)](https://coveralls.io/github/zhustec/jekyll-diagrams)
8
+ [![License](https://img.shields.io/github/license/zhustec/jekyll-diagrams.svg?label=License&style=flat-square)](https://github.com/zhustec/jekyll-diagrams/blob/master/LICENSE)
9
9
 
10
10
  Jekyll Diagrams is a jekyll plugins for creating diagrams, currently support for [**Blockdiag**](http://blockdiag.com/en/), [**Erd**](https://github.com/BurntSushi/erd), [**GraphViz**](http://graphviz.org/), [**Mermaid**](https://mermaid-js.github.io/mermaid/), [**Nomnoml**](http://nomnoml.com/), [**PlantUML**](https://plantuml.com/), [**Svgbob**](https://ivanceras.github.io/svgbob-editor/), [**Syntrax**](https://kevinpt.github.io/syntrax/), [**Vega**](https://vega.github.io/vega/), [**Vega-Lite**](https://vega.github.io/vega-lite/) and [**WaveDrom**](https://wavedrom.com/). More diagrams support will be added in future versions.
11
11
 
@@ -13,8 +13,7 @@ Jekyll Diagrams is a jekyll plugins for creating diagrams, currently support for
13
13
 
14
14
  - [Installation](#installation)
15
15
  - [Configurations](#configurations)
16
- - [Site Configurations](#site-configurations)
17
- - [Page Configurations](#page-configurations)
16
+ - [Error Mode](#error-mode)
18
17
  - [Usage](#usage)
19
18
  - [Blockdiag](#blockdiag)
20
19
  - [Erd](#erd)
@@ -55,9 +54,7 @@ $ bundle install
55
54
 
56
55
  ## Configurations
57
56
 
58
- ### Site Configurations
59
-
60
- Site configurations can be set in your site's config file under `jekyll-diagrams` key, e.g:
57
+ Configurations can be set in your site's config file under `jekyll-diagrams` key as below:
61
58
 
62
59
  ```yaml
63
60
  jekyll-diagrams:
@@ -70,9 +67,7 @@ jekyll-diagrams:
70
67
  # and so on
71
68
  ```
72
69
 
73
- ### Page Configurations
74
-
75
- You can set configurations in the front matter of each page, this will overwite global config. e.g.
70
+ You can override global config in the front matter of each page, e.g.
76
71
 
77
72
  ```text
78
73
  ---
@@ -81,14 +76,31 @@ title: Custom configurations per page
81
76
  jekyll-diagrams:
82
77
  graphviz:
83
78
  # configurations for graphviz
84
- blockdiag:
85
- # configurations for blockdiag
86
- syntrax:
87
- # configurations for syntrax
88
- # and so on
89
79
  ---
90
80
 
91
- # your content
81
+ # Your content
82
+ ```
83
+
84
+ ### Error Mode
85
+
86
+ You can use `error_mode` to configure how to response to errors. `jekyll-diagrams` respect the global [liquid options](https://jekyllrb.com/docs/configuration/liquid/):
87
+
88
+ ```yaml
89
+ liquid:
90
+ error_mode: 'mode'
91
+ ```
92
+
93
+ Avaliable options:
94
+
95
+ - `lax`: Ignore all errors
96
+ - `warn`: Output a warning on the console for each error
97
+ - `strict`: Output an error message and stop the build
98
+
99
+ You can also override it for just `jekyll-diagrams`:
100
+
101
+ ```yaml
102
+ jekyll-diagrams:
103
+ error_mode: 'mode'
92
104
  ```
93
105
 
94
106
  ## Usage
@@ -1,7 +1,7 @@
1
1
  Feature: Blockdiag
2
2
 
3
3
 
4
- Scenario: Default configuration
4
+ Scenario: Basic Rendering
5
5
  Given I have a file 'blockdiag.md' with content:
6
6
  """
7
7
  ---
@@ -16,5 +16,4 @@ Feature: Blockdiag
16
16
  """
17
17
  When I run jekyll build
18
18
  Then the file '_site/blockdiag.html' should exist
19
- And I should see 'diagrams blockdiag' in '_site/blockdiag.html'
20
19
  And I should see svg output in '_site/blockdiag.html'
@@ -1,7 +1,7 @@
1
1
  Feature: Graphviz
2
2
 
3
3
 
4
- Scenario: Default configuration
4
+ Background: I have a file with Graghviz
5
5
  Given I have a file 'graphviz.md' with content:
6
6
  """
7
7
  ---
@@ -9,14 +9,66 @@ Feature: Graphviz
9
9
 
10
10
  {% graphviz %}
11
11
  digraph {
12
- S -> A;
13
- S -> B;
14
- A -> D;
15
- B -> D;
12
+ A -> B;
16
13
  }
17
14
  {% endgraphviz %}
18
15
  """
16
+
17
+ Scenario: Basic Rendering
19
18
  When I run jekyll build
20
19
  Then the file '_site/graphviz.html' should exist
21
- And I should see 'diagrams graphviz' in '_site/graphviz.html'
22
20
  And I should see svg output in '_site/graphviz.html'
21
+
22
+ Scenario: Remove XML Heading
23
+ When I run jekyll build
24
+ Then the file '_site/graphviz.html' should exist
25
+ And I should not see '<\?xml' in '_site/graphviz.html'
26
+ And I should not see '<!DOCTYPE' in '_site/graphviz.html'
27
+
28
+ Scenario: Global Configugration
29
+ Given I have a file '_config.yml' with content:
30
+ """
31
+ jekyll-diagrams:
32
+ graphviz:
33
+ graph_attributes: bgcolor=red
34
+ edge_attributes:
35
+ - color=green
36
+ node_attributes:
37
+ color: blue
38
+ """
39
+ When I run jekyll build
40
+ Then the file '_site/graphviz.html' should exist
41
+ # Graph
42
+ And I should see '<polygon fill="#ff0000"' in '_site/graphviz.html'
43
+ # Edge
44
+ And I should see '<path .*? stroke="#00ff00"' in '_site/graphviz.html'
45
+ # Node
46
+ And I should see '<ellipse .*? stroke="#0000ff"' in '_site/graphviz.html'
47
+
48
+ Scenario: Page Configugration Will Overwite Site Configuration
49
+ Given I have a file '_config.yml' with content:
50
+ """
51
+ jekyll-diagrams:
52
+ graphviz:
53
+ edge_attributes:
54
+ color: blue
55
+ """
56
+ And I have a file 'graphviz.md' with content:
57
+ """
58
+ ---
59
+ jekyll-diagrams:
60
+ graphviz:
61
+ edge_attributes:
62
+ color: red
63
+ ---
64
+
65
+ {% graphviz %}
66
+ digraph {
67
+ A -> B;
68
+ }
69
+ {% endgraphviz %}
70
+ """
71
+ When I run jekyll build
72
+ Then the file '_site/graphviz.html' should exist
73
+ And I should see '<path .*? stroke="#ff0000"' in '_site/graphviz.html'
74
+ And I should not see '<path .*? stroke="#0000ff"' in '_site/graphviz.html'
@@ -1,7 +1,7 @@
1
1
  Feature: Mermaid
2
2
 
3
3
 
4
- Scenario: Default configuration
4
+ Scenario: Basic Rendering
5
5
  Given I have a file 'mermaid.md' with content:
6
6
  """
7
7
  ---
@@ -17,5 +17,4 @@ Feature: Mermaid
17
17
  """
18
18
  When I run jekyll build
19
19
  Then the file '_site/mermaid.html' should exist
20
- And I should see 'diagrams mermaid' in '_site/mermaid.html'
21
20
  And I should see svg output in '_site/mermaid.html'
@@ -1,36 +1,16 @@
1
1
  Feature: Nomnoml
2
2
 
3
3
 
4
- Scenario: Default configuration
4
+ Scenario: Basic Rendering
5
5
  Given I have a file 'nomnoml.md' with content:
6
6
  """
7
7
  ---
8
8
  ---
9
9
 
10
10
  {% nomnoml %}
11
- [Pirate|eyeCount: Int|raid();pillage()|
12
- [beard]--[parrot]
13
- [beard]-:>[foul mouth]
14
- ]
15
-
16
- [<abstract>Marauder]<:--[Pirate]
17
- [Pirate]- 0..7[mischief]
18
- [jollyness]->[Pirate]
19
- [jollyness]->[rum]
20
- [jollyness]->[singing]
21
- [Pirate]-> *[rum|tastiness: Int|swig()]
22
- [Pirate]->[singing]
23
- [singing]<->[rum]
24
-
25
- [<start>st]->[<state>plunder]
26
- [plunder]->[<choice>more loot]
27
- [more loot]->[st]
28
- [more loot] no ->[<end>e]
29
-
30
- [<actor>Sailor] - [<usecase>shiver me;timbers]
11
+ [Jekyll Diagrams Feature Test]
31
12
  {% endnomnoml %}
32
13
  """
33
14
  When I run jekyll build
34
15
  Then the file '_site/nomnoml.html' should exist
35
- And I should see 'diagrams nomnoml' in '_site/nomnoml.html'
36
16
  And I should see svg output in '_site/nomnoml.html'
@@ -1,24 +1,33 @@
1
1
  Feature: PlantUML
2
2
 
3
3
 
4
- Scenario: Default configuration
4
+ Background: I have a file with PlantUML
5
5
  Given I have a file 'plantuml.md' with content:
6
6
  """
7
7
  ---
8
8
  ---
9
9
 
10
10
  {% plantuml %}
11
- @startuml
12
- class Car
11
+ Bob->Alice : hello
12
+ {% endplantuml %}
13
+ """
13
14
 
14
- Driver - Car : drives >
15
- Car *- Wheel : have 4 >
16
- Car -- Person : < owns
15
+ Scenario: Basic Rendering
16
+ Given I have a file 'plantuml.md' with content:
17
+ """
18
+ ---
19
+ ---
17
20
 
18
- @enduml
21
+ {% plantuml %}
22
+ Bob->Alice : hello
19
23
  {% endplantuml %}
20
24
  """
21
25
  When I run jekyll build
22
26
  Then the file '_site/plantuml.html' should exist
23
- And I should see 'diagrams plantuml' in '_site/plantuml.html'
24
27
  And I should see svg output in '_site/plantuml.html'
28
+
29
+ Scenario: Remove XML Heading
30
+ When I run jekyll build
31
+ Then the file '_site/plantuml.html' should exist
32
+ And I should not see '<\?xml' in '_site/plantuml.html'
33
+ And I should not see '<!DOCTYPE' in '_site/plantuml.html'
@@ -1,29 +1,24 @@
1
1
  Feature: SMCat
2
2
 
3
3
 
4
- Scenario: Default configuration
4
+ Background: I have a file with SMCat
5
5
  Given I have a file 'smcat.md' with content:
6
6
  """
7
7
  ---
8
8
  ---
9
9
 
10
10
  {% smcat %}
11
- initial,
12
- "tape player off",
13
- "tape player on" {
14
- stopped => playing : play;
15
- playing => stopped : stop;
16
- playing => paused : pause;
17
- paused => playing : pause;
18
- paused => stopped : stop;
19
- };
20
-
21
- initial => "tape player off";
22
- "tape player off" => stopped : power;
23
- "tape player on" => "tape player off" : power;
11
+ initial => smcat;
24
12
  {% endsmcat %}
25
13
  """
14
+
15
+ Scenario: Basic Rendering
26
16
  When I run jekyll build
27
17
  Then the file '_site/smcat.html' should exist
28
- And I should see 'diagrams smcat' in '_site/smcat.html'
29
18
  And I should see svg output in '_site/smcat.html'
19
+
20
+ Scenario: Remove XML Heading
21
+ When I run jekyll build
22
+ Then the file '_site/smcat.html' should exist
23
+ And I should not see '<\?xml' in '_site/smcat.html'
24
+ And I should not see '<!DOCTYPE' in '_site/smcat.html'
@@ -3,12 +3,14 @@
3
3
  lib = File.expand_path('../lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
- require 'coveralls'
7
- Coveralls.wear!
6
+ # Don't use coveralls in Github Actions
7
+ unless ENV['GITHUB_ACTIONS']
8
+ require 'coveralls'
9
+ Coveralls.wear!
10
+ end
8
11
 
9
- require 'tmpdir'
10
12
  require 'minitest'
11
- require 'jekyll'
13
+ require 'tmpdir'
12
14
  require 'jekyll-diagrams'
13
15
 
14
16
  TEST_DIR = File.join(Dir.tmpdir, 'jekyll-diagrams-features')
@@ -27,7 +29,11 @@ After do
27
29
  end
28
30
 
29
31
  def run_jekyll
30
- options = Jekyll.configuration(source: TEST_DIR, quiet: true)
32
+ options = Jekyll.configuration(
33
+ source: TEST_DIR,
34
+ quiet: true,
35
+ liquid: { 'error_mode' => 'strict' }
36
+ )
31
37
 
32
38
  Jekyll::Site.new(options).process
33
39
  end
@@ -1,7 +1,7 @@
1
1
  Feature: Syntrax
2
2
 
3
3
 
4
- Scenario: Default configuration
4
+ Scenario: Basic Rendering
5
5
  Given I have a file 'syntrax.md' with content:
6
6
  """
7
7
  ---
@@ -18,5 +18,4 @@ Feature: Syntrax
18
18
  """
19
19
  When I run jekyll build
20
20
  Then the file '_site/syntrax.html' should exist
21
- And I should see 'diagrams syntrax' in '_site/syntrax.html'
22
21
  And I should see svg output in '_site/syntrax.html'
@@ -1,7 +1,7 @@
1
1
  Feature: Vega
2
2
 
3
3
 
4
- Scenario: Default configuration
4
+ Scenario: Basic Vega Rendering
5
5
  Given I have a file 'vega.md' with content:
6
6
  """
7
7
  ---
@@ -9,24 +9,36 @@ Feature: Vega
9
9
 
10
10
  {% vega %}
11
11
  {
12
- "": "https://vega.github.io/schema/vega-lite/v4.json",
13
- "description": "A simple bar chart with embedded data.",
14
12
  "data": {
15
13
  "values": [
16
- {"a": "A", "b": 28}, {"a": "B", "b": 55}, {"a": "C", "b": 43},
17
- {"a": "D", "b": 91}, {"a": "E", "b": 81}, {"a": "F", "b": 53},
18
- {"a": "G", "b": 19}, {"a": "H", "b": 87}, {"a": "I", "b": 52}
14
+ {"a": "A", "b": 28}
19
15
  ]
20
16
  },
21
- "mark": "bar",
22
- "encoding": {
23
- "x": {"field": "a", "type": "ordinal"},
24
- "y": {"field": "b", "type": "quantitative"}
25
- }
17
+ "mark": "bar"
26
18
  }
27
19
  {% endvega %}
28
20
  """
29
21
  When I run jekyll build
30
22
  Then the file '_site/vega.html' should exist
31
- And I should see 'diagrams vega' in '_site/vega.html'
32
23
  And I should see svg output in '_site/vega.html'
24
+
25
+ Scenario: Basic Vegalite Rendering
26
+ Given I have a file 'vegalite.md' with content:
27
+ """
28
+ ---
29
+ ---
30
+
31
+ {% vegalite %}
32
+ {
33
+ "data": {
34
+ "values": [
35
+ {"a": "A", "b": 28}
36
+ ]
37
+ },
38
+ "mark": "bar"
39
+ }
40
+ {% endvegalite %}
41
+ """
42
+ When I run jekyll build
43
+ Then the file '_site/vegalite.html' should exist
44
+ And I should see svg output in '_site/vegalite.html'
@@ -1,22 +1,16 @@
1
1
  Feature: Wavedrom
2
2
 
3
3
 
4
- Scenario: Default configuration
4
+ Scenario: Basic Rendering
5
5
  Given I have a file 'wavedrom.md' with content:
6
6
  """
7
7
  ---
8
8
  ---
9
9
 
10
10
  {% wavedrom %}
11
- {signal: [
12
- {name: 'clk', wave: 'p.....|...'},
13
- {name: 'dat', wave: 'x.345x|=.x', data: ['head', 'body', 'tail', 'data']},
14
- {name: 'req', wave: '0.1..0|1.0'},
15
- {name: 'ack', wave: '1.....|01.'}
16
- ]}
11
+ {signal: [{wave: '.'}]}
17
12
  {% endwavedrom %}
18
13
  """
19
14
  When I run jekyll build
20
15
  Then the file '_site/wavedrom.html' should exist
21
- And I should see 'diagrams wavedrom' in '_site/wavedrom.html'
22
16
  And I should see svg output in '_site/wavedrom.html'