chat-block-processor: split the output construction

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

View File

@ -15,13 +15,24 @@ class ChatBlock < Asciidoctor::Extensions::BlockProcessor
attrs['name'] ||= attrs['avatar']
attrs['avatarsdir'] ||= './avatars'
# You can think of this section as a pipeline constructing the HTML
# component for this block. Specifically, we're building one component that
# contains two output: the dialog image of our avatar and its content.
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
), nil)
# TODO: Create the image block here
block << (create_block block, :pass, %(
</div>
<div class="dialogblock dialogblock__text">
# Content
), nil)
# TODO: Insert the content.
block << (create_block block, :pass, %(
</div>
</div>
), nil)