module Asciidoctor::PDF::TextTransformer

Constants

Hyphen
HyphenatedHyphen
MultibyteChars
PCDATAFilterRx
SoftHyphen
TagFilterRx
WordRx
XMLMarkupRx

Public Instance Methods

capitalize_mb(string) click to toggle source
# File lib/asciidoctor/pdf/text_transformer.rb, line 65
def capitalize_mb string
  string.capitalize
end
capitalize_words_mb(string) click to toggle source
# File lib/asciidoctor/pdf/text_transformer.rb, line 32
def capitalize_words_mb string
  string.gsub(WordRx) { capitalize_mb $& }
end
capitalize_words_pcdata(string) click to toggle source
# File lib/asciidoctor/pdf/text_transformer.rb, line 24
def capitalize_words_pcdata string
  if XMLMarkupRx.match? string
    string.gsub(PCDATAFilterRx) { $2 ? (capitalize_words_mb $2) : $1 }
  else
    capitalize_words_mb string
  end
end
hyphenate_words(string, hyphenator) click to toggle source
# File lib/asciidoctor/pdf/text_transformer.rb, line 44
def hyphenate_words string, hyphenator
  string.gsub(WordRx) { (hyphenator.visualize $&, SoftHyphen).gsub HyphenatedHyphen, Hyphen }
end
hyphenate_words_pcdata(string, hyphenator) click to toggle source
# File lib/asciidoctor/pdf/text_transformer.rb, line 36
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_mb(string) click to toggle source
# File lib/asciidoctor/pdf/text_transformer.rb, line 69
def lowercase_mb string
  string.downcase
end
lowercase_pcdata(string) click to toggle source
# File lib/asciidoctor/pdf/text_transformer.rb, line 48
def lowercase_pcdata string
  if string.include? '<'
    string.gsub(TagFilterRx) { $2 ? (lowercase_mb $2) : $1 }
  else
    lowercase_mb string
  end
end
uppercase_mb(string) click to toggle source
# File lib/asciidoctor/pdf/text_transformer.rb, line 73
def uppercase_mb string
  string.upcase
end
uppercase_pcdata(string) click to toggle source
# File lib/asciidoctor/pdf/text_transformer.rb, line 56
def uppercase_pcdata string
  if XMLMarkupRx.match? string
    string.gsub(PCDATAFilterRx) { $2 ? (uppercase_mb $2) : $1 }
  else
    uppercase_mb string
  end
end