class Asciidoctor::Document::Title

Public Parsed and stores a partitioned title (i.e., title & subtitle).

Attributes

combined[R]
main[R]
subtitle[R]
title[R]

Public Class Methods

new(val, opts = {}) click to toggle source
# File lib/asciidoctor/document.rb, line 113
def initialize val, opts = {}
  # TODO separate sanitization by type (:cdata for HTML/XML, :plain_text for non-SGML, false for none)
  if (@sanitized = opts[:sanitize]) && val.include?('<')
    val = val.gsub(XmlSanitizeRx, '').squeeze(' ').strip
  end
  if (sep = opts[:separator] || ':').empty? || !val.include?(sep = %(#{sep} ))
    @main = val
    @subtitle = nil
  else
    @main, _, @subtitle = val.rpartition sep
  end
  @combined = val
end

Public Instance Methods

sanitized?() click to toggle source
# File lib/asciidoctor/document.rb, line 127
def sanitized?
  @sanitized
end
subtitle?() click to toggle source
# File lib/asciidoctor/document.rb, line 131
def subtitle?
  @subtitle ? true : false
end
to_s() click to toggle source
# File lib/asciidoctor/document.rb, line 135
def to_s
  @combined
end