Method: IsoDoc::PresentationXMLConvert#change_case

Defined in:
lib/isodoc/presentation_function/inline.rb

#change_case(span, value, seen_space) ⇒ Object



155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/isodoc/presentation_function/inline.rb', line 155

def change_case(span, value, seen_space)
  span.traverse do |s|
    s.text? or next
    case value
    when "uppercase" then s.replace s.text.upcase
    when "lowercase" then s.replace s.text.downcase
    when "capitalize"
      s.replace conditional_capitalize(s.text, seen_space)
    end
    seen_space = /\s$/.match?(s.text)
  end
end