2023-04-03 13:55:33 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ChatBlock < Asciidoctor::Extensions::BlockProcessor
|
|
|
|
use_dsl
|
|
|
|
|
|
|
|
named :chat
|
|
|
|
on_context :example
|
|
|
|
name_positional_attributes 'avatar', 'state'
|
|
|
|
default_attributes 'state' => 'default', 'avatarstype' => 'webp'
|
|
|
|
|
|
|
|
# TODO: Create the output.
|
|
|
|
def process(parent, reader, attrs)
|
2023-04-03 15:13:48 +00:00
|
|
|
block = create_block parent, :pass, nil, attrs, content_model: :compound
|
|
|
|
block.add_role('dialogblock')
|
|
|
|
|
|
|
|
attrs['name'] ||= attrs['avatar']
|
|
|
|
attrs['avatarsdir'] ||= './avatars'
|
|
|
|
|
|
|
|
block
|
2023-04-03 13:55:33 +00:00
|
|
|
end
|
|
|
|
end
|