asciidoctor-lists 1.0.0 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +18 -16
- data/lib/asciidoctor-lists/extensions.rb +29 -6
- data/lib/asciidoctor-lists/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91209fcab613ba19c6917659a8b528c0390f35f421e8dca23a39863710ee7fbd
|
4
|
+
data.tar.gz: 55c77e4a5a78fe415605ea94ce08c29531f7ca9550797fba8c96ddc7b1cd3d35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c66ea906439d1a2720fa32187d55e4f4e701c4e78e989b4f602787fbb1c68f71447960286bc90f9519018b7e39c267f3f50a37bee8b012e9edd6c3babf52d37
|
7
|
+
data.tar.gz: 7efe24289f4e643c5f6d424463b0ceeb4222d1e41cdd4508ad53b04cc72428feeefc77629ebd5ea93f851da892b7cec57c51348be8b1bd08918ee7bf5c1067d3
|
data/README.adoc
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
image:https://github.com/Alwinator/asciidoctor-lists/actions/workflows/test.yml/badge.svg[Test, link=https://github.com/Alwinator/asciidoctor-lists/actions/workflows/test.yml]
|
4
4
|
image:https://github.com/Alwinator/asciidoctor-lists/actions/workflows/publish_gem.yml/badge.svg[Build, link=https://github.com/Alwinator/asciidoctor-lists/actions/workflows/publish_gem.yml]
|
5
5
|
image:https://img.shields.io/gem/v/asciidoctor-lists.svg[Latest Release, link=https://rubygems.org/gems/asciidoctor-lists]
|
6
|
+
image:https://img.shields.io/github/stars/Alwinator/asciidoctor-lists[Stars, link=https://github.com/Alwinator/asciidoctor-lists]
|
7
|
+
|
6
8
|
|
7
9
|
An https://asciidoctor.org/[asciidoctor] extension that adds a list of figures, a list of tables, or a list of anything you want!
|
8
10
|
|
@@ -20,32 +22,32 @@ gem install asciidoctor-lists
|
|
20
22
|
----
|
21
23
|
...
|
22
24
|
|
23
|
-
.And this is the second one
|
24
|
-
|===
|
25
|
-
|Column 1, Header Row |Column 2, Header Row
|
26
|
-
|
27
|
-
|Cell in column 1, row 1
|
28
|
-
|Cell in column 2, row 1
|
29
|
-
|
30
|
-
|Cell in column 1, row 2
|
31
|
-
|Cell in column 2, row 2
|
32
|
-
|===
|
33
|
-
|
34
|
-
|
35
|
-
.Another wikipedia SVG image
|
36
|
-
image::https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/SVG_Logo.svg/400px-SVG_Logo.svg.png[SVG,100,100]
|
37
|
-
|
38
25
|
=== List of figures
|
39
26
|
element_list::[element=image]
|
40
27
|
|
41
28
|
=== List of tables
|
42
29
|
element_list::[element=table]
|
43
30
|
|
31
|
+
=== List of code snippets
|
32
|
+
element_list::[element=listing]
|
44
33
|
----
|
45
34
|
|
35
|
+
See link:samples/list-sample.adoc[]
|
36
|
+
|
46
37
|
=== Rendered
|
47
38
|
image::img/sample.png[Sample,width=400]
|
48
39
|
|
40
|
+
== Parameters
|
41
|
+
=== element
|
42
|
+
Specifies the element which should be listed
|
43
|
+
|
44
|
+
Sample: link:samples/list-sample.adoc[]
|
45
|
+
|
46
|
+
=== enhanced_rendering (experimental)
|
47
|
+
Allows to render links in the caption
|
48
|
+
|
49
|
+
Sample: link:samples/enhanced-rendering.adoc[]
|
50
|
+
|
49
51
|
== Docker
|
50
52
|
[source,bash]
|
51
53
|
----
|
@@ -69,4 +71,4 @@ asciidoctor -r ./lib/asciidoctor-lists.rb samples/list-sample.adoc
|
|
69
71
|
----
|
70
72
|
gem build asciidoctor-lists.gemspec
|
71
73
|
gem install asciidoctor-lists-x.x.x.gem
|
72
|
-
----
|
74
|
+
----
|
@@ -7,15 +7,19 @@ module AsciidoctorLists
|
|
7
7
|
|
8
8
|
MacroPlaceholder = Hash.new
|
9
9
|
|
10
|
-
# Replaces
|
10
|
+
# Replaces element_list::[element=...] with ListOfFiguresMacroPlaceholder
|
11
11
|
class ListOfFiguresMacro < ::Asciidoctor::Extensions::BlockMacroProcessor
|
12
12
|
use_dsl
|
13
13
|
named :element_list
|
14
14
|
name_positional_attributes 'element'
|
15
|
+
name_positional_attributes 'enhanced_rendering'
|
15
16
|
|
16
17
|
def process(parent, _target, attrs)
|
17
18
|
uuid = SecureRandom.uuid
|
18
|
-
MacroPlaceholder[uuid] = {
|
19
|
+
MacroPlaceholder[uuid] = {
|
20
|
+
element: attrs['element'],
|
21
|
+
enhanced_rendering: attrs['enhanced_rendering']
|
22
|
+
}
|
19
23
|
create_paragraph parent, uuid, {}
|
20
24
|
end
|
21
25
|
end
|
@@ -30,12 +34,31 @@ module AsciidoctorLists
|
|
30
34
|
end
|
31
35
|
tof_blocks.each do |block|
|
32
36
|
references_asciidoc = []
|
33
|
-
|
37
|
+
|
38
|
+
params = MacroPlaceholder[block.lines[0]]
|
39
|
+
element_name = ":" + params[:element]
|
40
|
+
enhanced_rendering = params[:enhanced_rendering]
|
41
|
+
|
34
42
|
document.find_by(context: eval(element_name)).each do |element|
|
35
43
|
|
36
|
-
if element.caption
|
37
|
-
element.id
|
38
|
-
|
44
|
+
if element.caption or element.title
|
45
|
+
unless element.id
|
46
|
+
element.id = SecureRandom.uuid
|
47
|
+
end
|
48
|
+
|
49
|
+
if enhanced_rendering
|
50
|
+
if element.caption
|
51
|
+
references_asciidoc << %(xref:#{element.id}[#{element.caption}]#{element.instance_variable_get(:@title)} +)
|
52
|
+
else element.caption
|
53
|
+
references_asciidoc << %(xref:#{element.id}[#{element.instance_variable_get(:@title)}] +)
|
54
|
+
end
|
55
|
+
else
|
56
|
+
if element.caption
|
57
|
+
references_asciidoc << %(xref:#{element.id}[#{element.caption}]#{element.title} +)
|
58
|
+
else element.caption
|
59
|
+
references_asciidoc << %(xref:#{element.id}[#{element.title}] +)
|
60
|
+
end
|
61
|
+
end
|
39
62
|
end
|
40
63
|
end
|
41
64
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-lists
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alwin Schuster
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -24,7 +24,8 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
|
-
description:
|
27
|
+
description: An asciidoctor extension that adds a list of figures, a list of tables,
|
28
|
+
or a list of anything you want!
|
28
29
|
email:
|
29
30
|
executables: []
|
30
31
|
extensions: []
|
@@ -36,7 +37,7 @@ files:
|
|
36
37
|
- lib/asciidoctor-lists/version.rb
|
37
38
|
homepage: https://github.com/Alwinator/asciidoctor-lists
|
38
39
|
licenses:
|
39
|
-
-
|
40
|
+
- MPL-2
|
40
41
|
metadata: {}
|
41
42
|
post_install_message:
|
42
43
|
rdoc_options: []
|
@@ -56,5 +57,6 @@ requirements: []
|
|
56
57
|
rubygems_version: 3.1.2
|
57
58
|
signing_key:
|
58
59
|
specification_version: 4
|
59
|
-
summary: An
|
60
|
+
summary: An asciidoctor extension that adds a list of figures, a list of tables, or
|
61
|
+
a list of anything you want!
|
60
62
|
test_files: []
|