Class: Mathml2latex::XsltFunctions
- Inherits:
-
Object
- Object
- Mathml2latex::XsltFunctions
- Defined in:
- lib/mathml2latex/xslt_functions.rb
Instance Method Summary collapse
- #fetch_symbols(str) ⇒ Object
- #matches(str, regex_str, flag = '') ⇒ Object
- #replace(str, regex_str, replacement) ⇒ Object
Instance Method Details
#fetch_symbols(str) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/mathml2latex/xslt_functions.rb', line 18 def fetch_symbols(str) ret_str = '' str.each_char do |character| key = character.chr.ord val = Mathml2latex::SYMBOLS[key] val = character if val.nil? ret_str << val end ret_str end |
#matches(str, regex_str, flag = '') ⇒ Object
12 13 14 15 16 |
# File 'lib/mathml2latex/xslt_functions.rb', line 12 def matches(str, regex_str, flag = '') str.downcase! if flag == 'i' regex = Regexp.new(regex_str) !(str =~ regex).nil? end |
#replace(str, regex_str, replacement) ⇒ Object
7 8 9 10 |
# File 'lib/mathml2latex/xslt_functions.rb', line 7 def replace(str, regex_str, replacement) regex = Regexp.new(regex_str) str.gsub(regex, replacement) end |