asciidoctor-html 0.1.9 → 0.1.11
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/.rubocop.yml +2 -2
- data/CHANGELOG.md +11 -0
- data/assets/css/styles.css +2 -2
- data/assets/css/styles.css.map +1 -1
- data/lib/asciidoctor/html/book.rb +2 -2
- data/lib/asciidoctor/html/popovers.rb +4 -0
- data/lib/asciidoctor/html/ref_tree_processor.rb +10 -2
- data/lib/asciidoctor/html/text_inline_macro.rb +38 -0
- metadata +2 -2
- data/lib/asciidoctor/html/sc_inline_macro.rb +0 -21
@@ -8,7 +8,7 @@ require_relative "converter"
|
|
8
8
|
require_relative "ref_tree_processor"
|
9
9
|
require_relative "cref_inline_macro"
|
10
10
|
require_relative "bi_inline_macro"
|
11
|
-
require_relative "
|
11
|
+
require_relative "text_inline_macro"
|
12
12
|
require_relative "template"
|
13
13
|
require_relative "pagination"
|
14
14
|
|
@@ -23,7 +23,7 @@ module Asciidoctor
|
|
23
23
|
Asciidoctor::Extensions.register do
|
24
24
|
tree_processor RefTreeProcessor
|
25
25
|
inline_macro CrefInlineMacro
|
26
|
-
inline_macro
|
26
|
+
inline_macro TextInlineMacro
|
27
27
|
inline_macro BiInlineMacro
|
28
28
|
end
|
29
29
|
|
@@ -39,6 +39,10 @@ module Asciidoctor
|
|
39
39
|
bootstrap.Tooltip.getOrCreateInstance(el);
|
40
40
|
});
|
41
41
|
});
|
42
|
+
// Enable tooltips on abbreviations
|
43
|
+
document.querySelectorAll('abbr[data-bs-toggle="tooltip"]').forEach(el => {
|
44
|
+
bootstrap.Tooltip.getOrCreateInstance(el);
|
45
|
+
});
|
42
46
|
})();
|
43
47
|
JS
|
44
48
|
end
|
@@ -113,7 +113,14 @@ module Asciidoctor
|
|
113
113
|
end
|
114
114
|
|
115
115
|
def offset(list)
|
116
|
-
|
116
|
+
return (list.attr("start").to_i - 1) if list.attr?("start")
|
117
|
+
return 0 unless list.attr?("continue")
|
118
|
+
|
119
|
+
id = list.attr "continue"
|
120
|
+
node = list.document.catalog[:refs][id]
|
121
|
+
return node.attr("nflatitems") || node.items.size if node&.context == :olist
|
122
|
+
|
123
|
+
0
|
117
124
|
end
|
118
125
|
|
119
126
|
def shift(list)
|
@@ -227,7 +234,7 @@ module Asciidoctor
|
|
227
234
|
elsif olist? block
|
228
235
|
if listdepth.zero?
|
229
236
|
flat_style = (block.style == "pseudocode")
|
230
|
-
flat_idx = offset block
|
237
|
+
flat_idx = offset block
|
231
238
|
end
|
232
239
|
process_olist! block, listdepth, flat_style:
|
233
240
|
elsif olist_item?(block) && flat_style
|
@@ -245,6 +252,7 @@ module Asciidoctor
|
|
245
252
|
listdepth -= 1 if olist_item?(block) && move == :retreat
|
246
253
|
bulletdepth += 1 if ulist?(block) && move == :explore
|
247
254
|
bulletdepth -= 1 if ulist_item?(block) && move == :retreat
|
255
|
+
block.set_attr("nflatitems", flat_idx) if olist?(block) && flat_style && move == :retreat
|
248
256
|
end
|
249
257
|
end
|
250
258
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "asciidoctor"
|
4
|
+
|
5
|
+
module Asciidoctor
|
6
|
+
module Html
|
7
|
+
# Format text according to Bootstrap-compatible inline text elements
|
8
|
+
class TextInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor
|
9
|
+
use_dsl
|
10
|
+
|
11
|
+
named :text
|
12
|
+
name_positional_attributes "text"
|
13
|
+
|
14
|
+
def process(parent, target, attrs)
|
15
|
+
text = attrs["text"]
|
16
|
+
content = case target
|
17
|
+
when "del"
|
18
|
+
%(<del>#{text}</del>)
|
19
|
+
when "strike"
|
20
|
+
%(<s>#{text}</s>)
|
21
|
+
when "ins"
|
22
|
+
%(<ins>#{text}</ins>)
|
23
|
+
when "underline"
|
24
|
+
%(<u>#{text}</u>)
|
25
|
+
when "small"
|
26
|
+
%(<small>#{text}</small>)
|
27
|
+
when "abbr"
|
28
|
+
title = %( title="#{attrs["title"]}" data-bs-toggle="tooltip") if attrs.include?("title")
|
29
|
+
role = %( class="#{attrs["role"]}") if attrs.include?("role")
|
30
|
+
%(<abbr#{title}#{role}>#{text}</abbr>)
|
31
|
+
else
|
32
|
+
%(<span class="text-#{target}">#{text}</span>)
|
33
|
+
end
|
34
|
+
create_inline_pass parent, content
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ravi Rajani
|
@@ -101,11 +101,11 @@ files:
|
|
101
101
|
- lib/asciidoctor/html/pagination.rb
|
102
102
|
- lib/asciidoctor/html/popovers.rb
|
103
103
|
- lib/asciidoctor/html/ref_tree_processor.rb
|
104
|
-
- lib/asciidoctor/html/sc_inline_macro.rb
|
105
104
|
- lib/asciidoctor/html/scroll.rb
|
106
105
|
- lib/asciidoctor/html/sidebar.rb
|
107
106
|
- lib/asciidoctor/html/table.rb
|
108
107
|
- lib/asciidoctor/html/template.rb
|
108
|
+
- lib/asciidoctor/html/text_inline_macro.rb
|
109
109
|
- lib/asciidoctor/html/tree_walker.rb
|
110
110
|
- lib/asciidoctor/html/utils.rb
|
111
111
|
- lib/asciidoctor/html/webmanifest.rb
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "asciidoctor"
|
4
|
-
|
5
|
-
module Asciidoctor
|
6
|
-
module Html
|
7
|
-
# Convert text to small caps
|
8
|
-
class ScInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor
|
9
|
-
use_dsl
|
10
|
-
|
11
|
-
named :sc
|
12
|
-
name_positional_attributes "text"
|
13
|
-
format :short
|
14
|
-
|
15
|
-
def process(parent, target, _attrs)
|
16
|
-
create_inline_pass parent, "[.smallcaps]##{target}#",
|
17
|
-
attributes: { "subs" => :normal }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|