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
data/.travis.yml DELETED
@@ -1,50 +0,0 @@
1
- language: ruby
2
-
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 DELETED
@@ -1,53 +0,0 @@
1
- FROM ubuntu:bionic
2
-
3
- RUN apt-get -qq update && \
4
- apt-get install -y --no-install-recommends \
5
- build-essential \
6
- git \
7
- cabal-install \
8
- cargo \
9
- default-jre-headless \
10
- graphviz \
11
- npm \
12
- libatk1.0-0 \
13
- libatk-bridge2.0-0 \
14
- libgtk-3-0 \
15
- libx11-xcb1 \
16
- libxcomposite1 \
17
- libxrandr2 \
18
- libxss1 \
19
- libpango1.0-dev \
20
- libpython3-dev \
21
- python3-pip \
22
- python3-setuptools \
23
- python3-cairo \
24
- python3-gi \
25
- python3-gi-cairo \
26
- ruby-full
27
-
28
- RUN cargo install --root /usr/local svgbob_cli && \
29
- gem update --no-document --system && \
30
- gem install --no-document bundler && \
31
- npm install -g --silent \
32
- mermaid.cli \
33
- nomnoml \
34
- state-machine-cat \
35
- vega-cli \
36
- vega-lite \
37
- wavedrom-cli && \
38
- pip3 install \
39
- blockdiag \
40
- seqdiag \
41
- actdiag \
42
- nwdiag \
43
- syntrax
44
-
45
- EXPOSE 4000
46
-
47
- WORKDIR /app
48
-
49
- COPY . .
50
-
51
- RUN bundle install
52
-
53
- RUN bundle exec rake
data/Gemfile DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gemspec
6
-
7
- gem 'coveralls', require: false
8
- gem 'rubocop', require: false
data/Rakefile DELETED
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
-
5
- require 'rake/testtask'
6
-
7
- Rake::TestTask.new(:test) do |t|
8
- t.libs << 'test'
9
- t.libs << 'lib'
10
- t.test_files = FileList['test/**/*_test.rb']
11
- end
12
-
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]
@@ -1,22 +0,0 @@
1
- Feature: Svgbob
2
-
3
-
4
- Scenario: Default configuration
5
- Given I have a file 'svgbob.md' with content:
6
- """
7
- ---
8
- ---
9
-
10
- {% svgbob %}
11
- .---> F
12
- A B C D /
13
- *-------*-----*---*----*-----> E
14
- \ ^ \
15
- v / '---> G
16
- B --> C -'
17
- {% endsvgbob %}
18
- """
19
- When I run jekyll build
20
- Then the file '_site/svgbob.html' should exist
21
- And I should see 'diagrams svgbob' in '_site/svgbob.html'
22
- And I should see svg output in '_site/svgbob.html'
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path('lib', __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
-
6
- require 'jekyll-diagrams/version'
7
-
8
- Gem::Specification.new do |spec|
9
- spec.name = 'jekyll-diagrams'
10
- spec.version = Jekyll::Diagrams::VERSION
11
- spec.author = 'zhustec'
12
- spec.email = 'zhustec@foxmail.com'
13
- spec.homepage = 'https://github.com/zhustec/jekyll-diagrams'
14
- spec.license = 'MIT'
15
- spec.summary = 'Jekyll plugins for diagrams support'
16
- spec.description = <<~DESC
17
- Jekyll plugins for diagrams support, including Graphviz, Blockdiag,
18
- PlantUML and so on.
19
- DESC
20
-
21
- spec.files = `git ls-files -z`.split("\x0")
22
- spec.test_files = spec.files.grep(/^(test|spec|features)/)
23
- spec.require_paths = ['lib']
24
-
25
- spec.add_dependency 'jekyll', '>= 3.7', '< 5.0'
26
-
27
- spec.add_development_dependency 'bundler'
28
- spec.add_development_dependency 'cucumber'
29
- spec.add_development_dependency 'minitest', '~> 5.0'
30
- spec.add_development_dependency 'rake'
31
- end
@@ -1,95 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'open3'
4
- require 'tempfile'
5
-
6
- module Jekyll
7
- module Diagrams
8
- module Util
9
- module_function
10
-
11
- def diagrams_config(context)
12
- site_config = context.registers[:site].config.fetch(config_name, {})
13
- page_config = context.registers[:page].fetch(config_name, {})
14
-
15
- site_config.merge(page_config)
16
- end
17
-
18
- def config_for(context, name)
19
- diagrams_config(context).fetch(name, {})
20
- end
21
-
22
- def config_name
23
- 'jekyll-diagrams'
24
- end
25
-
26
- def vendor_path(file = '')
27
- File.join(File.expand_path('../../vendor', __dir__), file)
28
- end
29
-
30
- def normalized_attrs(attrs, prefix:, sep: '=')
31
- attrs = case attrs
32
- when String
33
- attrs
34
- when Array
35
- attrs.join(prefix)
36
- when Hash
37
- attrs.map { |k, v| "#{k}#{sep}#{v}" }.join(prefix)
38
- end
39
-
40
- "#{prefix}#{attrs}"
41
- end
42
-
43
- def render_with_stdin_stdout(command, content)
44
- render_with_stdin(command, content, stdout: true)
45
- end
46
-
47
- def render_with_stdin(command, content, stdout: false, &block)
48
- if stdout == true
49
- render_with_command(command, :stdout, stdin_data: content)
50
- else
51
- output = Tempfile.open(['jekyll_diagrams_output', '.svg'])
52
- output.close
53
- extra = block.call(ouput.path)
54
- command = "#{command} #{extra}"
55
-
56
- render_with_command(command, output.path, stdin_data: content)
57
- end
58
- end
59
-
60
- def render_with_tempfile(command, content, stdout: false, &block)
61
- Tempfile.open('jekyll_diagrams_input') do |input|
62
- File.write(input.path, content)
63
-
64
- if stdout == true
65
- extra = block.call(input.path)
66
- command = "#{command} #{extra}"
67
-
68
- render_with_command(command, :stdout)
69
- else
70
- output = Tempfile.open(['jekyll_diagrams_output', '.svg'])
71
- output.close
72
- extra = block.call(input.path, output.path)
73
- command = "#{command} #{extra}"
74
-
75
- render_with_command(command, output.path)
76
- end
77
- end
78
- end
79
-
80
- def render_with_command(command, output, options = {})
81
- stdout, stderr, status = Open3.capture3(command, options)
82
-
83
- unless status.success?
84
- raise <<~MESSAGE
85
- Failed to render command: #{command}
86
- #{stdout}
87
- #{stderr}
88
- MESSAGE
89
- end
90
-
91
- output == :stdout ? stdout : File.read(output)
92
- end
93
- end
94
- end
95
- end
data/test/util_test.rb DELETED
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- class UtilTest < Minitest::Test
6
- include Jekyll::Diagrams::Util
7
-
8
- def test_normalized_attrs
9
- attrs = 'color=red'
10
- assert_equal ' -Ecolor=red', normalized_attrs(attrs, prefix: ' -E')
11
-
12
- attrs = %w[color=red background=green]
13
- assert_equal ' -Gcolor=red -Gbackground=green',
14
- normalized_attrs(attrs, prefix: ' -G')
15
-
16
- attrs = { 'color' => 'red', 'background' => 'green' }
17
- assert_equal ' -Ncolor=red -Nbackground=green',
18
- normalized_attrs(attrs, prefix: ' -N')
19
- end
20
- end