lib/asciidoctor_fb2.rb in asciidoctor-fb2-0.2.1 vs lib/asciidoctor_fb2.rb in asciidoctor-fb2-0.2.2

- old
+ new

@@ -118,10 +118,44 @@ lines << '<empty-line/>' unless node.has_role?('last') lines * "\n" end # @param node [Asciidoctor::Block] + def convert_quote(node) + citetitle = node.attr('citetitle') + citetitle_tag = citetitle.nil_or_empty? ? '' : %(<subtitle>#{citetitle}</subtitle>) + + author = node.attr('attribution') + author_tag = author.nil_or_empty? ? '' : %(<text-author>#{node.attr('attribution')}</text-author>) + + %(<cite> +#{citetitle_tag} +<p>#{node.content}</p> +#{author_tag} +</cite>) + end + + # @param node [Asciidoctor::Block] + def convert_verse(node) + body = node.content&.split("\n\n")&.map do |stanza| + %(<stanza>\n<v>#{stanza.split("\n").join("</v>\n<v>")}</v>\n</stanza>) + end&.join("\n") + + citetitle = node.attr('citetitle') + citetitle_tag = citetitle.nil_or_empty? ? '' : %(<title>#{citetitle}</title>) + + author = node.attr('attribution') + author_tag = author.nil_or_empty? ? '' : %(<text-author>#{node.attr('attribution')}</text-author>) + + %(<poem> +#{citetitle_tag} +#{body} +#{author_tag} +</poem>) + end + + # @param node [Asciidoctor::Block] def convert_listing(node) lines = [] node.content.split("\n").each do |line| lines << %(<p><code>#{line}</code></p>) end @@ -157,9 +191,14 @@ result = %(<strong>#{menu}</strong>) result += %(#{caret}<strong>#{submenus}</strong>) unless submenus.empty? result += %(#{caret}<strong>#{menuitem}</strong>) unless menuitem.empty? result + end + + # @param node [Asciidoctor::Inline] + def convert_inline_break(node) + node.text end # @param node [Asciidoctor::Inline] def convert_inline_button(node) %([<strong>#{node.text}</strong>])