diff --git a/lib/asciidoctor/foodogsquared/converter.rb b/lib/asciidoctor/foodogsquared/converter.rb index 3d1dec7..39bec05 100644 --- a/lib/asciidoctor/foodogsquared/converter.rb +++ b/lib/asciidoctor/foodogsquared/converter.rb @@ -8,10 +8,7 @@ module Asciidoctor::Foodogsquared::Converter register_for 'html5' def convert_chat(node) - attributes = [] - attributes << %(id="#{node.id}") if node.id - attributes << %(class="#{node.role}") if node.role - + attributes = add_attributes node avatar_uri = node.parent.image_uri "#{node.attr 'avatarsticker'}/#{node.attr 'state'}.#{node.attr 'avatarstype'}", 'avatarsdir' <<~HTML @@ -26,5 +23,13 @@ module Asciidoctor::Foodogsquared::Converter HTML end + + def add_attributes(node) + attributes = [] + attributes << %(id="#{node.id}") if node.id + attributes << %(class="#{node.role}") if node.role + + attributes + end end end