asciidoctor-fb2 0.2.2 → 0.2.3
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/CHANGELOG.adoc +6 -0
- data/lib/asciidoctor_fb2.rb +18 -6
- data/lib/asciidoctor_fb2/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcbbc6c8b9fbfbb6eb2444a9054f8676aed178409809cc47977bccdd5011e94c
|
4
|
+
data.tar.gz: 5fd22ce5a853988ce66c483637b1b2fe0ca42154d2ab4ee0b277bbb84a96fa7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b18f69261c30b1c486c6ef2ec41df8ef23e45ccb818cdc1869d5e525dc67eb841bbb83e51b473e5c6d50a868535a49530b0ac260c790597254df01656b1bb859
|
7
|
+
data.tar.gz: bbe16778d9bc390c7d492bea0a9588ac24bc9a67490d74950ccf68c65e699f42a0f4112b42d67c1a8aca472dae335ca038a529caaf087f6017f5bfad7e04c1e3
|
data/CHANGELOG.adoc
CHANGED
@@ -7,6 +7,12 @@
|
|
7
7
|
This document provides a high-level view of the changes to the {project-name} by release.
|
8
8
|
For a detailed view of what has changed, refer to the {uri-project}/commits/master[commit history] on GitHub.
|
9
9
|
|
10
|
+
== 0.2.3 (2020-11-24) - @slonopotamus
|
11
|
+
|
12
|
+
* add support for literal blocks
|
13
|
+
* fix crash for `menu` inline macro without submenu. https://github.com/slonopotamus/asciidoctor-fb2/issues/15[#15]
|
14
|
+
* add initial support for sidebar
|
15
|
+
|
10
16
|
== 0.2.2 (2020-11-24) - @slonopotamus
|
11
17
|
|
12
18
|
* do not crash on inline line break macro. https://github.com/slonopotamus/asciidoctor-fb2/issues/14[#14]
|
data/lib/asciidoctor_fb2.rb
CHANGED
@@ -137,7 +137,7 @@ module Asciidoctor
|
|
137
137
|
# @param node [Asciidoctor::Block]
|
138
138
|
def convert_verse(node)
|
139
139
|
body = node.content&.split("\n\n")&.map do |stanza|
|
140
|
-
%(<stanza>\n<v>#{stanza.split("\n")
|
140
|
+
%(<stanza>\n<v>#{stanza.split("\n") * "</v>\n<v>"}</v>\n</stanza>)
|
141
141
|
end&.join("\n")
|
142
142
|
|
143
143
|
citetitle = node.attr('citetitle')
|
@@ -155,6 +155,11 @@ module Asciidoctor
|
|
155
155
|
|
156
156
|
# @param node [Asciidoctor::Block]
|
157
157
|
def convert_listing(node)
|
158
|
+
convert_literal(node)
|
159
|
+
end
|
160
|
+
|
161
|
+
# @param node [Asciidoctor::Block]
|
162
|
+
def convert_literal(node)
|
158
163
|
lines = []
|
159
164
|
node.content.split("\n").each do |line|
|
160
165
|
lines << %(<p><code>#{line}</code></p>)
|
@@ -186,11 +191,11 @@ module Asciidoctor
|
|
186
191
|
caret = ' <strong>›</strong> '
|
187
192
|
menu = node.attr('menu')
|
188
193
|
menuitem = node.attr('menuitem')
|
189
|
-
submenus = node.attr('submenus')
|
194
|
+
submenus = node.attr('submenus') * %(</b>#{caret}<b>)
|
190
195
|
|
191
196
|
result = %(<strong>#{menu}</strong>)
|
192
|
-
result += %(#{caret}<strong>#{submenus}</strong>) unless submenus.
|
193
|
-
result += %(#{caret}<strong>#{menuitem}</strong>) unless menuitem.
|
197
|
+
result += %(#{caret}<strong>#{submenus}</strong>) unless submenus.nil_or_empty?
|
198
|
+
result += %(#{caret}<strong>#{menuitem}</strong>) unless menuitem.nil_or_empty?
|
194
199
|
|
195
200
|
result
|
196
201
|
end
|
@@ -207,7 +212,7 @@ module Asciidoctor
|
|
207
212
|
|
208
213
|
# @param node [Asciidoctor::Inline]
|
209
214
|
def convert_inline_kbd(node)
|
210
|
-
%(<strong>#{node.attr('keys')
|
215
|
+
%(<strong>#{node.attr('keys') * '</strong>+<strong>'}</strong>)
|
211
216
|
end
|
212
217
|
|
213
218
|
# @param node [Asciidoctor::Inline]
|
@@ -287,6 +292,13 @@ module Asciidoctor
|
|
287
292
|
lines * "\n"
|
288
293
|
end
|
289
294
|
|
295
|
+
# @param node [Asciidoctor::Block]
|
296
|
+
def convert_sidebar(node)
|
297
|
+
title_tag = node.title.nil_or_empty? ? '' : %(<p><strong>#{node.title}</strong></p>)
|
298
|
+
%(#{title_tag}
|
299
|
+
#{node.content})
|
300
|
+
end
|
301
|
+
|
290
302
|
# @param node [Asciidoctor::List]
|
291
303
|
def convert_ulist(node)
|
292
304
|
lines = []
|
@@ -365,7 +377,7 @@ module Asciidoctor
|
|
365
377
|
when :literal
|
366
378
|
%(<p><pre>#{cell.text}</pre></p>)
|
367
379
|
else
|
368
|
-
(cell_content = cell.content).empty? ? '' : %(<p>#{cell_content
|
380
|
+
(cell_content = cell.content).empty? ? '' : %(<p>#{cell_content * "</p>\n<p>"}</p>)
|
369
381
|
end
|
370
382
|
end
|
371
383
|
|