kramdown-plantuml 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64b799c8bdeb80c21cc6cfd1b2001dc25eb4d1f2042e1b3ce8110e94b949ada3
4
- data.tar.gz: 48a5f89a75af22f1d970d4e8cdf3b57db69d66c53e14fedeb9d7c38cd5469578
3
+ metadata.gz: e51da02b82f51bd70b685e9d5286ca34cab9a8b9a3f3621998874638e94adfcc
4
+ data.tar.gz: 0ce4c33a2185a964aa36efd4f3112ca8144d2222ce80831aa79f95eb0bfaa848
5
5
  SHA512:
6
- metadata.gz: 6f2ec902c2e1ca5ec8d3628b92434fe6b914e2831b50b4932768d68463baa9a4924d281be2707101a4cc5f5991f452094687a4e23c190bf6984fab080294815b
7
- data.tar.gz: 64d2907a02c2744af63286585ab1d9ef246bdc2df595631d6e7a2207e906d57fea8b3bde13b5eedac0b0d6a03cc43d66b5965489281e7b70de4a3ecec4a2849c
6
+ metadata.gz: 705fb1c0c560dc1fd6b601155e2cbb50f5fd8e49f78e0f28c1a1d1f370cb706684370184db0be718acac8c84a625fd6b404c194471772d74805ce65c927fcdb6
7
+ data.tar.gz: a07b250f306da8269ec7a7250245ddbb98093cf05b5c38947f255e91d51ada5f4f2567f65d49ff795aadc44fbf5c38c51654bd69cbe0a369f79d9654428f3622
@@ -0,0 +1,25 @@
1
+ name: No Java
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '*'
7
+ pull_request:
8
+
9
+ jobs:
10
+ test:
11
+ name: No Java
12
+ runs-on: ubuntu-latest
13
+ container:
14
+ image: ruby:2.7.0-alpine3.11
15
+
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+
19
+ - name: Bundle install
20
+ run: |
21
+ find .
22
+ bundle install --jobs 4 --retry 3
23
+
24
+ - name: Test with Rake
25
+ run: bundle exec rspec --tag no_java
@@ -0,0 +1,26 @@
1
+ name: No PlantUML
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '*'
7
+ pull_request:
8
+
9
+ jobs:
10
+ test:
11
+ name: No PlantUML
12
+ runs-on: ubuntu-latest
13
+ container:
14
+ image: ruby:2.7.0-alpine3.11
15
+
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+
19
+ - name: Bundle install
20
+ run: bundle install --jobs 4 --retry 3
21
+
22
+ - name: Remove plantuml.1.2020.5.jar
23
+ run: rm bin/plantuml.1.2020.5.jar
24
+
25
+ - name: Test with Rake
26
+ run: bundle exec rspec --tag no_plantuml
@@ -0,0 +1,123 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - '*'
7
+ tags:
8
+ - '*'
9
+ pull_request:
10
+
11
+ jobs:
12
+ build:
13
+ name: Build, Test and Publish Ruby Gem
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ with:
19
+ fetch-depth: 0
20
+
21
+ - name: Fetch all history for all tags and branches
22
+ run: |
23
+ git fetch --prune --tags
24
+ echo "REF: ${{ github.ref }}"
25
+
26
+ - name: Install GitVersion
27
+ uses: gittools/actions/gitversion/setup@v0.9.2
28
+ if: startsWith(github.ref, 'refs/tags/') != true # Only use GitVersion for unstable builds
29
+ with:
30
+ versionSpec: '5.2.x'
31
+
32
+ - name: Execute GitVersion
33
+ id: gitversion
34
+ if: startsWith(github.ref, 'refs/tags/') != true
35
+ uses: gittools/actions/gitversion/execute@v0.9.2
36
+
37
+ - name: Create gem version number
38
+ id: gemversion
39
+ uses: actions/github-script@0.9.0
40
+ with:
41
+ github-token: ${{ secrets.GITHUB_TOKEN }}
42
+ script: |
43
+ const gemVersion = (function() {
44
+ const ref = '${{ github.ref }}';
45
+ const tagPrefix = 'refs/tags/';
46
+
47
+ if (ref.startsWith(tagPrefix)) {
48
+ // If a tag ref is being built, just return the tag verbatim
49
+ return ref.substring(tagPrefix.length);
50
+ }
51
+
52
+ const escapedBranchName = '${{ steps.gitversion.outputs.escapedBranchName }}';
53
+ const commitsSinceVersionSource = '${{ steps.gitversion.outputs.commitsSinceVersionSourcePadded }}';
54
+ const preReleaseLabel = escapedBranchName + '.' + commitsSinceVersionSource;
55
+ const majorMinorPatch = '${{ steps.gitversion.outputs.majorMinorPatch }}';
56
+ return majorMinorPatch + preReleaseLabel;
57
+ })();
58
+
59
+ core.debug('Gem version: ' + gemVersion);
60
+ core.setOutput('version', gemVersion);
61
+
62
+ - name: Set up Ruby 2.6
63
+ uses: actions/setup-ruby@v1
64
+ with:
65
+ ruby-version: 2.6.x
66
+
67
+ - name: Setup Graphviz
68
+ uses: kamiazya/setup-graphviz@v1
69
+
70
+ - name: Cache dependencies
71
+ uses: actions/cache@v1
72
+ with:
73
+ path: vendor/bundle
74
+ key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
75
+ restore-keys: ${{ runner.os }}-gems-
76
+
77
+ - name: Bundle install
78
+ run: |
79
+ gem install bundler
80
+ bundle config path vendor/bundle
81
+ bundle install --jobs 4 --retry 3
82
+
83
+ - name: Test with Rake
84
+ env:
85
+ GEM_VERSION: ${{ steps.gemversion.outputs.version }}
86
+ run: bundle exec rake
87
+
88
+ - name: Build gem
89
+ id: gem
90
+ env:
91
+ GEM_VERSION: ${{ steps.gemversion.outputs.version }}
92
+ run: |
93
+ GEM_BUILD_NAME=$(gem build kramdown-plantuml.gemspec | awk '/File/ {print $2}')
94
+ echo "Gem filename: '${GEM_BUILD_NAME}'"
95
+ echo "::set-output name=name::${GEM_BUILD_NAME}"
96
+
97
+ - name: Upload artifact
98
+ uses: actions/upload-artifact@v2-preview
99
+ with:
100
+ name: ${{ steps.gem.outputs.name }}
101
+ path: ${{ steps.gem.outputs.name }}
102
+
103
+ - name: Publish to GPR
104
+ env:
105
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106
+ OWNER: SwedbankPay
107
+ run: |
108
+ mkdir -p $HOME/.gem
109
+ touch $HOME/.gem/credentials
110
+ chmod 0600 $HOME/.gem/credentials
111
+ printf -- "---\n:github: Bearer ${GITHUB_TOKEN}\n" > $HOME/.gem/credentials
112
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} ${{ steps.gem.outputs.name }}
113
+
114
+ - name: Publish to RubyGems
115
+ if: startsWith(github.ref, 'refs/tags/') # Only publish tagged commits
116
+ env:
117
+ RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
118
+ run: |
119
+ mkdir -p $HOME/.gem
120
+ touch $HOME/.gem/credentials
121
+ chmod 0600 $HOME/.gem/credentials
122
+ printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials
123
+ gem push ${{ steps.gem.outputs.name }}
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.gem
10
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -0,0 +1,129 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
129
+
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in kramdown-plantuml.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "kramdown"
8
+ gem "open3"
9
+
10
+ group :development, :test do
11
+ gem "rspec"
12
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Swedbank Pay and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # Kramdown::PlantUml
2
+
3
+ [![Contributor Covenant][coc-badge]][coc]
4
+ ![Build][build-badge]
5
+ ![No Java][no-java-build-badge]
6
+ ![No PlantUML][no-plantuml-badge]
7
+
8
+ `kramdown-plantuml` allows you to use [PlantUML][plantuml] syntax within [fenced
9
+ code blocks][fenced] in [Jekyll] with its default [Kramdown][kramdown] Markdown
10
+ parser:
11
+
12
+ ````md
13
+ ```plantuml
14
+ @startuml Diagram
15
+ actor client
16
+ node app
17
+ database db
18
+ db -> app
19
+ app -> client
20
+ @enduml
21
+ ```
22
+ ````
23
+
24
+ Using the `plantuml` language identifier in fenced code blocks will allow
25
+ `kramdown-plantuml` to pick it up and replace it with a rendered [SVG][svg]
26
+ diagram when the Markdown is rendered to HTML. The above diagram will be
27
+ replaced with the following:
28
+
29
+ ![Rendered SVG Diagram][diagram-svg]
30
+
31
+ ## Installation
32
+
33
+ Add this line to your application's Gemfile:
34
+
35
+ ```ruby
36
+ gem 'kramdown-plantuml'
37
+ ```
38
+
39
+ And then execute:
40
+
41
+ ```sh
42
+ bundle install
43
+ ```
44
+
45
+ Or install it yourself as:
46
+
47
+ ```sh
48
+ gem install kramdown-plantuml
49
+ ```
50
+
51
+ And then add the following to your Jekyll site's `_config.yml` file:
52
+
53
+ ```yaml
54
+ plugins:
55
+ - "kramdown-plantuml"
56
+ ```
57
+
58
+ Then, `bundle exec jekyll build` or `bundle exec jekyll serve` will execute
59
+ `kramdown-plantuml`, converting code fenced PlantUML diagrams to beautiful
60
+ SVG.
61
+
62
+ ## Development
63
+
64
+ After checking out the repo, run `bin/setup` to install dependencies. You can
65
+ also run `bin/console` for an interactive prompt that will allow you to
66
+ experiment.
67
+
68
+ To install this gem onto your local machine, run `bundle exec rake install`. To
69
+ release a new version, update the version number in `version.rb`, and then run
70
+ `bundle exec rake release`, which will create a git tag for the version, push
71
+ git commits and tags, and push the `.gem` file to [rubygems.org][gems].
72
+
73
+ ## Contributing
74
+
75
+ Bug reports and pull requests are welcome on [GitHub][github]. This project is
76
+ intended to be a safe, welcoming space for collaboration, and contributors are
77
+ expected to adhere to the [code of conduct][coc].
78
+
79
+ ## License
80
+
81
+ The gem is available as open source under the terms of the [MIT License][mit].
82
+
83
+ ## Code of Conduct
84
+
85
+ Everyone interacting in the Kramdown::PlantUml project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/kramdown-plantuml/blob/master/CODE_OF_CONDUCT.md).
86
+
87
+ [plantuml]: https://plantuml.com/
88
+ [jekyll]: https://jekyllrb.com/
89
+ [kramdown]: https://kramdown.gettalong.org/
90
+ [gems]: https://rubygems.org
91
+ [github]: https://github.com/SwedbankPay/kramdown-plantuml/
92
+ [coc]: CODE_OF_CONDUCT.md
93
+ [coc-badge]: https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg
94
+ [mit]: https://opensource.org/licenses/MIT
95
+ [fenced]: https://www.markdownguide.org/extended-syntax/#syntax-highlighting
96
+ [svg]: https://developer.mozilla.org/en-US/docs/Web/SVG
97
+ [diagram-svg]: spec/diagram.svg
98
+ [build-badge]: https://github.com/SwedbankPay/kramdown-plantuml/workflows/Ruby%20Gem/badge.svg?branch=master
99
+ [no-java-build-badge]: https://github.com/SwedbankPay/kramdown-plantuml/workflows/No%20Java/badge.svg?branch=master
100
+ [no-plantuml-badge]: https://github.com/SwedbankPay/kramdown-plantuml/workflows/No%20PlantUML/badge.svg?branch=master
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'rake'
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec) do |t|
6
+ t.pattern = Dir.glob('spec/**/*_spec.rb')
7
+ t.rspec_opts = '--format documentation --tag ~no_plantuml --tag ~no_java'
8
+ end
9
+
10
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "kramdown-plantuml"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
Binary file
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,33 @@
1
+ require_relative 'lib/which'
2
+ require_relative 'lib/kramdown-plantuml/version'
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = "kramdown-plantuml"
6
+ spec.version = Kramdown::PlantUml::VERSION
7
+ spec.authors = ["Asbjørn Ulsberg"]
8
+ spec.email = ["asbjorn@ulsberg.no"]
9
+
10
+ spec.summary = "Short summary"
11
+ spec.homepage = "https://github.com/SwedbankPay/kramdown-plantuml"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ spec.metadata["homepage_uri"] = spec.homepage
16
+ spec.metadata["source_code_uri"] = "https://github.com/SwedbankPay/kramdown-plantuml"
17
+
18
+ # Specify which files should be added to the gem when it is released.
19
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
21
+ if Which::which('git')
22
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
+ else
24
+ puts "Git not found, no files added to #{spec.name}."
25
+ end
26
+ end
27
+ spec.bindir = "exe"
28
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_development_dependency "rake", "~> 12.3"
32
+ spec.add_development_dependency "rspec", "~> 3.2"
33
+ end
@@ -0,0 +1,7 @@
1
+ require 'kramdown-plantuml/version'
2
+ require 'kramdown-plantuml/converter'
3
+ require 'kramdown_html'
4
+
5
+ module Kramdown::PlantUml
6
+ class Error < StandardError; end
7
+ end
@@ -0,0 +1,34 @@
1
+ require 'which'
2
+ require 'open3'
3
+ require_relative 'version'
4
+
5
+ module Kramdown::PlantUml
6
+ class Converter
7
+ def initialize
8
+ dir = File.dirname __dir__
9
+ bin = File.join dir, "../bin"
10
+ bin = File.expand_path bin
11
+ @plant_uml_jar_file = File.join bin, "plantuml.1.2020.5.jar"
12
+
13
+ if not File.exists? @plant_uml_jar_file
14
+ raise IOError.new("'#{@plant_uml_jar_file}' does not exist")
15
+ end
16
+
17
+ unless Which::which("java")
18
+ raise IOError.new("Java can not be found")
19
+ end
20
+ end
21
+
22
+ def convert_plantuml_to_svg(content)
23
+ cmd = "java -jar #{@plant_uml_jar_file} -tsvg -pipe"
24
+
25
+ stdout, stderr, status = Open3.capture3(cmd, :stdin_data => content)
26
+
27
+ unless stderr.empty?
28
+ raise stderr
29
+ end
30
+
31
+ return stdout
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,6 @@
1
+ module Kramdown
2
+ module PlantUml
3
+ @version = ENV['GEM_VERSION'] || '0.0.1-INVALID'
4
+ VERSION = @version
5
+ end
6
+ end
@@ -0,0 +1,15 @@
1
+ require 'kramdown'
2
+ require "kramdown-plantuml/converter"
3
+
4
+ class Kramdown::Converter::Html
5
+ alias_method :super_convert_codeblock, :convert_codeblock
6
+
7
+ def convert_codeblock(element, indent)
8
+ if element.attr["class"] != "language-plantuml"
9
+ return super_convert_codeblock(element, indent)
10
+ end
11
+
12
+ converter = Kramdown::PlantUml::Converter.new
13
+ return converter.convert_plantuml_to_svg(element.value)
14
+ end
15
+ end
data/lib/which.rb ADDED
@@ -0,0 +1,12 @@
1
+ class Which
2
+ def self.which(cmd)
3
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
4
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
5
+ exts.each do |ext|
6
+ exe = File.join(path, "#{cmd}#{ext}")
7
+ return exe if File.executable?(exe) && !File.directory?(exe)
8
+ end
9
+ end
10
+ nil
11
+ end
12
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kramdown-plantuml
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Asbjørn Ulsberg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-31 00:00:00.000000000 Z
11
+ date: 2020-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -44,7 +44,26 @@ email:
44
44
  executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
- files: []
47
+ files:
48
+ - ".github/workflows/no-java.yml"
49
+ - ".github/workflows/no-plantuml.yml"
50
+ - ".github/workflows/ruby.yml"
51
+ - ".gitignore"
52
+ - ".rspec"
53
+ - CODE_OF_CONDUCT.md
54
+ - Gemfile
55
+ - LICENSE
56
+ - README.md
57
+ - Rakefile
58
+ - bin/console
59
+ - bin/plantuml.1.2020.5.jar
60
+ - bin/setup
61
+ - kramdown-plantuml.gemspec
62
+ - lib/kramdown-plantuml.rb
63
+ - lib/kramdown-plantuml/converter.rb
64
+ - lib/kramdown-plantuml/version.rb
65
+ - lib/kramdown_html.rb
66
+ - lib/which.rb
48
67
  homepage: https://github.com/SwedbankPay/kramdown-plantuml
49
68
  licenses:
50
69
  - MIT
@@ -66,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
85
  - !ruby/object:Gem::Version
67
86
  version: '0'
68
87
  requirements: []
69
- rubygems_version: 3.1.2
88
+ rubygems_version: 3.0.3
70
89
  signing_key:
71
90
  specification_version: 4
72
91
  summary: Short summary