Skip to content

Commit dd504cf

Browse files
authored
Merge pull request #40 from asciidoctor/barby
Add barby and rqrcode gems for generating qrcodes
2 parents da236ed + 045b0d8 commit dd504cf

File tree

5 files changed

+122
-3
lines changed

5 files changed

+122
-3
lines changed

asciidoctorj-diagram/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ dependencies {
22

33
testImplementation "org.jsoup:jsoup:$jsoupVersion"
44
testImplementation "org.asciidoctor:asciidoctorj:$asciidoctorJVersion"
5+
testImplementation "org.jruby:jruby-complete:$jrubyVersion"
56

67
implementation project(':asciidoctorj-diagram-plantuml')
78
implementation project(':asciidoctorj-diagram-ditaamini')
9+
gems("rubygems:barby:$barbyGemVersion")
10+
gems("rubygems:rqrcode:$rqrcodeGemVersion")
811
gems("rubygems:asciidoctor-diagram:$asciidoctorDiagramGemVersion") {
912
// Exclude gems provided by AsciidoctorJ core
1013
exclude module: 'asciidoctor'
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package org.asciidoctor;
2+
3+
import org.junit.jupiter.api.Test;
4+
5+
import java.io.File;
6+
7+
import static org.assertj.core.api.Assertions.assertThat;
8+
9+
public class WhenDocumentContainsQrcode {
10+
11+
private final Asciidoctor asciidoctor = Asciidoctor.Factory.create();
12+
13+
@Test
14+
public void png_should_be_rendered_for_qrcode() {
15+
File sourceDir = new File("build/resources/test");
16+
File inputFile = new File(sourceDir, "sampleqrcode.adoc");
17+
18+
File outputDiagram = new File(sourceDir, "testqrcode.png");
19+
File outputDiagramCache = new File(sourceDir, ".asciidoctor/diagram/testqrcode.png.cache");
20+
21+
asciidoctor.requireLibrary("asciidoctor-diagram");
22+
asciidoctor.convertFile(inputFile,
23+
Options.builder()
24+
.backend("html5")
25+
.toFile(new File(sourceDir, "sampleqrcode.html"))
26+
.build());
27+
28+
assertThat(outputDiagram).exists();
29+
assertThat(outputDiagramCache).exists();
30+
}
31+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
= Document Title
2+
3+
Scan this with your phone:
4+
5+
[qrcode,testqrcode]
6+
----
7+
https://my-link.tld/something
8+
----

build.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ ext {
3131
statusIsRelease = (status == 'release')
3232

3333
// jar versions
34-
jrubyVersion = '9.2.4.0'
34+
jrubyVersion = '9.4.2.0'
3535
junitVersion = '5.8.2'
3636
assertjVersion = '3.22.0'
3737
jsoupVersion = '1.15.3'
3838

3939
// gem versions
40-
asciidoctorJVersion = project.hasProperty('asciidoctorJVersion') ? project.asciidoctorJVersion : '2.5.3'
40+
asciidoctorJVersion = project.hasProperty('asciidoctorJVersion') ? project.asciidoctorJVersion : '2.5.10'
4141
asciidoctorDiagramGemVersion = project.hasProperty('asciidoctorDiagramGemVersion') ? project.asciidoctorDiagramGemVersion : project(':asciidoctorj-diagram').version.replace('-', '.')
42+
barbyGemVersion = "0.6.8"
43+
rqrcodeGemVersion = "2.2.0"
4244
}
4345

4446
allprojects {
@@ -142,7 +144,7 @@ configure(subprojects.findAll { it.name != 'itest'}) {
142144
}
143145

144146
jruby {
145-
jrubyVersion = jrubyVersion
147+
jrubyVersion = rootProject.jrubyVersion
146148
}
147149

148150
ext {

licenses/THIRD_PARTY_LICENSES.adoc

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
= Third Party Licenses
2+
3+
== asciidoctor-diagram
4+
5+
Copyright (c) 2014 Pepijn Van Eeckhoudt
6+
7+
MIT License
8+
9+
Permission is hereby granted, free of charge, to any person obtaining
10+
a copy of this software and associated documentation files (the
11+
"Software"), to deal in the Software without restriction, including
12+
without limitation the rights to use, copy, modify, merge, publish,
13+
distribute, sublicense, and/or sell copies of the Software, and to
14+
permit persons to whom the Software is furnished to do so, subject to
15+
the following conditions:
16+
17+
The above copyright notice and this permission notice shall be
18+
included in all copies or substantial portions of the Software.
19+
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27+
28+
== barby
29+
30+
Copyright (c) 2008 Tore Darell
31+
32+
Permission is hereby granted, free of charge, to any person
33+
obtaining a copy of this software and associated documentation
34+
files (the "Software"), to deal in the Software without
35+
restriction, including without limitation the rights to use,
36+
copy, modify, merge, publish, distribute, sublicense, and/or sell
37+
copies of the Software, and to permit persons to whom the
38+
Software is furnished to do so, subject to the following
39+
conditions:
40+
41+
The above copyright notice and this permission notice shall be
42+
included in all copies or substantial portions of the Software.
43+
44+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
45+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
46+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
47+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
48+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
49+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
50+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
51+
OTHER DEALINGS IN THE SOFTWARE.
52+
53+
== rqrcode
54+
55+
The MIT License (MIT)
56+
57+
Copyright (c) 2008 Duncan Robertson
58+
59+
Permission is hereby granted, free of charge, to any person obtaining a copy
60+
of this software and associated documentation files (the "Software"), to deal
61+
in the Software without restriction, including without limitation the rights
62+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
63+
copies of the Software, and to permit persons to whom the Software is
64+
furnished to do so, subject to the following conditions:
65+
66+
The above copyright notice and this permission notice shall be included in
67+
all copies or substantial portions of the Software.
68+
69+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
70+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
71+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
72+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
73+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
74+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
75+
THE SOFTWARE.

0 commit comments

Comments
 (0)