asciidoctor-html 2.2.3 → 2.2.4

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.
@@ -7,6 +7,7 @@ require_relative "figure"
7
7
  require_relative "table"
8
8
  require_relative "tabs"
9
9
  require_relative "jupyterlite"
10
+ require_relative "live"
10
11
 
11
12
  module Asciidoctor
12
13
  module Html
@@ -140,7 +141,7 @@ module Asciidoctor
140
141
  end
141
142
  title = Utils.display_title node
142
143
  content = title + pre_open + node.content + pre_close
143
- Utils.wrap_live Utils.wrap_node(content, node), node.attr("live")
144
+ Live.wrap_live Utils.wrap_node(content, node), node.attr("live")
144
145
  end
145
146
 
146
147
  def convert_literal(node)
@@ -174,7 +175,7 @@ module Asciidoctor
174
175
  def convert_image(node)
175
176
  content = display_figure node
176
177
  classes = ["figbox", node.role]
177
- Utils.wrap_live(
178
+ Live.wrap_live(
178
179
  Utils.wrap_id_classes(content, node.id, classes.compact.join(" ")),
179
180
  node.attr("live")
180
181
  )
@@ -236,8 +237,8 @@ module Asciidoctor
236
237
  result << "</dd>"
237
238
  end
238
239
  result << "</dl>\n"
239
- Utils.wrap_live(Utils.wrap_id_classes_with_title(result.join("\n"), node, node.id, "dlist-wrapper"),
240
- node.attr("live"))
240
+ Live.wrap_live(Utils.wrap_id_classes_with_title(result.join("\n"), node, node.id, "dlist-wrapper"),
241
+ node.attr("live"))
241
242
  end
242
243
 
243
244
  def convert_inline_anchor(node)
@@ -295,7 +296,7 @@ module Asciidoctor
295
296
  end
296
297
  result << "#{Table.display_rows(node)}</table>"
297
298
  wrap_classes = "table-responsive#{" #{node.role}" if node.role}"
298
- Utils.wrap_live Utils.wrap_id_classes(result.join("\n"), nil, wrap_classes), node.attr("live")
299
+ Live.wrap_live Utils.wrap_id_classes(result.join("\n"), nil, wrap_classes), node.attr("live")
299
300
  end
300
301
  end
301
302
  end
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "utils"
4
+ require_relative "live"
5
+
3
6
  module Asciidoctor
4
7
  module Html
5
8
  # Helper functions for the list conversion
@@ -26,7 +29,7 @@ module Asciidoctor
26
29
  end
27
30
  result << %(</#{tag_name}> <!-- .level-#{level} -->\n)
28
31
  wrap_classes = %(list-wrapper#{" #{node.role}" if node.title? && node.role})
29
- Utils.wrap_live Utils.wrap_id_classes_with_title(result.join("\n"), node, node.id, wrap_classes), node.attr("live")
32
+ Live.wrap_live Utils.wrap_id_classes_with_title(result.join("\n"), node, node.id, wrap_classes), node.attr("live")
30
33
  end
31
34
 
32
35
  def self.display_list_item(item, inside: false)
@@ -135,6 +135,24 @@ module Asciidoctor
135
135
  });
136
136
  })();
137
137
  JS
138
+
139
+ def self.wrap_live(content, live_attr)
140
+ return content unless live_attr
141
+
142
+ /\A(?<default>normal|faded|covered)-(?<live>faded|covered)\Z/ =~ live_attr
143
+
144
+ live_class = %(live-#{live || "faded"})
145
+ default_class = %(live-default-#{default || "normal"})
146
+ <<~HTML
147
+ <div class="live #{default_class} #{live_class}" data-reset="#{default_class}">
148
+ <div class="live-select">
149
+ <svg xmlns="http://www.w3.org/2000/svg" class="live-icon" transform="scale(-1 1)" viewBox="0 0 512 512">
150
+ <path d="M403.623 242.703 226.443 8.728c-7.34-9.693-21.153-11.606-30.845-4.258-9.701 7.34-11.607 21.16-4.266 30.861l23.85 31.484c-50.984 22.605-111.261 5.426-111.261 5.426 27.887 45.796 77.341 56.749 92.622 59.093-28.271 33.774-45.388 77.234-45.396 124.674.023 66.872 33.936 125.966 85.396 160.969l-45.211 59.693c-7.341 9.701-5.435 23.52 4.266 30.869 9.692 7.333 23.505 5.427 30.845-4.258v-.008l177.18-233.982c5.942-7.856 5.942-18.74 0-26.588m-207.08 64.681c-9.393 0-17.011-23.013-17.011-51.406 0-28.363 7.618-51.377 17.011-51.377s17.01 23.014 17.01 51.377c0 28.393-7.618 51.406-17.01 51.406m66.587 74.482a152.3 152.3 0 0 1-35.857-33.036c19.5-9.846 34.02-47.632 34.02-92.852 0-45.189-14.52-82.968-34.005-92.822a151.7 151.7 0 0 1 35.842-33.006l95.32 125.858z" fill="currentColor"/>
151
+ </svg>
152
+ </div>
153
+ #{content}</div> <!-- .live -->
154
+ HTML
155
+ end
138
156
  end
139
157
  end
140
158
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "asciidoctor"
4
4
  require "pathname"
5
+ require_relative "live"
5
6
 
6
7
  module Asciidoctor
7
8
  module Html
@@ -28,7 +29,7 @@ module Asciidoctor
28
29
  </nav>
29
30
  </div>
30
31
  HTML
31
- content = Utils.wrap_live content, attrs["live"]
32
+ content = Live.wrap_live content, attrs["live"]
32
33
  create_pass_block parent, content, attrs, subs: nil
33
34
  end
34
35
  end
@@ -86,20 +86,6 @@ module Asciidoctor
86
86
  %(<span class="title-mark">#{sectnum}</span>)
87
87
  end
88
88
 
89
- def self.wrap_live(content, live_attr)
90
- return content unless live_attr
91
-
92
- /\A(?<default>normal|faded|covered)-(?<live>faded|covered)\Z/ =~ live_attr
93
-
94
- live_class = %(live-#{live || "faded"})
95
- default_class = %(live-default-#{default || "normal"})
96
- <<~HTML
97
- <div class="live #{default_class} #{live_class}" data-reset="#{default_class}">
98
- <div class="live-select"><i class="bi bi-eye"></i></div>
99
- #{content}</div> <!-- .live -->
100
- HTML
101
- end
102
-
103
89
  def self.line_number_attr(line_number, live: false)
104
90
  live ? %( data-line-number="#{line_number}") : ""
105
91
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Asciidoctor
4
4
  module Html
5
- VERSION = "2.2.3"
5
+ VERSION = "2.2.4"
6
6
  end
7
7
  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: 2.2.3
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ravi Rajani
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  - !ruby/object:Gem::Version
161
161
  version: '0'
162
162
  requirements: []
163
- rubygems_version: 3.6.9
163
+ rubygems_version: 3.6.7
164
164
  specification_version: 4
165
165
  summary: An AsciiDoc-to-HTML static site generator based on Asciidoctor.
166
166
  test_files: []