chat-block-processor: create the initial HTML output

This commit is contained in:
Gabriel Arazas 2023-04-03 23:28:36 +08:00
parent e3231fb0b2
commit cbc759a544
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -8,7 +8,6 @@ class ChatBlock < Asciidoctor::Extensions::BlockProcessor
name_positional_attributes 'avatar', 'state'
default_attributes 'state' => 'default', 'avatarstype' => 'webp'
# TODO: Create the output.
def process(parent, reader, attrs)
block = create_block parent, :pass, nil, attrs, content_model: :compound
block.add_role('dialogblock')
@ -16,6 +15,17 @@ class ChatBlock < Asciidoctor::Extensions::BlockProcessor
attrs['name'] ||= attrs['avatar']
attrs['avatarsdir'] ||= './avatars'
block << (create_block block, :pass, %(
<div class="dialogblock dialogblock__box dialogblock__avatar--#{attrs['avatar']} #{attrs['role']}" title="#{attrs['avatar']}">
<div class="dialogblock dialogblock__avatar">
# Image
</div>
<div class="dialogblock dialogblock__text">
# Content
</div>
</div>
), nil)
block
end
end