asciidoctor-external-callout 1.1.4 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -4
- data/CHANGELOG.md +5 -1
- data/README.md +8 -0
- data/lib/asciidoctor-external-callout.rb +21 -7
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9071bcc8bd5b3d881297e12f8a9f27cb9220dd4633584f35aa537a33b2a1ffcc
|
4
|
+
data.tar.gz: 6e1e73370eb5ee7df1c5128f0178975ba30852c69b450fb0cb02e5ca105db3a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a62d43ad6fee410aa7d71862f71bb28ad67e12a44d102fce91ea5130c19b9ac14b5fbe905278eb9aaf6a2d39e347f99f8caadf68ae3c737119086ab17902455a
|
7
|
+
data.tar.gz: 2a0671db148dd4c7e855fbd5e00a87c885167a31716fa387810e1cacc0368c9b4d0af3131b5b26fbf23834c40c74a4dd5fe579f13638524e37755f598a4dc668
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,10 +2,14 @@
|
|
2
2
|
|
3
3
|
Record of bug fixes, enhancements, and changes.
|
4
4
|
|
5
|
+
## [1.2.0] – 2022-07-30
|
6
|
+
|
7
|
+
### Added
|
8
|
+
- If you add the role `[calloutlist]` to an ordered list then it will be styled to look like a callout list. This allows you to add callouts to annotated images etc.
|
9
|
+
|
5
10
|
## [1.1.3] – 2022-07-07-16
|
6
11
|
|
7
12
|
### Fixed
|
8
|
-
|
9
13
|
- The global and case-insensitive flags (ig) are now parsing correctly: using ii or gg will cause prevent the callout block from being processed. Thanks to Hakim Cassimally for finding the bug.
|
10
14
|
- Escaped slash characters were not being processed in the search. Thanks to Hakim Cassimally for finding the bug.
|
11
15
|
|
data/README.md
CHANGED
@@ -70,6 +70,14 @@ Using the text search method means that the location of the callout will move wi
|
|
70
70
|
**@/_text_/gi**
|
71
71
|
: And of course, you can combine the two, though I'm not sure why you'd want to.
|
72
72
|
|
73
|
+
## Standalone callout lists
|
74
|
+
You can create a standalone callout list by adding the `calloutlist` role to an ordered list. This simply styles the list to make it look like a list of callouts so you can use it as a reference to annoted images etc.
|
75
|
+
```asciidoc
|
76
|
+
[calloutlist]
|
77
|
+
. This list can be used to add references to annotated images
|
78
|
+
. The list will look like a standard callout list.
|
79
|
+
```
|
80
|
+
|
73
81
|
## Installation
|
74
82
|
|
75
83
|
Add this line to your application's Gemfile:
|
@@ -18,6 +18,8 @@ Asciidoctor::Extensions::register do
|
|
18
18
|
CALLOUT_SOURCE_BLOCK_ROLE ||= 'external-callout-block'
|
19
19
|
CALLOUT_ORDERED_LIST_ROLE ||= 'external-callout-list'
|
20
20
|
|
21
|
+
STANDALONE_CALLOUT_LIST_STYLE ||= 'calloutlist'
|
22
|
+
|
21
23
|
LOCATION_TOKEN_RX ||= /@(\d+)|(@\/(?:\\\/|[^\/])+?\/[ig]{0,2})/
|
22
24
|
LOCATION_TOKEN_ARRAY_RX ||= /^(@\d+|@\/(?:\\\/|[^\/]|)+?\/[ig]{0,2})((\s+@\d+)|(\s+@\/(?:\\\/|[^\/]|)+?\/[ig]{0,2}))*$/
|
23
25
|
|
@@ -33,18 +35,30 @@ Asciidoctor::Extensions::register do
|
|
33
35
|
# The makes sure it's the right kind of list.
|
34
36
|
document.find_by context: :olist do |list|
|
35
37
|
|
36
|
-
if
|
38
|
+
# if there is as calloutlist style attached to the block
|
39
|
+
# then simply style the block as a colist. This will allow folk
|
40
|
+
# to create callout blocks that can be attached to annotated images etc.
|
37
41
|
|
38
|
-
|
42
|
+
if list.style.include? STANDALONE_CALLOUT_LIST_STYLE
|
39
43
|
|
40
|
-
|
44
|
+
list.context = :colist
|
41
45
|
|
42
|
-
|
46
|
+
else
|
43
47
|
|
44
|
-
|
48
|
+
if external_callout_list? list
|
49
|
+
|
50
|
+
owner_block = owning_block list
|
45
51
|
|
46
|
-
|
47
|
-
|
52
|
+
owner_block.subs.replace(owner_block.subs + [:callouts]).uniq
|
53
|
+
|
54
|
+
process_callouts(list, owner_block)
|
55
|
+
|
56
|
+
list.context = :colist
|
57
|
+
|
58
|
+
owner_block.add_role(CALLOUT_SOURCE_BLOCK_ROLE) unless owner_block.has_role?(CALLOUT_SOURCE_BLOCK_ROLE)
|
59
|
+
list.add_role(CALLOUT_ORDERED_LIST_ROLE) unless list.has_role?(CALLOUT_ORDERED_LIST_ROLE)
|
60
|
+
|
61
|
+
end
|
48
62
|
|
49
63
|
end
|
50
64
|
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-external-callout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ray Offiah
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|