jekyll-diagrams 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +83 -0
  3. data/.gitignore +4 -5
  4. data/.rubocop.yml +22 -0
  5. data/.simplecov +5 -0
  6. data/.travis.yml +48 -1
  7. data/Dockerfile +14 -12
  8. data/Gemfile +4 -1
  9. data/README.md +49 -21
  10. data/Rakefile +20 -2
  11. data/features/blockdiag.feature +20 -0
  12. data/features/graphviz.feature +22 -0
  13. data/features/mermaid.feature +21 -0
  14. data/features/nomnoml.feature +36 -0
  15. data/features/plantuml.feature +24 -0
  16. data/features/smcat.feature +29 -0
  17. data/features/step_definitions/jekyll-diagrams.rb +25 -0
  18. data/features/support/env.rb +33 -0
  19. data/features/svgbob.feature +22 -0
  20. data/features/syntrax.feature +22 -0
  21. data/features/vega.feature +32 -0
  22. data/features/wavedrom.feature +22 -0
  23. data/jekyll-diagrams.gemspec +13 -7
  24. data/lib/jekyll-diagrams.rb +3 -2
  25. data/lib/jekyll-diagrams/block.rb +5 -4
  26. data/lib/jekyll-diagrams/blockdiag.rb +9 -7
  27. data/lib/jekyll-diagrams/erd.rb +9 -6
  28. data/lib/jekyll-diagrams/graphviz.rb +12 -17
  29. data/lib/jekyll-diagrams/mermaid.rb +21 -18
  30. data/lib/jekyll-diagrams/nomnoml.rb +6 -4
  31. data/lib/jekyll-diagrams/plantuml.rb +8 -4
  32. data/lib/jekyll-diagrams/smcat.rb +10 -7
  33. data/lib/jekyll-diagrams/svgbob.rb +6 -4
  34. data/lib/jekyll-diagrams/syntrax.rb +8 -6
  35. data/lib/jekyll-diagrams/util.rb +78 -11
  36. data/lib/jekyll-diagrams/vega.rb +8 -5
  37. data/lib/jekyll-diagrams/version.rb +4 -2
  38. data/lib/jekyll-diagrams/wavedrom.rb +6 -4
  39. data/test/erd_test.rb +22 -0
  40. data/test/test_helper.rb +4 -7
  41. data/test/util_test.rb +20 -0
  42. metadata +54 -11
  43. data/lib/jekyll-diagrams/renderer.rb +0 -53
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 192585b3f75f6ad3cfe6403e79f7ab565ea1ea2589b8b5003baf03ec08883ae7
4
- data.tar.gz: b667b2595b967e33c57e4fac153c0c9ec9d02c61504cc5f1015c6d991902694e
3
+ metadata.gz: 70d7e4b5b99f04cfb2ec1220c4f123948bf4079aac701b914017764d3dcab1cf
4
+ data.tar.gz: 1ed3c24302bdb6382c27809f3aad1b4b9c061d83843edd09adb107e2c2d26bb0
5
5
  SHA512:
6
- metadata.gz: 250e8441aa3e71c4367fbeb3885c0eff6219ff29294304763c458cf1f4dd03154bb9afbf55a578dc3e160d4184c1953b9fd7d31ffcd9c867b62ffb7f2c8e646b
7
- data.tar.gz: 1ab06599328e5a8275c880ccc276ee3fcb9e10dd71e5a9da86902550b7a64dce6d22844741f39daa01a06af90bd5bb7ee6d67381897edc4e47d1c39faa40b0ac
6
+ metadata.gz: fba79417016f438fc537b513c70c0885777f4e32b98e89ba9b9668c1d30fc4f8a9ab489819ca9b05265d316bccd8e303e34cf6667634395b70373358db437251
7
+ data.tar.gz: edbaca323b8ff81769e9c9fedd4dee495a87c5ed8e1af8cb28001b8f4c8b140b32437a3b6014c630dc10d8f44813ee4401244ed7760188a57269e7263142949d
@@ -0,0 +1,83 @@
1
+ name: Test
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-18.04
10
+
11
+ strategy:
12
+ matrix:
13
+ ruby:
14
+ - 2.5
15
+ - 2.6
16
+ - 2.7
17
+
18
+ steps:
19
+ - name: Checkout reposity
20
+ uses: actions/checkout@v2
21
+
22
+ - name: Set up Ruby ${{ matrix.ruby }}
23
+ uses: actions/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby }}
26
+
27
+ - name: Install APT stuffs
28
+ run: |
29
+ sudo apt-get -qq update
30
+ sudo apt-get -yqq install cabal-install \
31
+ cargo \
32
+ graphviz \
33
+ default-jre-headless \
34
+ npm \
35
+ python3 \
36
+ python3-pip \
37
+ python3-setuptools
38
+
39
+ # Install packages to "$HOME/.cargo/bin"
40
+ - name: Install Cargo stuffs
41
+ run: |
42
+ cargo install svgbob_cli
43
+
44
+ # Install packages to "$HOME/.npm"
45
+ - name: Install NPM stuffs
46
+ run: |
47
+ # Dependencies of mermaid
48
+ sudo apt-get -yqq install libatk1.0-0 \
49
+ libatk-bridge2.0-0 \
50
+ libgtk-3-0 \
51
+ libx11-xcb1 \
52
+ libxcomposite1 \
53
+ libxrandr2 \
54
+ libxss1
55
+ npm config set prefix "$HOME/.npm"
56
+ npm install -g mermaid.cli \
57
+ nomnoml \
58
+ state-machine-cat \
59
+ vega-cli \
60
+ vega-lite \
61
+ wavedrom-cli
62
+
63
+ # Install packages to "$HOME/.local/bin"
64
+ - name: Install Pip stuffs
65
+ run: |
66
+ # Dependencies of syntrax
67
+ sudo apt-get -yqq install libpango1.0-dev \
68
+ libpython3-dev \
69
+ python3-cairo \
70
+ python3-gi \
71
+ python3-gi-cairo
72
+ pip3 install blockdiag seqdiag actdiag nwdiag syntrax
73
+
74
+ - name: Run Test with Rake
75
+ run: |
76
+ export PATH="$HOME/.local/bin:$HOME/.npm/bin:$HOME/.cargo/bin:$PATH"
77
+ bundle install --jobs 4 --retry 3
78
+ bundle exec rake
79
+
80
+ # - name: Coveralls
81
+ # uses: coverallsapp/github-action@master
82
+ # with:
83
+ # github-token: ${{ secrets.GITHUB_TOKEN }}
data/.gitignore CHANGED
@@ -1,5 +1,4 @@
1
- .bundle
2
- .jekyll-cache
3
- _site
4
- pkg
5
- Gemfile.lock
1
+ /.bundle
2
+ /Gemfile.lock
3
+ /coverage
4
+ /pkg
@@ -0,0 +1,22 @@
1
+ Layout/LineLength:
2
+ Max: 85
3
+
4
+ Metrics/MethodLength:
5
+ Max: 20
6
+
7
+ Naming/FileName:
8
+ Exclude:
9
+ - lib/jekyll-diagrams.rb
10
+ - features/step_definitions/jekyll-diagrams.rb
11
+
12
+ Style/Documentation:
13
+ Enabled: false
14
+
15
+ Style/HashEachMethods:
16
+ Enabled: true
17
+
18
+ Style/HashTransformKeys:
19
+ Enabled: true
20
+
21
+ Style/HashTransformValues:
22
+ Enabled: true
@@ -0,0 +1,5 @@
1
+ SimpleCov.start do
2
+ add_filter '/features'
3
+ add_filter '/test'
4
+ add_filter '/spec'
5
+ end
@@ -1,3 +1,50 @@
1
1
  language: ruby
2
2
 
3
- dist: bionic
3
+ dist: bionic
4
+
5
+ cache:
6
+ - apt
7
+ - bundler
8
+ - npm
9
+
10
+ rvm:
11
+ - 2.5
12
+ - 2.6
13
+ - 2.7
14
+
15
+ addons:
16
+ apt:
17
+ update: true
18
+ packages:
19
+ - build-essential
20
+ - git
21
+ - cabal-install
22
+ - cargo
23
+ - default-jre-headless
24
+ - graphviz
25
+ - npm
26
+ - libatk1.0-0
27
+ - libatk-bridge2.0-0
28
+ - libgif-dev
29
+ - libgtk-3-0
30
+ - libx11-xcb1
31
+ - libxcomposite1
32
+ - libxrandr2
33
+ - libxss1
34
+ - libpango1.0-dev
35
+ - libpython3-dev
36
+ - python3-pip
37
+ - python3-setuptools
38
+ - python3-cairo
39
+ - python3-gi
40
+ - python3-gi-cairo
41
+ - ruby-full
42
+
43
+ before_install:
44
+ - sudo cargo install --root /usr/local svgbob_cli
45
+ - gem update --no-document --system
46
+ - gem install --no-document bundler
47
+ - npm install -g --silent mermaid.cli nomnoml state-machine-cat vega-cli vega-lite wavedrom-cli
48
+ - pip3 install syntrax blockdiag seqdiag actdiag nwdiag
49
+
50
+ script: bundle exec rake
data/Dockerfile CHANGED
@@ -1,7 +1,6 @@
1
1
  FROM ubuntu:bionic
2
2
 
3
- RUN set -eux; \
4
- apt-get update; \
3
+ RUN apt-get -qq update && \
5
4
  apt-get install -y --no-install-recommends \
6
5
  build-essential \
7
6
  git \
@@ -20,23 +19,22 @@ RUN set -eux; \
20
19
  libpango1.0-dev \
21
20
  libpython3-dev \
22
21
  python3-pip \
22
+ python3-setuptools \
23
23
  python3-cairo \
24
24
  python3-gi \
25
- python3-setuptools \
26
- ruby \
27
- ruby-dev
25
+ python3-gi-cairo \
26
+ ruby-full
28
27
 
29
- RUN set -eux; \
30
- cargo install --root /usr/local svgbob_cli; \
31
- gem update -N --system; \
32
- gem install -N bundler; \
28
+ RUN cargo install --root /usr/local svgbob_cli && \
29
+ gem update --no-document --system && \
30
+ gem install --no-document bundler && \
33
31
  npm install -g --silent \
34
32
  mermaid.cli \
35
33
  nomnoml \
36
34
  state-machine-cat \
37
35
  vega-cli \
38
36
  vega-lite \
39
- wavedrom-cli; \
37
+ wavedrom-cli && \
40
38
  pip3 install \
41
39
  blockdiag \
42
40
  seqdiag \
@@ -44,8 +42,12 @@ RUN set -eux; \
44
42
  nwdiag \
45
43
  syntrax
46
44
 
45
+ EXPOSE 4000
46
+
47
47
  WORKDIR /app
48
48
 
49
- RUN gem install -N jekyll jekyll-diagrams
49
+ COPY . .
50
+
51
+ RUN bundle install
50
52
 
51
- EXPOSE 4000
53
+ RUN bundle exec rake
data/Gemfile CHANGED
@@ -1,5 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
5
- gem 'coveralls', require: false
7
+ gem 'coveralls', require: false
8
+ gem 'rubocop', require: false
data/README.md CHANGED
@@ -1,16 +1,20 @@
1
1
  # Jekyll Diagrams
2
2
 
3
3
  [![Gem](https://img.shields.io/gem/v/jekyll-diagrams.svg?style=flat-square)](https://rubygems.org/gems/jekyll-diagrams)
4
- [![Travis](https://img.shields.io/travis/zhustec/jekyll-diagrams.svg?style=flat-square)](https://travis-ci.com/zhustec/jekyll-diagrams)
5
4
  [![Depfu](https://img.shields.io/depfu/zhustec/jekyll-diagrams.svg?style=flat-square)](https://depfu.com/repos/zhustec/jekyll-diagrams)
6
- [![license](https://img.shields.io/github/license/zhustec/jekyll-diagrams.svg?style=flat-square)](https://github.com/zhustec/jekyll-diagrams/blob/master/LICENSE)
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)
7
9
 
8
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.
9
11
 
10
12
  **NOTICE:** This plugin render **SVG** format image and directly **embed into html file**, so you don't need to worry about where to store the image. But, please feel free to tell me if you **unlikely** want other image format.
11
13
 
12
14
  - [Installation](#installation)
13
- - [Configuration](#configuration)
15
+ - [Configurations](#configurations)
16
+ - [Site Configurations](#site-configurations)
17
+ - [Page Configurations](#page-configurations)
14
18
  - [Usage](#usage)
15
19
  - [Blockdiag](#blockdiag)
16
20
  - [Erd](#erd)
@@ -49,9 +53,11 @@ Finally run:
49
53
  $ bundle install
50
54
  ```
51
55
 
52
- ## Configuration
56
+ ## Configurations
57
+
58
+ ### Site Configurations
53
59
 
54
- All configurations are under `jekyll-diagrams`, e.g:
60
+ Site configurations can be set in your site's config file under `jekyll-diagrams` key, e.g:
55
61
 
56
62
  ```yaml
57
63
  jekyll-diagrams:
@@ -64,6 +70,27 @@ jekyll-diagrams:
64
70
  # and so on
65
71
  ```
66
72
 
73
+ ### Page Configurations
74
+
75
+ You can set configurations in the front matter of each page, this will overwite global config. e.g.
76
+
77
+ ```text
78
+ ---
79
+ title: Custom configurations per page
80
+
81
+ jekyll-diagrams:
82
+ graphviz:
83
+ # configurations for graphviz
84
+ blockdiag:
85
+ # configurations for blockdiag
86
+ syntrax:
87
+ # configurations for syntrax
88
+ # and so on
89
+ ---
90
+
91
+ # your content
92
+ ```
93
+
67
94
  ## Usage
68
95
 
69
96
  ### Blockdiag
@@ -155,11 +182,11 @@ Person *--1 `Birth Place`
155
182
 
156
183
  #### Configurations
157
184
 
158
- | Config | Default | Description |
159
- | ------------ | ----------- | ------------------------------------------------------------------------------------------------------- |
160
- | `config` | unspecified | Configuration file |
161
- | `edge` | unspecified | Select one type of edge: compound, noedge, ortho, poly, spline |
162
- | `dot-entity` | unspecified | When set, output will consist of regular dot tables instead of HTML tables. Formatting will be disabled |
185
+ | Config | Default | Description |
186
+ | ------------ | ----------- | -------------------------------------------------------------------------- |
187
+ | `config` | unspecified | Configuration file |
188
+ | `edge` | unspecified | Select one type of edge: compound, noedge, ortho, poly, spline |
189
+ | `dot-entity` | unspecified | When set, output will consist of regular dot tables instead of HTML tables |
163
190
 
164
191
  ### Graphviz
165
192
 
@@ -188,12 +215,13 @@ digraph {
188
215
 
189
216
  #### Configurations
190
217
 
191
- | Config | Default | Description |
192
- | ------------------ | ----------- | --------------------------- |
193
- | `default_layout` | dot | Set default layout engine |
194
- | `graph_attributes` | unspecified | Set default graph attribute |
195
- | `node_attributes` | unspecified | Set default node attribute |
196
- | `edge_attributes` | unspecified | Set default edge attribute |
218
+ | Config | Default | Description |
219
+ | ------------------ | ----------- | ---------------------------- |
220
+ | `default_layout` | dot | Set layout engine |
221
+ | `graph_attributes` | unspecified | Set default graph attributes |
222
+ | `node_attributes` | unspecified | Set default node attributes |
223
+ | `edge_attributes` | unspecified | Set default edge attributes |
224
+ | `encoding` | utf-8 | Set default SVG encoding |
197
225
 
198
226
  **NOTICE:** attributes can be `String`(when just one attribute), `Array` or `Hash`.
199
227
 
@@ -225,10 +253,10 @@ sequenceDiagram
225
253
 
226
254
  | Config | Default | Description |
227
255
  | ----------------- | ------- | ------------------------------------------------------------- |
228
- | `theme` | default | Theme of the chart, could be default, forest, dark or neutral |
229
256
  | `width` | 800 | Width of the page |
230
257
  | `height` | 600 | Height of the page |
231
258
  | `backgroundColor` | white | Background color. Example: transparent, red, '#F0F0F0' |
259
+ | `theme` | default | Theme of the chart, could be default, forest, dark or neutral |
232
260
 
233
261
  ### Nomnoml
234
262
 
@@ -325,9 +353,9 @@ initial => "tape player off";
325
353
 
326
354
  | Config | Default | Description |
327
355
  | ------------ | ---------- | ----------------------------------------------------------------------------------- |
328
- | `input-type` | `smcat` | Input type. `smcat|scxml|json` |
329
- | `engine` | `dot` | Layout engine to use. `dot|circo|fdp|neato|osage|twopi` |
330
- | `direction` | `top-down` | Direction of the state machine diagram. `top-down|bottom-top|left-right|right-left` |
356
+ | `input-type` | `smcat` | Input type. `smcat scxml json` |
357
+ | `engine` | `dot` | Layout engine to use. `dot circo fdp neato osage twopi` |
358
+ | `direction` | `top-down` | Direction of the state machine diagram. `top-down bottom-top left-right right-left` |
331
359
 
332
360
  ### Svgbob
333
361
 
@@ -466,4 +494,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/zhuste
466
494
 
467
495
  ## License
468
496
 
469
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
497
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,5 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
- require "rake/testtask"
4
+
5
+ require 'rake/testtask'
3
6
 
4
7
  Rake::TestTask.new(:test) do |t|
5
8
  t.libs << 'test'
@@ -7,4 +10,19 @@ Rake::TestTask.new(:test) do |t|
7
10
  t.test_files = FileList['test/**/*_test.rb']
8
11
  end
9
12
 
10
- task default: :test
13
+ desc 'Run test and show coverage'
14
+ task :coverage do
15
+ system 'bundle exec coveralls report'
16
+ end
17
+
18
+ desc 'Run features tests'
19
+ task :features do
20
+ system 'bundle exec cucumber --format summary'
21
+ end
22
+
23
+ desc 'Run rubocop'
24
+ task :rubocop do
25
+ system 'bundle exec rubocop'
26
+ end
27
+
28
+ task default: %i[test features]
@@ -0,0 +1,20 @@
1
+ Feature: Blockdiag
2
+
3
+
4
+ Scenario: Default configuration
5
+ Given I have a file 'blockdiag.md' with content:
6
+ """
7
+ ---
8
+ ---
9
+
10
+ {% blockdiag %}
11
+ blockdiag {
12
+ A -> B -> C -> D;
13
+ A -> E -> F -> G;
14
+ }
15
+ {% endblockdiag %}
16
+ """
17
+ When I run jekyll build
18
+ Then the file '_site/blockdiag.html' should exist
19
+ And I should see 'diagrams blockdiag' in '_site/blockdiag.html'
20
+ And I should see svg output in '_site/blockdiag.html'
@@ -0,0 +1,22 @@
1
+ Feature: Graphviz
2
+
3
+
4
+ Scenario: Default configuration
5
+ Given I have a file 'graphviz.md' with content:
6
+ """
7
+ ---
8
+ ---
9
+
10
+ {% graphviz %}
11
+ digraph {
12
+ S -> A;
13
+ S -> B;
14
+ A -> D;
15
+ B -> D;
16
+ }
17
+ {% endgraphviz %}
18
+ """
19
+ When I run jekyll build
20
+ Then the file '_site/graphviz.html' should exist
21
+ And I should see 'diagrams graphviz' in '_site/graphviz.html'
22
+ And I should see svg output in '_site/graphviz.html'