module Asciidoctor::PDF::TextTransformer

Constants

ContiguousCharsRx
Hyphen
PCDATAFilterRx
SoftHyphen
TagFilterRx
WordRx
XMLMarkupRx

Public Instance Methods

capitalize_words(string) click to toggle source
# File lib/asciidoctor/pdf/text_transformer.rb, line 22
def capitalize_words string
  string.gsub(ContiguousCharsRx) { $&.capitalize }
end
capitalize_words_pcdata(string) click to toggle source
# File lib/asciidoctor/pdf/text_transformer.rb, line 14
def capitalize_words_pcdata string
  if XMLMarkupRx.match? string
    string.gsub(PCDATAFilterRx) { $2 ? (capitalize_words $2) : $1 }
  else
    capitalize_words string
  end
end
hyphenate_words(string, hyphenator) click to toggle source
# File lib/asciidoctor/pdf/text_transformer.rb, line 34
def hyphenate_words string, hyphenator
  string.gsub(WordRx) { hyphenator.visualize $&, SoftHyphen }
end
hyphenate_words_pcdata(string, hyphenator) click to toggle source
# File lib/asciidoctor/pdf/text_transformer.rb, line 26
def hyphenate_words_pcdata string, hyphenator
  if XMLMarkupRx.match? string
    string.gsub(PCDATAFilterRx) { $2 ? (hyphenate_words $2, hyphenator) : $1 }
  else
    hyphenate_words string, hyphenator
  end
end
lowercase_pcdata(string) click to toggle source
# File lib/asciidoctor/pdf/text_transformer.rb, line 38
def lowercase_pcdata string
  if string.include? '<'
    string.gsub(TagFilterRx) { $2 ? $2.downcase : $1 }
  else
    string.downcase
  end
end
uppercase_pcdata(string) click to toggle source
# File lib/asciidoctor/pdf/text_transformer.rb, line 46
def uppercase_pcdata string
  if XMLMarkupRx.match? string
    string.gsub(PCDATAFilterRx) { $2 ? $2.upcase : $1 }
  else
    string.upcase
  end
end