18
18
class ChangeAdmonition < Asciidoctor ::Extensions ::Group
19
19
def activate ( registry )
20
20
[
21
- [ :added , 'added' ] ,
22
- [ :coming , 'changed' ] ,
23
- [ :deprecated , 'deleted' ] ,
24
- ] . each do |( name , revisionflag ) |
25
- registry . block_macro ChangeAdmonitionBlock . new ( revisionflag ) , name
21
+ [ :added , 'added' , 'note' ] ,
22
+ [ :coming , 'changed' , 'note' ] ,
23
+ [ :deprecated , 'deleted' , 'warning' ] ,
24
+ ] . each do |( name , revisionflag , tag ) |
25
+ registry . block_macro ChangeAdmonitionBlock . new ( revisionflag , tag ) , name
26
26
registry . inline_macro ChangeAdmonitionInline . new ( revisionflag ) , name
27
27
end
28
28
end
@@ -33,24 +33,25 @@ class ChangeAdmonitionBlock < Asciidoctor::Extensions::BlockMacroProcessor
33
33
use_dsl
34
34
name_positional_attributes :version , :passtext
35
35
36
- def initialize ( revisionflag )
37
- super
36
+ def initialize ( revisionflag , tag )
37
+ super ( nil )
38
38
@revisionflag = revisionflag
39
+ @tag = tag
39
40
end
40
41
41
42
def process ( parent , _target , attrs )
42
43
version = attrs [ :version ]
43
44
# We can *almost* go through the standard :admonition conversion but
44
45
# that won't render the revisionflag or the revision. So we have to
45
46
# go with this funny compound pass thing.
46
- note = Asciidoctor ::Block . new ( parent , :pass , :content_model => :compound )
47
- note << Asciidoctor ::Block . new ( note , :pass ,
48
- :source => "<note revisionflag=\" #{ @revisionflag } \" revision=\" #{ version } \" >" ,
47
+ admon = Asciidoctor ::Block . new ( parent , :pass , :content_model => :compound )
48
+ admon << Asciidoctor ::Block . new ( admon , :pass ,
49
+ :source => "<#{ @tag } revisionflag=\" #{ @revisionflag } \" revision=\" #{ version } \" >" ,
49
50
:attributes => { 'revisionflag' => @revisionflag } )
50
- note << Asciidoctor ::Block . new ( note , :paragraph ,
51
+ admon << Asciidoctor ::Block . new ( admon , :paragraph ,
51
52
:source => attrs [ :passtext ] ,
52
53
:subs => Asciidoctor ::Substitutors ::NORMAL_SUBS )
53
- note << Asciidoctor ::Block . new ( note , :pass , :source => "</note >" )
54
+ admon << Asciidoctor ::Block . new ( admon , :pass , :source => "</#{ @tag } >" )
54
55
end
55
56
end
56
57
@@ -62,7 +63,7 @@ class ChangeAdmonitionInline < Asciidoctor::Extensions::InlineMacroProcessor
62
63
with_format :short
63
64
64
65
def initialize ( revisionflag )
65
- super
66
+ super ( nil )
66
67
@revisionflag = revisionflag
67
68
end
68
69
0 commit comments