kramdown-plantuml 1.0.5 → 1.1.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 +4 -4
- data/.github/codecov.yml +2 -0
- data/.github/dependabot.yml +23 -0
- data/.github/mergify.yml +22 -0
- data/.github/scripts/amend.sh +176 -0
- data/.github/scripts/publish-gem.sh +24 -6
- data/.github/scripts/test-gem.sh +70 -40
- data/.github/scripts/variables.sh +4 -2
- data/.github/workflows/amend.yml +19 -0
- data/.github/workflows/no-java.yml +1 -2
- data/.github/workflows/no-plantuml.yml +4 -7
- data/.github/workflows/ruby.yml +39 -29
- data/.github/workflows/shell.yml +1 -5
- data/.gitignore +4 -0
- data/.rubocop.yml +1 -0
- data/GitVersion.yml +5 -0
- data/README.md +106 -18
- data/Rakefile +18 -1
- data/bin/net/sourceforge/plantuml/plantuml/{1.2020.18/plantuml-1.2020.18.jar → 1.2021.8/plantuml-1.2021.8.jar} +0 -0
- data/kramdown-plantuml.gemspec +10 -3
- data/lib/kramdown-plantuml.rb +0 -6
- data/lib/kramdown-plantuml/bool_env.rb +24 -0
- data/lib/kramdown-plantuml/console_logger.rb +56 -0
- data/lib/kramdown-plantuml/converter.rb +23 -25
- data/lib/kramdown-plantuml/executor.rb +48 -0
- data/lib/kramdown-plantuml/hash.rb +14 -0
- data/lib/kramdown-plantuml/logger.rb +68 -0
- data/lib/kramdown-plantuml/plantuml_error.rb +33 -0
- data/lib/kramdown-plantuml/plantuml_result.rb +49 -0
- data/lib/kramdown-plantuml/themer.rb +50 -0
- data/lib/kramdown-plantuml/version.rb +1 -1
- data/lib/kramdown_html.rb +8 -4
- data/pom.xml +1 -1
- metadata +78 -9
- data/.github/scripts/bundle-install.sh +0 -6
@@ -43,8 +43,10 @@ initialize() {
|
|
43
43
|
}
|
44
44
|
|
45
45
|
generate_variables() {
|
46
|
-
# Replace + in the version number with
|
47
|
-
version="${version
|
46
|
+
# Replace '+'' in the version number with '.'.
|
47
|
+
version="${version//+/.}"
|
48
|
+
# Replace '-' in the version number with '.'.
|
49
|
+
version="${version//-/.}"
|
48
50
|
|
49
51
|
if [[ "$ref" == refs/tags/* ]]; then
|
50
52
|
# Override GitVersion's version on tags, just to be sure.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
name: amend
|
2
|
+
|
3
|
+
on:
|
4
|
+
issue_comment:
|
5
|
+
types: [created]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
amend:
|
9
|
+
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/amend')
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
with:
|
14
|
+
persist-credentials: false
|
15
|
+
- name: amend
|
16
|
+
env:
|
17
|
+
GITHUB_TOKEN: ${{ secrets.PUBLIC_REPO_TOKEN }}
|
18
|
+
GITHUB_CONTEXT: ${{ toJSON(github) }}
|
19
|
+
run: .github/scripts/amend.sh --user payex-dev --verbose
|
@@ -8,7 +8,6 @@ on:
|
|
8
8
|
|
9
9
|
jobs:
|
10
10
|
test:
|
11
|
-
name: No Java
|
12
11
|
runs-on: ubuntu-latest
|
13
12
|
container:
|
14
13
|
image: ruby:2.7.2
|
@@ -19,5 +18,5 @@ jobs:
|
|
19
18
|
- name: Bundle install
|
20
19
|
run: bundle install --jobs 4 --retry 3
|
21
20
|
|
22
|
-
- name:
|
21
|
+
- name: RSpec
|
23
22
|
run: bundle exec rspec --tag no_java
|
@@ -8,19 +8,16 @@ on:
|
|
8
8
|
|
9
9
|
jobs:
|
10
10
|
test:
|
11
|
-
name: No PlantUML
|
12
11
|
runs-on: ubuntu-latest
|
13
12
|
|
14
13
|
steps:
|
15
14
|
- uses: actions/checkout@v2
|
16
15
|
|
17
16
|
- name: Set up Ruby 2.7
|
18
|
-
uses:
|
17
|
+
uses: ruby/setup-ruby@v1
|
19
18
|
with:
|
20
|
-
ruby-version: 2.7
|
19
|
+
ruby-version: 2.7
|
20
|
+
bundler-cache: true
|
21
21
|
|
22
|
-
- name:
|
23
|
-
run: bundle install --jobs 4 --retry 3
|
24
|
-
|
25
|
-
- name: Test with Rake
|
22
|
+
- name: RSpec
|
26
23
|
run: bundle exec rspec --tag no_plantuml
|
data/.github/workflows/ruby.yml
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
name: Ruby Gem
|
2
2
|
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: ['*']
|
6
|
-
tags: ['*']
|
7
|
-
pull_request:
|
3
|
+
on: [push, pull_request, pull_request_target]
|
8
4
|
|
9
5
|
jobs:
|
10
6
|
version:
|
@@ -19,19 +15,19 @@ jobs:
|
|
19
15
|
fetch-depth: 0
|
20
16
|
|
21
17
|
- name: Setup GitVersion
|
22
|
-
uses: gittools/actions/gitversion/setup@v0.9.
|
18
|
+
uses: gittools/actions/gitversion/setup@v0.9.10
|
23
19
|
with:
|
24
|
-
versionSpec: '5.
|
20
|
+
versionSpec: '5.x.x'
|
25
21
|
|
26
22
|
- name: Execute GitVersion
|
27
23
|
id: gitversion
|
28
|
-
uses: gittools/actions/gitversion/execute@v0.9.
|
24
|
+
uses: gittools/actions/gitversion/execute@v0.9.10
|
29
25
|
|
30
26
|
- name: Create variables
|
31
27
|
id: variables
|
32
28
|
env:
|
33
29
|
GITHUB_CONTEXT: ${{ toJson(github) }}
|
34
|
-
run: ./.github/scripts/variables.sh ${{ steps.gitversion.outputs.
|
30
|
+
run: ./.github/scripts/variables.sh ${{ steps.gitversion.outputs.fullSemVer }}
|
35
31
|
|
36
32
|
plantuml:
|
37
33
|
needs: version
|
@@ -41,12 +37,13 @@ jobs:
|
|
41
37
|
- uses: actions/checkout@v2
|
42
38
|
|
43
39
|
- name: Setup Java
|
44
|
-
uses: actions/setup-java@
|
40
|
+
uses: actions/setup-java@v2
|
45
41
|
with:
|
42
|
+
distribution: adopt
|
46
43
|
java-version: 14
|
47
44
|
|
48
45
|
- name: Cache Maven dependencies
|
49
|
-
uses: actions/cache@v2
|
46
|
+
uses: actions/cache@v2.1.6
|
50
47
|
with:
|
51
48
|
path: ~/.m2/repository
|
52
49
|
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
@@ -82,30 +79,26 @@ jobs:
|
|
82
79
|
- name: Version stamp
|
83
80
|
run: sed -i -e 's/0.0.1.dev/${{ needs.version.outputs.version }}/g' ${{ github.workspace }}/lib/kramdown-plantuml/version.rb
|
84
81
|
|
85
|
-
- name:
|
86
|
-
uses:
|
82
|
+
- name: Setup Ruby 2.7
|
83
|
+
uses: ruby/setup-ruby@v1
|
87
84
|
with:
|
88
|
-
ruby-version: 2.7
|
85
|
+
ruby-version: 2.7
|
86
|
+
bundler-cache: true
|
89
87
|
|
90
88
|
- name: Setup Graphviz
|
91
89
|
uses: kamiazya/setup-graphviz@v1
|
92
90
|
|
93
|
-
- name: Cache Ruby gems
|
94
|
-
uses: actions/cache@v1
|
95
|
-
with:
|
96
|
-
path: vendor/bundle
|
97
|
-
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
98
|
-
restore-keys: ${{ runner.os }}-gems-
|
99
|
-
|
100
|
-
- name: Bundle install
|
101
|
-
run: .github/scripts/bundle-install.sh
|
102
|
-
|
103
91
|
- name: rubocop
|
104
92
|
run: bundle exec rubocop --fail-level warning --display-only-fail-level-offenses
|
105
93
|
|
106
94
|
- name: Test with Rake
|
107
95
|
run: bundle exec rake
|
108
96
|
|
97
|
+
- name: RSPec (debug)
|
98
|
+
env:
|
99
|
+
DEBUG: 1
|
100
|
+
run: bundle exec rspec --tag debug
|
101
|
+
|
109
102
|
- name: Codecov upload
|
110
103
|
run: bundle exec rake codecov:upload || echo 'Codecov upload failed'
|
111
104
|
|
@@ -113,7 +106,7 @@ jobs:
|
|
113
106
|
id: gem
|
114
107
|
run: .github/scripts/build-gem.sh
|
115
108
|
|
116
|
-
- name: Upload
|
109
|
+
- name: Upload gem
|
117
110
|
uses: actions/upload-artifact@v2-preview
|
118
111
|
with:
|
119
112
|
name: ${{ steps.gem.outputs.name }}
|
@@ -128,27 +121,44 @@ jobs:
|
|
128
121
|
publish-dev:
|
129
122
|
needs: [version, gem]
|
130
123
|
runs-on: ubuntu-latest
|
124
|
+
if: |
|
125
|
+
(github.event_name == 'pull_request_target' && github.actor == 'dependabot[bot]') ||
|
126
|
+
(github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]')
|
131
127
|
|
132
128
|
steps:
|
133
129
|
- uses: actions/checkout@v2
|
130
|
+
if: ${{ github.event_name != 'pull_request_target' }}
|
131
|
+
|
132
|
+
- uses: actions/checkout@v2
|
133
|
+
if: ${{ github.event_name == 'pull_request_target' }}
|
134
|
+
with:
|
135
|
+
ref: ${{ github.event.pull_request.head.sha }}
|
134
136
|
|
135
137
|
- uses: actions/download-artifact@v2
|
136
138
|
with:
|
137
139
|
name: ${{ needs.gem.outputs.name }}
|
138
140
|
|
139
141
|
- name: Set up Ruby 2.7
|
140
|
-
uses:
|
142
|
+
uses: ruby/setup-ruby@v1
|
141
143
|
with:
|
142
|
-
ruby-version: 2.7
|
144
|
+
ruby-version: 2.7
|
145
|
+
bundler-cache: true
|
143
146
|
|
144
147
|
- name: Setup Graphviz
|
145
148
|
uses: kamiazya/setup-graphviz@v1
|
146
149
|
|
147
150
|
- name: Publish to GPR
|
148
|
-
run: .github/scripts/publish-gem.sh --gem ${{ needs.gem.outputs.name }} --token ${{ secrets.
|
151
|
+
run: .github/scripts/publish-gem.sh --gem ${{ needs.gem.outputs.name }} --token "${{ secrets.GPR_TOKEN }}" --owner SwedbankPay --verbose
|
149
152
|
|
150
153
|
- name: Test gem
|
151
|
-
run: .github/scripts/test-gem.sh --workdir "${{ github.workspace }}/spec/fixture" --version ${{ needs.version.outputs.version }} --token "${{ secrets.
|
154
|
+
run: .github/scripts/test-gem.sh --workdir "${{ github.workspace }}/spec/fixture" --version ${{ needs.version.outputs.version }} --token "${{ secrets.GPR_TOKEN }}" --verbose
|
155
|
+
|
156
|
+
- name: Upload Jekyll site
|
157
|
+
uses: actions/upload-artifact@v2-preview
|
158
|
+
if: always()
|
159
|
+
with:
|
160
|
+
name: site
|
161
|
+
path: ${{ github.workspace }}/spec/fixture/_site
|
152
162
|
|
153
163
|
publish-prod:
|
154
164
|
needs: [version, gem]
|
data/.github/workflows/shell.yml
CHANGED
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/GitVersion.yml
ADDED
data/README.md
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# Kramdown::PlantUml
|
2
2
|
|
3
3
|
[![Gem Version][gem-badge]][gem-url]
|
4
|
-
![
|
5
|
-
![No Java][no-java-
|
6
|
-
![No PlantUML][no-plantuml-badge]
|
4
|
+
[![Ruby Gem][ruby-badge]][ruby-workflow]
|
5
|
+
[![No Java][no-java-badge]][no-java-workflow]
|
6
|
+
[![No PlantUML][no-plantuml-badge]][no-plantuml-workflow]
|
7
|
+
[![Shell][shell-badge]][shell-workflow]
|
8
|
+
[![Codecov][codecov-badge]][codecov]
|
7
9
|
[![License][license-badge]][license]
|
8
|
-
[![Dependabot Status][dependabot-badge]][dependabot]
|
9
10
|
[![CLA assistant][cla-badge]][cla]
|
10
11
|
[![Contributor Covenant][coc-badge]][coc]
|
11
12
|
|
@@ -42,6 +43,17 @@ Which in place will be rendered as the following:
|
|
42
43
|
|
43
44
|
![Rendered SVG Diagram][diagram-svg]
|
44
45
|
|
46
|
+
If you configure theming (described below), the generated HTML will contain the
|
47
|
+
name of the configured theme:
|
48
|
+
|
49
|
+
```html
|
50
|
+
<div class="plantuml theme-spacelab">
|
51
|
+
<svg>
|
52
|
+
<!-- Snip converted SVG code -->
|
53
|
+
</svg>
|
54
|
+
</div>
|
55
|
+
```
|
56
|
+
|
45
57
|
## Installation
|
46
58
|
|
47
59
|
Add this line to your application's Gemfile:
|
@@ -73,16 +85,49 @@ Then, `bundle exec jekyll build` or `bundle exec jekyll serve` will execute
|
|
73
85
|
`kramdown-plantuml`, converting code fenced PlantUML diagrams to beautiful
|
74
86
|
SVG.
|
75
87
|
|
76
|
-
##
|
88
|
+
## Requirements
|
89
|
+
|
90
|
+
`kramdown-plantuml` is dependent on the Java application [PlantUML], which in
|
91
|
+
turn is dependent on [Graphviz]. This means that both Java and Graphviz need to
|
92
|
+
be installed for `kramdown-plantuml` to work.
|
93
|
+
|
94
|
+
## Configuration
|
95
|
+
|
96
|
+
`kramdown-plantuml` can be configured either directly in the `options` Hash
|
97
|
+
provided through Kramdown or by `_config.yml` provided through Jekyll.
|
98
|
+
|
99
|
+
### Theming
|
100
|
+
|
101
|
+
In order to [theme] all PlantUML diagrams fed through `kramdown-plantuml`, you
|
102
|
+
can configure a global theme with the `plantuml.theme.name` and
|
103
|
+
`plantuml.theme.directory` properties. Only `name` is required and will allow
|
104
|
+
any of the built-in themes to be used.
|
105
|
+
|
106
|
+
The theme is simply inserted into each PlantUML diagram with the `!theme`
|
107
|
+
declaration, so this can be centralized in configuration instead of duplicating
|
108
|
+
it across all diagrams.
|
109
|
+
|
110
|
+
Here's an example of how to configure `kramdown-plantuml` to use the `spacelab`
|
111
|
+
theme in Jekyll's `_config.yml`:
|
112
|
+
|
113
|
+
```yaml
|
114
|
+
kramdown:
|
115
|
+
plantuml:
|
116
|
+
theme:
|
117
|
+
name: spacelab
|
118
|
+
```
|
77
119
|
|
78
|
-
|
79
|
-
|
80
|
-
|
120
|
+
If you have custom, local themes you'd like to use, you need to provide the
|
121
|
+
`directory` in which they are placed alongside the `name` of the theme you'd
|
122
|
+
like to use:
|
81
123
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
124
|
+
```yaml
|
125
|
+
kramdown:
|
126
|
+
plantuml:
|
127
|
+
theme:
|
128
|
+
name: my-custom-theme
|
129
|
+
directory: path/to/themes
|
130
|
+
```
|
86
131
|
|
87
132
|
## Contributing
|
88
133
|
|
@@ -91,30 +136,73 @@ intended to be a safe, welcoming space for collaboration, and contributors are
|
|
91
136
|
expected to adhere to the [code of conduct][coc] and sign the
|
92
137
|
[contributor's license agreement][cla].
|
93
138
|
|
139
|
+
### Development
|
140
|
+
|
141
|
+
In order to do development on `kramdown-plantuml`, [clone] or [fork]
|
142
|
+
this repository, perform the changes you want and submit a [pull request][pr].
|
143
|
+
|
144
|
+
The easiest way to develop and test `kramdown-plantuml` is to add it as a
|
145
|
+
[Jekyll][jekyll] plugin installed from a local path in your `Gemfile`:
|
146
|
+
|
147
|
+
```ruby
|
148
|
+
gem 'kramdown-plantuml', path: 'path/to/kramdown-plantuml'
|
149
|
+
```
|
150
|
+
|
151
|
+
Every time you perform a change to `kramdown-plantuml`, you can then, within
|
152
|
+
the directory of your Jekyll site, do a `bundle install` to bring the changes
|
153
|
+
in and then start Jekyll up again afterwards with `bundle exec jekyll serve`.
|
154
|
+
|
155
|
+
#### Tests
|
156
|
+
|
157
|
+
A few tests are exercised with GitHub Actions every time code is pushed to the
|
158
|
+
repository on GitHub. You can execute these tests locally by first installing
|
159
|
+
all dependencies as such:
|
160
|
+
|
161
|
+
```shell
|
162
|
+
bundle install # Installs required Ruby Gems
|
163
|
+
bundle exec rake maven:install # Installs the PlantUML .jar file
|
164
|
+
```
|
165
|
+
|
166
|
+
And then to execute the tests you run the following:
|
167
|
+
|
168
|
+
```shell
|
169
|
+
bundle exec rake
|
170
|
+
```
|
171
|
+
|
94
172
|
## License
|
95
173
|
|
96
174
|
The code within this repository is available as open source under the terms of
|
97
175
|
the [Apache 2.0 License][license] and the [contributor's license
|
98
176
|
agreement][cla].
|
99
177
|
|
100
|
-
[build-badge]: https://github.com/SwedbankPay/kramdown-plantuml/workflows/Ruby%20Gem/badge.svg?branch=master
|
101
178
|
[cla-badge]: https://cla-assistant.io/readme/badge/SwedbankPay/kramdown-plantuml
|
102
179
|
[cla]: https://cla-assistant.io/SwedbankPay/kramdown-plantuml
|
180
|
+
[clone]: https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/cloning-a-repository
|
103
181
|
[coc-badge]: https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg
|
104
182
|
[coc]: ./CODE_OF_CONDUCT.md
|
105
|
-
[
|
106
|
-
[
|
107
|
-
[diagram-svg]: ./spec/diagram.svg
|
183
|
+
[codecov-badge]: https://codecov.io/gh/SwedbankPay/kramdown-plantuml/branch/main/graph/badge.svg?token=U3QJLVG3HY
|
184
|
+
[codecov]: https://codecov.io/gh/SwedbankPay/kramdown-plantuml/
|
185
|
+
[diagram-svg]: ./spec/examples/diagram.svg
|
108
186
|
[fenced]: https://www.markdownguide.org/extended-syntax/#syntax-highlighting
|
187
|
+
[fork]: https://docs.github.com/en/free-pro-team@latest/github/getting-started-with-github/fork-a-repo
|
109
188
|
[gem-badge]: https://badge.fury.io/rb/kramdown-plantuml.svg
|
110
189
|
[gem-url]: https://rubygems.org/gems/kramdown-plantuml
|
111
190
|
[gems]: https://rubygems.org
|
112
191
|
[github]: https://github.com/SwedbankPay/kramdown-plantuml/
|
192
|
+
[graphviz]: https://graphviz.org/
|
113
193
|
[jekyll]: https://jekyllrb.com/
|
114
194
|
[kramdown]: https://kramdown.gettalong.org/
|
115
195
|
[license-badge]: https://img.shields.io/github/license/SwedbankPay/kramdown-plantuml
|
116
196
|
[license]: https://opensource.org/licenses/Apache-2.0
|
117
|
-
[no-java-
|
118
|
-
[no-
|
197
|
+
[no-java-badge]: https://github.com/SwedbankPay/kramdown-plantuml/actions/workflows/no-java.yml/badge.svg
|
198
|
+
[no-java-workflow]: https://github.com/SwedbankPay/kramdown-plantuml/actions/workflows/no-java.yml
|
199
|
+
[no-plantuml-badge]: https://github.com/SwedbankPay/kramdown-plantuml/actions/workflows/no-plantuml.yml/badge.svg
|
200
|
+
[no-plantuml-workflow]: https://github.com/SwedbankPay/kramdown-plantuml/actions/workflows/no-plantuml.yml
|
119
201
|
[plantuml]: https://plantuml.com/
|
202
|
+
[pr]: https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/about-pull-requests
|
203
|
+
[ruby-badge]: https://github.com/SwedbankPay/kramdown-plantuml/actions/workflows/ruby.yml/badge.svg
|
204
|
+
[ruby-workflow]: https://github.com/SwedbankPay/kramdown-plantuml/actions/workflows/ruby.yml
|
205
|
+
[shell-badge]: https://github.com/SwedbankPay/kramdown-plantuml/actions/workflows/shell.yml/badge.svg
|
206
|
+
[shell-workflow]: https://github.com/SwedbankPay/kramdown-plantuml/actions/workflows/shell.yml
|
120
207
|
[svg]: https://developer.mozilla.org/en-US/docs/Web/SVG
|
208
|
+
[theme]: https://plantuml.com/theme
|
data/Rakefile
CHANGED
@@ -6,7 +6,24 @@ require 'rspec/core/rake_task'
|
|
6
6
|
|
7
7
|
RSpec::Core::RakeTask.new(:spec) do |t|
|
8
8
|
t.pattern = Dir.glob('spec/**/*_spec.rb')
|
9
|
-
t.rspec_opts = '--format documentation --tag ~no_plantuml --tag ~no_java'
|
9
|
+
t.rspec_opts = '--format documentation --tag ~no_plantuml --tag ~no_java --tag ~debug'
|
10
|
+
end
|
11
|
+
|
12
|
+
namespace :maven do
|
13
|
+
task :install do
|
14
|
+
require 'fileutils'
|
15
|
+
|
16
|
+
system 'mvn install'
|
17
|
+
bin_dir = File.join __dir__, 'bin'
|
18
|
+
target_file = File.join bin_dir, 'plantuml.jar'
|
19
|
+
repo_dir = File.expand_path '~/.m2/repository'
|
20
|
+
jar_glob = File.join repo_dir, '/**/plantuml*.jar'
|
21
|
+
first_jar = Dir[jar_glob].first
|
22
|
+
jar_file = File.expand_path first_jar
|
23
|
+
|
24
|
+
FileUtils.mkdir_p bin_dir
|
25
|
+
FileUtils.move(jar_file, target_file)
|
26
|
+
end
|
10
27
|
end
|
11
28
|
|
12
29
|
namespace :codecov do
|