module Asciidoctor::Substitutors

def convert_quoted_text match, type, scope

Returns The converted String text for the quoted text region

scope - The scope of the quoting (constrained or unconstrained)
type - The quoting type (single, double, strong, emphasis, monospaced, etc)
match - The MatchData for the quoted text region

Internal: Convert a quoted text region
def convert_quoted_text match, type, scope
  if match[0].start_with? RS
    if scope == :constrained && (attrs = match[2])
      unescaped_attrs = %([#{attrs}])
    else
      return match[0].slice 1, match[0].length
    end
  end
  if scope == :constrained
    if unescaped_attrs
      %(#{unescaped_attrs}#{Inline.new(self, :quoted, match[3], type: type).convert})
    else
      if (attrlist = match[2])
        id = (attributes = parse_quoted_text_attributes attrlist)['id']
        type = :unquoted if type == :mark
      end
      %(#{match[1]}#{Inline.new(self, :quoted, match[3], type: type, id: id, attributes: attributes).convert})
    end
  else
    if (attrlist = match[1])
      id = (attributes = parse_quoted_text_attributes attrlist)['id']
      type = :unquoted if type == :mark
    end
    Inline.new(self, :quoted, match[2], type: type, id: id, attributes: attributes).convert
  end
end