lib/hemingway/math/math.treetop in hemingway-0.0.2 vs lib/hemingway/math/math.treetop in hemingway-0.0.3
- old
+ new
@@ -3,19 +3,23 @@
module Hemingway
grammar Math
# Example: $ \Pi = 3.14159 $
rule math
- math_start symbol math_end <MathNode>
+ math_start content:( symbol / exponent ) math_end <MathNode>
end
# Example : \Pi
# Notes:
# - Once again, math_symbol need not have an html method defined on it.
# When .html is called on symbol, it knows the match is actually a
# math_symbol, so that is what symbol.html is actually calling.
rule symbol
math_symbol
+ end
+
+ rule exponent
+ "^{" value:( "\\circ" / text ) "}" <ExponentNode>
end
rule math_start
"$"
end
\ No newline at end of file