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.
Default entities, mostly stolen from www.orcca.on.ca/mathml/texmml/texmml.xml. We overwrite many of these below.
“environments”–things that require strings, i.e. where spaces matter.
greek letters
A simple mapping between markup elements used in parser.y and actual MathML elements.
functions
notation (“MO”)
numbers
regular operators (“MOL” in itex2MML parlance)
spaces
unary operators (“MOB”)
Generate a hash table of entities from a shorthand version involving a hash table and an array.
the HTML element to wrap the entities with
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
Generate a hash table of entities from a shorthand version involving a hash table and an array.
the HTML element to wrap the entities with
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