module Ritex::MathML
As many MathML-specific aspected of Ritex
are stored in this module as possible. Note that the rdoc documentation for this module is woefully incorrect because we programmatically modify the globals in this package.
Constants
- DEFAULTS
Default entities, mostly stolen from www.orcca.on.ca/mathml/texmml/texmml.xml. We overwrite many of these below.
- ENTITIES
- ENVS
“environments”–things that require strings, i.e. where spaces matter.
- FUNCTIONS
- GREEK
greek letters
- MARKUP
A simple mapping between markup elements used in parser.y and actual
MathML
elements.- MATH_FUNCTIONS
functions
- NOTATION
notation (“MO”)
- NUMS
numbers
- OPERATORS
regular operators (“MOL” in itex2MML parlance)
- SPACES
spaces
- TOKENS
- UNARY_OPERATORS
unary operators (“MOB”)
Public Class Methods
Generate a hash table of entities from a shorthand version involving a hash table and an array.
- element
-
the HTML element to wrap the entities with
- opts
-
arguments to the opening HTML element
# File lib/ritex/mathml/entities.rb, line 532 def generate(element, opts, hash={}, array=[]) ret = {} endt = "</#{element}>" startt = unless opts.nil? || opts.empty? "<#{element} #{opts}>" else "<#{element}>" end array.each do |e| if Array === e e.each { |i| ret[i] = "#{startt}&#{e.last};#{endt}" } else ret[e] = "#{startt}&#{e};#{endt}" end end hash.each do |e, v| if Array === e e.each { |i| ret[i] = "#{startt}&#{v};#{endt}" } else ret[e] = "#{startt}&#{v};#{endt}" end end ret end
# File lib/ritex/mathml/functions.rb, line 21 def lookup *a; [:lookup, a] end
# File lib/ritex/mathml/functions.rb, line 20 def markup *a; [:markup, a] end
Private Instance Methods
Generate a hash table of entities from a shorthand version involving a hash table and an array.
- element
-
the HTML element to wrap the entities with
- opts
-
arguments to the opening HTML element
# File lib/ritex/mathml/entities.rb, line 532 def generate(element, opts, hash={}, array=[]) ret = {} endt = "</#{element}>" startt = unless opts.nil? || opts.empty? "<#{element} #{opts}>" else "<#{element}>" end array.each do |e| if Array === e e.each { |i| ret[i] = "#{startt}&#{e.last};#{endt}" } else ret[e] = "#{startt}&#{e};#{endt}" end end hash.each do |e, v| if Array === e e.each { |i| ret[i] = "#{startt}&#{v};#{endt}" } else ret[e] = "#{startt}&#{v};#{endt}" end end ret end
# File lib/ritex/mathml/functions.rb, line 21 def lookup *a; [:lookup, a] end
# File lib/ritex/mathml/functions.rb, line 20 def markup *a; [:markup, a] end