Refactor common functions

This commit is contained in:
Gabriel Arazas 2023-11-24 11:34:10 +08:00
parent a57804d519
commit d704253410
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -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
</div>
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