asciidoctor-html 0.1.8 → 0.1.10

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.
@@ -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 "sc_inline_macro"
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 ScInlineMacro
26
+ inline_macro TextInlineMacro
27
27
  inline_macro BiInlineMacro
28
28
  end
29
29
 
@@ -120,7 +120,7 @@ module Asciidoctor
120
120
  short_title: @short_title,
121
121
  author: @author,
122
122
  date: @date,
123
- chaptitle: "Search",
123
+ chapsubheading: "Search",
124
124
  langs: []
125
125
  )
126
126
  end
@@ -244,7 +244,6 @@ module Asciidoctor
244
244
  author: @author,
245
245
  date: @date,
246
246
  description: doc.attr("description"),
247
- chaptitle: tdata.chaptitle,
248
247
  chapheading: tdata.chapheading,
249
248
  chapsubheading: tdata.chapsubheading,
250
249
  langs: langs(doc)
@@ -235,7 +235,7 @@ module Asciidoctor
235
235
  classes << "table-striped" if node.option? "striped"
236
236
  classes << "table-bordered" if node.option? "bordered"
237
237
  classes << "table-sm" if node.option? "compact"
238
- classes << "table-v#{node.attr "valign"}" if node.attr?("valign")
238
+ classes << "align-#{node.attr "valign"}" if node.attr?("valign")
239
239
  classes << "table-h#{node.attr "halign"}" if node.attr?("halign")
240
240
  width_attribute = ""
241
241
  if (autowidth = node.option? "autowidth") && !(node.attr? "width")
@@ -14,7 +14,9 @@ module Asciidoctor
14
14
  ("level-#{level} pseudocode" if flat),
15
15
  node.role
16
16
  ].compact
17
- classes << "checklist" if node.option?("checklist")
17
+ classes << "list-checklist" if node.option?("checklist")
18
+ classes << "list-unmarked" if node.option?("unmarked")
19
+ classes << "list-roomy" if node.option?("roomy")
18
20
  result = [%(<#{tag_name}#{Utils.dyn_id_class_attr_str node, classes.join(" ")}>)]
19
21
  node.items.each do |item|
20
22
  result << display_list_item(item)
@@ -27,7 +29,8 @@ module Asciidoctor
27
29
  result = []
28
30
  result << %(<li#{Utils.id_class_attr_str item.id,
29
31
  item.role}><div class="li-mark">#{item.attr "mark"}</div>)
30
- result << %(<div class="li-content"><p>#{item.text}</p>)
32
+ result << %(<div class="li-content">)
33
+ result << %(<p>#{item.text}</p>) unless item.text.empty?
31
34
  result << "\n#{item.content}" if item.blocks?
32
35
  result << %(</div></li>#{Utils.id_class_sel_comment item.id, item.role})
33
36
  result.join "\n"
@@ -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
@@ -4,7 +4,7 @@ module Asciidoctor
4
4
  module Html
5
5
  # Helpers for the table conversion
6
6
  module Table
7
- def self.display_row(node, tsec, row)
7
+ def self.display_row(tsec, row)
8
8
  result = ["<tr>"]
9
9
  row.each do |cell|
10
10
  cell_content = if tsec == :head
@@ -16,8 +16,8 @@ module Asciidoctor
16
16
  end
17
17
  cell_tag_name = (tsec == :head || cell.style == :header ? "th" : "td")
18
18
  cell_attrs = []
19
- cell_attrs << %(halign-#{cell.attr "halign"}) unless node.attr?("halign")
20
- cell_attrs << %(align-#{cell.attr "valign"}) unless node.attr?("valign")
19
+ cell_attrs << %(halign-#{cell.attr "halign"}) unless cell.attr?("halign", "left")
20
+ cell_attrs << %(align-#{cell.attr "valign"}) unless cell.attr?("valign", "top")
21
21
  cell_class_attribute = %( class="#{cell_attrs.join " "}") unless cell_attrs.empty?
22
22
  cell_colspan_attribute = cell.colspan ? %( colspan="#{cell.colspan}") : ""
23
23
  cell_rowspan_attribute = cell.rowspan ? %( rowspan="#{cell.rowspan}") : ""
@@ -32,7 +32,7 @@ module Asciidoctor
32
32
  node.rows.to_h.map do |tsec, rows|
33
33
  next if rows.empty?
34
34
 
35
- "<t#{tsec}>\n#{rows.map { |row| display_row(node, tsec, row) }.join("\n")}\n</t#{tsec}>"
35
+ "<t#{tsec}>\n#{rows.map { |row| display_row(tsec, row) }.join("\n")}\n</t#{tsec}>"
36
36
  end.join("\n")
37
37
  end
38
38
  end
@@ -147,7 +147,7 @@ module Asciidoctor
147
147
  # - description: String
148
148
  # - date: Date
149
149
  # - chapheading: String
150
- # - chaptitle: String
150
+ # - chapsubheading: String
151
151
  # - langs: Array[String]
152
152
  def self.html(content, nav_items, opts = {})
153
153
  nav = (nav_items.size > 1)
@@ -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.8
4
+ version: 0.1.10
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