asciidoctor-fb2 0.2.1 → 0.2.2
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 +39 -0
- 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: a4c7f00f477ddb1d95bb04eb0a834308288cae185c008ee0206197c9c4403d95
|
4
|
+
data.tar.gz: '08772d526c95b49df5956b0ba12868aa58e4c1684b5e947aa5e233ee222c891f'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56fbb9d6633d5b3ed3b55fc1b9aa8698c4805ddacae41c44cd376952e998ad89d379fb44bca7fa5ff42454ff6bec7cd717100b7408e013850c762bde7df0bedf
|
7
|
+
data.tar.gz: 63a52028f548239dcc0d349f2d1ae8d371f53618c56aa47b04acb3eb1c42b9a93276dd579752d3ce143f36f61548b421e1f681d83ef47db3788cde303488aa0b
|
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.2 (2020-11-24) - @slonopotamus
|
11
|
+
|
12
|
+
* do not crash on inline line break macro. https://github.com/slonopotamus/asciidoctor-fb2/issues/14[#14]
|
13
|
+
* add support for verses
|
14
|
+
* add support for quotes
|
15
|
+
|
10
16
|
== 0.2.1 (2020-11-24) - @slonopotamus
|
11
17
|
|
12
18
|
* add support for `kbd` inline macro. https://github.com/slonopotamus/asciidoctor-fb2/issues/13[#13]
|
data/lib/asciidoctor_fb2.rb
CHANGED
@@ -119,6 +119,40 @@ module Asciidoctor
|
|
119
119
|
lines * "\n"
|
120
120
|
end
|
121
121
|
|
122
|
+
# @param node [Asciidoctor::Block]
|
123
|
+
def convert_quote(node)
|
124
|
+
citetitle = node.attr('citetitle')
|
125
|
+
citetitle_tag = citetitle.nil_or_empty? ? '' : %(<subtitle>#{citetitle}</subtitle>)
|
126
|
+
|
127
|
+
author = node.attr('attribution')
|
128
|
+
author_tag = author.nil_or_empty? ? '' : %(<text-author>#{node.attr('attribution')}</text-author>)
|
129
|
+
|
130
|
+
%(<cite>
|
131
|
+
#{citetitle_tag}
|
132
|
+
<p>#{node.content}</p>
|
133
|
+
#{author_tag}
|
134
|
+
</cite>)
|
135
|
+
end
|
136
|
+
|
137
|
+
# @param node [Asciidoctor::Block]
|
138
|
+
def convert_verse(node)
|
139
|
+
body = node.content&.split("\n\n")&.map do |stanza|
|
140
|
+
%(<stanza>\n<v>#{stanza.split("\n").join("</v>\n<v>")}</v>\n</stanza>)
|
141
|
+
end&.join("\n")
|
142
|
+
|
143
|
+
citetitle = node.attr('citetitle')
|
144
|
+
citetitle_tag = citetitle.nil_or_empty? ? '' : %(<title>#{citetitle}</title>)
|
145
|
+
|
146
|
+
author = node.attr('attribution')
|
147
|
+
author_tag = author.nil_or_empty? ? '' : %(<text-author>#{node.attr('attribution')}</text-author>)
|
148
|
+
|
149
|
+
%(<poem>
|
150
|
+
#{citetitle_tag}
|
151
|
+
#{body}
|
152
|
+
#{author_tag}
|
153
|
+
</poem>)
|
154
|
+
end
|
155
|
+
|
122
156
|
# @param node [Asciidoctor::Block]
|
123
157
|
def convert_listing(node)
|
124
158
|
lines = []
|
@@ -161,6 +195,11 @@ module Asciidoctor
|
|
161
195
|
result
|
162
196
|
end
|
163
197
|
|
198
|
+
# @param node [Asciidoctor::Inline]
|
199
|
+
def convert_inline_break(node)
|
200
|
+
node.text
|
201
|
+
end
|
202
|
+
|
164
203
|
# @param node [Asciidoctor::Inline]
|
165
204
|
def convert_inline_button(node)
|
166
205
|
%([<strong>#{node.text}</strong>])
|