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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 488e793ad6c95b20619319fdec43866b7a96369321767eb415c441b2d8946c0c
|
4
|
+
data.tar.gz: 2f9b7957b2b7d09ebe2758d1fc3f3600c7464f2ccee53d5ea11f04bf25b0df33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e4547033622f876ea2c63eb4af2f73433e57fa4cbe8bdd818bbcb5261f4bef829f50da55b9f5485023e5c040d7c260844f27fcf2a67f17858839aa4e9f0dab3
|
7
|
+
data.tar.gz: cd38086b669bf27b64ccae97f45005a23a508fdfd94647e40c2f8e9960a89edc0abd2781c74fb42493c1b1df7bd5c0aaee6c19acd63cf20394d594c077cc072d
|
data/.github/codecov.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
version: 2
|
2
|
+
updates:
|
3
|
+
- package-ecosystem: bundler
|
4
|
+
directory: "/"
|
5
|
+
schedule:
|
6
|
+
interval: daily
|
7
|
+
time: "03:00"
|
8
|
+
timezone: Europe/Oslo
|
9
|
+
open-pull-requests-limit: 99
|
10
|
+
- package-ecosystem: maven
|
11
|
+
directory: "/"
|
12
|
+
schedule:
|
13
|
+
interval: daily
|
14
|
+
time: "03:00"
|
15
|
+
timezone: Europe/Oslo
|
16
|
+
open-pull-requests-limit: 99
|
17
|
+
- package-ecosystem: github-actions
|
18
|
+
directory: "/"
|
19
|
+
schedule:
|
20
|
+
interval: daily
|
21
|
+
time: "03:00"
|
22
|
+
timezone: Europe/Oslo
|
23
|
+
open-pull-requests-limit: 99
|
data/.github/mergify.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
pull_request_rules:
|
2
|
+
- name: Automatic approve on dependabot PR
|
3
|
+
conditions:
|
4
|
+
- author~=^dependabot(|-preview)\[bot\]$
|
5
|
+
actions:
|
6
|
+
review:
|
7
|
+
type: APPROVE
|
8
|
+
|
9
|
+
- name: Automatic merge on approval
|
10
|
+
conditions:
|
11
|
+
- author~=^dependabot(|-preview)\[bot\]$
|
12
|
+
actions:
|
13
|
+
merge:
|
14
|
+
method: merge
|
15
|
+
strict: smart
|
16
|
+
|
17
|
+
- name: Thank contributor
|
18
|
+
conditions:
|
19
|
+
- merged
|
20
|
+
actions:
|
21
|
+
comment:
|
22
|
+
message: "Thank you @{{author}} for your contribution!"
|
@@ -0,0 +1,176 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -o errexit # Abort if any command fails
|
3
|
+
me=$(basename "$0")
|
4
|
+
|
5
|
+
help_message="\
|
6
|
+
Usage: echo $me --user <username>
|
7
|
+
|
8
|
+
Checks out the pull request where an '/amend' comment is made and amends its
|
9
|
+
latest commit with the credentials of the user who wrote the '/amend' comment.
|
10
|
+
|
11
|
+
Arguments:
|
12
|
+
-u, --user The user name to use when authenticating against the remote
|
13
|
+
Git repository.
|
14
|
+
-h, --help Displays this help screen.
|
15
|
+
-v, --verbose Increase verbosity. Useful for debugging.
|
16
|
+
|
17
|
+
Environment Variables:
|
18
|
+
GITHUB_CONTEXT: An environment variable containing a JSON string of the GitHub
|
19
|
+
context object. Typically generated with \${{ toJson(github) }}.
|
20
|
+
GITHUB_TOKEN: The personal access token to use to authenticate against the
|
21
|
+
remote Git repository."
|
22
|
+
|
23
|
+
parse_args() {
|
24
|
+
while : ; do
|
25
|
+
if [[ $1 = "-h" || $1 = "--help" ]]; then
|
26
|
+
echo "$help_message"
|
27
|
+
return 0
|
28
|
+
elif [[ $1 = "-v" || $1 = "--verbose" ]]; then
|
29
|
+
verbose=true
|
30
|
+
shift
|
31
|
+
elif [[ ( $1 = "-u" || $1 = "--user" ) && -n $2 ]]; then
|
32
|
+
auth_user=$2
|
33
|
+
shift 2
|
34
|
+
else
|
35
|
+
break
|
36
|
+
fi
|
37
|
+
done
|
38
|
+
}
|
39
|
+
|
40
|
+
parse_github_context() {
|
41
|
+
github_context_json="$GITHUB_CONTEXT"
|
42
|
+
|
43
|
+
if [[ -z "$github_context_json" ]]; then
|
44
|
+
echo "Missing or empty GITHUB_CONTEXT environment variable." >&2
|
45
|
+
echo "$help_message"
|
46
|
+
exit 1
|
47
|
+
fi
|
48
|
+
|
49
|
+
if [[ -z "$GITHUB_TOKEN" ]]; then
|
50
|
+
echo "Missing or empty GITHUB_TOKEN environment variable." >&2
|
51
|
+
echo "$help_message"
|
52
|
+
exit 1
|
53
|
+
fi
|
54
|
+
|
55
|
+
if [[ -z "$auth_user" ]]; then
|
56
|
+
echo "Missing or empty 'auth_user' argument." >&2
|
57
|
+
echo "$help_message"
|
58
|
+
exit 1
|
59
|
+
fi
|
60
|
+
|
61
|
+
sha=$(echo "$github_context_json" | jq --raw-output .sha)
|
62
|
+
pr_url=$(echo "$github_context_json" | jq --raw-output .event.issue.pull_request.html_url)
|
63
|
+
sender_login=$(echo "$github_context_json" | jq --raw-output .event.sender.login)
|
64
|
+
sender_url=$(echo "$github_context_json" | jq --raw-output .event.sender.url)
|
65
|
+
repo_url=$(echo "$github_context_json" | jq --raw-output .event.repository.html_url)
|
66
|
+
repo_clone_url=$(echo "$github_context_json" | jq --raw-output .event.repository.clone_url)
|
67
|
+
collaborators_url=$(echo "$github_context_json" | jq --raw-output .event.repository.collaborators_url)
|
68
|
+
|
69
|
+
if [[ -z "$sha" ]]; then
|
70
|
+
echo "No 'sha' found in the GitHub context." >&2
|
71
|
+
echo "$help_message"
|
72
|
+
exit 1
|
73
|
+
fi
|
74
|
+
|
75
|
+
if [[ -z "$pr_url" ]]; then
|
76
|
+
echo "No 'event.issue.pull_request.html_url' found in the GitHub context." >&2
|
77
|
+
echo "$help_message"
|
78
|
+
exit 1
|
79
|
+
fi
|
80
|
+
|
81
|
+
if [[ -z "$sender_login" ]]; then
|
82
|
+
echo "No 'event.sender.login' found in the GitHub context." >&2
|
83
|
+
echo "$help_message"
|
84
|
+
exit 1
|
85
|
+
fi
|
86
|
+
|
87
|
+
if [[ -z "$sender_url" ]]; then
|
88
|
+
echo "No 'event.sender.url' found in the GitHub context." >&2
|
89
|
+
echo "$help_message"
|
90
|
+
exit 1
|
91
|
+
fi
|
92
|
+
|
93
|
+
if [[ -z "$repo_url" ]]; then
|
94
|
+
echo "No 'event.repository.html_url' found in the GitHub context." >&2
|
95
|
+
echo "$help_message"
|
96
|
+
exit 1
|
97
|
+
fi
|
98
|
+
|
99
|
+
if [[ -z "$repo_clone_url" ]]; then
|
100
|
+
echo "No 'event.repository.clone_url' found in the GitHub context." >&2
|
101
|
+
echo "$help_message"
|
102
|
+
exit 1
|
103
|
+
fi
|
104
|
+
|
105
|
+
if [[ -z "$collaborators_url" ]]; then
|
106
|
+
echo "No 'event.repository.collaborators_url' found in the GitHub context." >&2
|
107
|
+
echo "$help_message"
|
108
|
+
exit 1
|
109
|
+
fi
|
110
|
+
|
111
|
+
user_json=$(gh api -X GET "$sender_url")
|
112
|
+
|
113
|
+
if [[ -z "$user_json" ]]; then
|
114
|
+
echo "The request for '$sender_url' failed." >&2
|
115
|
+
echo "$help_message"
|
116
|
+
exit 1
|
117
|
+
fi
|
118
|
+
|
119
|
+
name=$(echo "$user_json" | jq --raw-output .name)
|
120
|
+
email=$(echo "$user_json" | jq --raw-output .email)
|
121
|
+
|
122
|
+
if [[ -z "$name" ]]; then
|
123
|
+
echo "No 'name' found in '$sender_url'." >&2
|
124
|
+
echo "$help_message"
|
125
|
+
exit 1
|
126
|
+
fi
|
127
|
+
|
128
|
+
if [[ -z "$email" ]]; then
|
129
|
+
echo "No 'email' found in '$sender_url'." >&2
|
130
|
+
echo "$help_message"
|
131
|
+
exit 1
|
132
|
+
fi
|
133
|
+
|
134
|
+
# Replace the template part of the URL with the sender_login (collaborator).
|
135
|
+
# https://api.github.com/repos/asbjornu/test/collaborators{/collaborator}
|
136
|
+
collaborator_url="${collaborators_url/\{\/collaborator\}//$sender_login}"
|
137
|
+
|
138
|
+
# Add sender_login and password to the repository clone URL
|
139
|
+
authenticated_repo_url="${repo_clone_url/github\.com/$auth_user:$GITHUB_TOKEN@github.com}"
|
140
|
+
}
|
141
|
+
|
142
|
+
# echo expanded commands as they are executed (for debugging)
|
143
|
+
enable_expanded_output() {
|
144
|
+
if [ $verbose ]; then
|
145
|
+
set -o xtrace
|
146
|
+
set +o verbose
|
147
|
+
fi
|
148
|
+
}
|
149
|
+
|
150
|
+
amend() {
|
151
|
+
gh pr checkout "$pr_url"
|
152
|
+
gh pr comment --body "The commit $sha is being amended."
|
153
|
+
git config --global user.name "$name"
|
154
|
+
git config --global user.email "$email"
|
155
|
+
git remote set-url origin "$authenticated_repo_url"
|
156
|
+
git commit --amend --no-edit
|
157
|
+
git push --force
|
158
|
+
}
|
159
|
+
|
160
|
+
main() {
|
161
|
+
parse_args "$@"
|
162
|
+
enable_expanded_output
|
163
|
+
parse_github_context
|
164
|
+
|
165
|
+
# If the request for </repos/{owner}/{repo}/collaborators/{sender_login}>
|
166
|
+
# fails (404 not found), `gh` should return 1 and thus fail the entire
|
167
|
+
# script. For more information, see:
|
168
|
+
# https://docs.github.com/en/rest/reference/repos#check-if-a-user-is-a-repository-collaborator
|
169
|
+
if gh api -X GET "$collaborator_url" > /dev/null; then
|
170
|
+
amend
|
171
|
+
else
|
172
|
+
echo "'$sender_login' does not have access to the repository <$repo_url>."
|
173
|
+
fi
|
174
|
+
}
|
175
|
+
|
176
|
+
main "$@"
|
@@ -26,14 +26,32 @@ parse_args() {
|
|
26
26
|
verbose=true
|
27
27
|
shift
|
28
28
|
elif [[ $1 = "-g" || $1 = "--gem" ]]; then
|
29
|
-
gem=$2
|
30
|
-
|
29
|
+
gem=${2// }
|
30
|
+
|
31
|
+
if [[ "$gem" = "--"* ]]; then
|
32
|
+
gem=""
|
33
|
+
shift 1
|
34
|
+
else
|
35
|
+
shift 2
|
36
|
+
fi
|
31
37
|
elif [[ $1 = "-t" || $1 = "--token" ]]; then
|
32
|
-
token=$2
|
33
|
-
|
38
|
+
token=${2// }
|
39
|
+
|
40
|
+
if [[ "$token" = "--"* ]]; then
|
41
|
+
token=""
|
42
|
+
shift 1
|
43
|
+
else
|
44
|
+
shift 2
|
45
|
+
fi
|
34
46
|
elif [[ $1 = "-o" || $1 = "--owner" ]]; then
|
35
|
-
owner=$2
|
36
|
-
|
47
|
+
owner=${2// }
|
48
|
+
|
49
|
+
if [[ "$owner" = "--"* ]]; then
|
50
|
+
owner=""
|
51
|
+
shift 1
|
52
|
+
else
|
53
|
+
shift 2
|
54
|
+
fi
|
37
55
|
else
|
38
56
|
break
|
39
57
|
fi
|
data/.github/scripts/test-gem.sh
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
|
+
# shellcheck disable=3000-SC4000
|
3
|
+
|
2
4
|
set -o errexit # Abort if any command fails
|
3
5
|
me=$(basename "$0")
|
4
6
|
|
5
7
|
help_message="\
|
6
8
|
Usage:
|
7
|
-
$me --workdir <workdir> [--gemdir <gemdir> | --version <version> --token <token>] [--verbose]
|
8
|
-
$me --help
|
9
|
+
${me} --workdir <workdir> [--gemdir <gemdir> | --version <version> --token <token>] [--verbose]
|
10
|
+
${me} --help
|
9
11
|
Arguments:
|
10
12
|
-w, --workdir <workdir> The path to the working directory.
|
11
13
|
-g, --gemdir <gemdir> The path to directory of the Gem file to test.
|
@@ -18,113 +20,141 @@ Arguments:
|
|
18
20
|
parse_args() {
|
19
21
|
while : ; do
|
20
22
|
if [[ $1 = "-h" || $1 = "--help" ]]; then
|
21
|
-
echo "$help_message"
|
23
|
+
echo "${help_message}"
|
22
24
|
return 0
|
23
25
|
elif [[ $1 = "-v" || $1 = "--verbose" ]]; then
|
24
26
|
verbose=true
|
25
27
|
shift
|
26
28
|
elif [[ $1 = "-g" || $1 = "--gemdir" ]]; then
|
27
|
-
gemdir=$2
|
28
|
-
|
29
|
+
gemdir=${2// }
|
30
|
+
|
31
|
+
if [[ "${gemdir}" = "--"* ]]; then
|
32
|
+
gemdir=""
|
33
|
+
shift 1
|
34
|
+
else
|
35
|
+
shift 2
|
36
|
+
fi
|
29
37
|
elif [[ $1 = "-v" || $1 = "--version" ]]; then
|
30
|
-
version=$2
|
31
|
-
|
38
|
+
version=${2// }
|
39
|
+
|
40
|
+
if [[ "${version}" = "--"* ]]; then
|
41
|
+
version=""
|
42
|
+
shift 1
|
43
|
+
else
|
44
|
+
shift 2
|
45
|
+
fi
|
32
46
|
elif [[ $1 = "-t" || $1 = "--token" ]]; then
|
33
|
-
token=$2
|
34
|
-
|
47
|
+
token=${2// }
|
48
|
+
|
49
|
+
if [[ "${token}" = "--"* ]]; then
|
50
|
+
token=""
|
51
|
+
shift 1
|
52
|
+
else
|
53
|
+
shift 2
|
54
|
+
fi
|
35
55
|
elif [[ $1 = "-w" || $1 = "--workdir" ]]; then
|
36
|
-
workdir=$2
|
37
|
-
|
56
|
+
workdir=${2// }
|
57
|
+
|
58
|
+
if [[ "${workdir}" = "--"* ]]; then
|
59
|
+
workdir=""
|
60
|
+
shift 1
|
61
|
+
else
|
62
|
+
shift 2
|
63
|
+
fi
|
38
64
|
else
|
39
65
|
break
|
40
66
|
fi
|
41
67
|
done
|
42
68
|
|
43
|
-
if [[ -z "$workdir" ]]; then
|
69
|
+
if [[ -z "${workdir}" ]]; then
|
44
70
|
echo "Missing required argument: --workdir <workdir>."
|
45
|
-
echo "$help_message"
|
71
|
+
echo "${help_message}"
|
46
72
|
return 1
|
47
73
|
fi
|
48
74
|
|
49
|
-
if [[ (-z "$gemdir" && -z "$token") || (-n "$gemdir" && -n "$token") ]]; then
|
75
|
+
if [[ (-z "${gemdir}" && -z "${token}") || (-n "${gemdir}" && -n "${token}") ]]; then
|
50
76
|
echo "Missing or invalid required arguments: --gemdir <gem-path> or --token <token>."
|
51
77
|
echo "Either [--gemdir] or [--token] needs to be provided, but not both."
|
52
|
-
echo "$help_message"
|
78
|
+
echo "${help_message}"
|
53
79
|
return 1
|
54
80
|
fi
|
55
81
|
|
56
|
-
if [[ (-n "$version" && -z "$token") || (-z "$version" && -n "$token") ]]; then
|
82
|
+
if [[ (-n "${version}" && -z "${token}") || (-z "${version}" && -n "${token}") ]]; then
|
57
83
|
echo "Missing or invalid required arguments: --version <gem-path> and --token <token>."
|
58
84
|
echo "When either argument is present, both must be."
|
59
|
-
echo "$help_message"
|
85
|
+
echo "${help_message}"
|
60
86
|
return 1
|
61
87
|
fi
|
62
88
|
}
|
63
89
|
|
64
90
|
# Echo expanded commands as they are executed (for debugging)
|
65
91
|
enable_expanded_output() {
|
66
|
-
if [ $verbose ]; then
|
92
|
+
if [ "${verbose}" = true ]; then
|
67
93
|
set -o xtrace
|
68
94
|
set +o verbose
|
95
|
+
export VERBOSE=true
|
69
96
|
fi
|
70
97
|
}
|
71
98
|
|
72
99
|
test_gem() {
|
73
|
-
|
100
|
+
local jekyll_build_args=()
|
101
|
+
|
102
|
+
cd "${workdir}"
|
74
103
|
|
75
104
|
gem install bundler
|
76
105
|
|
77
|
-
if [[ -n "$token" ]]; then
|
106
|
+
if [[ -n "${token}" ]]; then
|
78
107
|
# A non-empty $token means we should install the Gem from GPR
|
79
108
|
repository="https://rubygems.pkg.github.com/swedbankpay"
|
80
|
-
bundle config "$repository" "SwedbankPay:$token"
|
81
|
-
printf "source '%s' do\n\tgem 'kramdown-plantuml', '%s'\nend" "$repository" "$version" >> Gemfile
|
109
|
+
bundle config "${repository}" "SwedbankPay:${token}"
|
110
|
+
printf "source '%s' do\n\tgem 'kramdown-plantuml', '%s'\nend" "${repository}" "${version}" >> Gemfile
|
82
111
|
else
|
83
|
-
echo "gem 'kramdown-plantuml', path: '$gemdir'" >> Gemfile
|
112
|
+
echo "gem 'kramdown-plantuml', path: '${gemdir}'" >> Gemfile
|
84
113
|
fi
|
85
114
|
|
86
|
-
if [[ $verbose ]]; then
|
115
|
+
if [[ "${verbose}" = true ]]; then
|
87
116
|
cat Gemfile
|
117
|
+
jekyll_build_args+=(--verbose)
|
88
118
|
fi
|
89
119
|
|
90
120
|
bundle install
|
91
|
-
bundle exec jekyll build
|
121
|
+
bundle exec jekyll build "${jekyll_build_args[@]}"
|
92
122
|
|
93
|
-
file="$workdir/_site/index.html"
|
123
|
+
file="${workdir}/_site/index.html"
|
94
124
|
|
95
|
-
file_contains "$file" "class=\"plantuml\""
|
96
|
-
file_contains "$file" "<svg"
|
97
|
-
file_contains "$file" "<ellipse"
|
98
|
-
file_contains "$file" "<polygon"
|
99
|
-
file_contains "$file" "<path"
|
125
|
+
file_contains "${file}" "class=\"plantuml theme-spacelab\""
|
126
|
+
file_contains "${file}" "<svg"
|
127
|
+
file_contains "${file}" "<ellipse"
|
128
|
+
file_contains "${file}" "<polygon"
|
129
|
+
file_contains "${file}" "<path"
|
100
130
|
}
|
101
131
|
|
102
132
|
file_contains() {
|
103
133
|
file=$1
|
104
134
|
contents=$2
|
105
135
|
|
106
|
-
if [[ -z "$file" ]]; then
|
136
|
+
if [[ -z "${file}" ]]; then
|
107
137
|
echo "file_contains missing required argument <file>."
|
108
138
|
return 1
|
109
139
|
fi
|
110
140
|
|
111
|
-
if [[ -z "$contents" ]]; then
|
141
|
+
if [[ -z "${contents}" ]]; then
|
112
142
|
echo "file_contains missing required argument <contents>."
|
113
143
|
return 1
|
114
144
|
fi
|
115
145
|
|
116
|
-
if [[ ! -f "$file" ]]; then
|
117
|
-
echo "file_contains <file> not found: '$file'."
|
146
|
+
if [[ ! -f "${file}" ]]; then
|
147
|
+
echo "file_contains <file> not found: '${file}'."
|
118
148
|
return 1
|
119
149
|
fi
|
120
150
|
|
121
|
-
if grep --quiet --fixed-strings "$contents" "$file"; then
|
122
|
-
echo "Success! '$contents' found in '$file'."
|
151
|
+
if grep --quiet --fixed-strings "${contents}" "${file}"; then
|
152
|
+
echo "Success! '${contents}' found in '${file}'."
|
123
153
|
else
|
124
|
-
echo "Failed! '$contents' not found in '$file'."
|
154
|
+
echo "Failed! '${contents}' not found in '${file}'."
|
125
155
|
|
126
|
-
if [
|
127
|
-
cat "$file"
|
156
|
+
if [ "${verbose}" = true ]; then
|
157
|
+
cat "${file}"
|
128
158
|
fi
|
129
159
|
|
130
160
|
return 1
|