lib/stepmod/utils/converters/sub.rb in stepmod-utils-0.2.4 vs lib/stepmod/utils/converters/sub.rb in stepmod-utils-0.2.5
- old
+ new
@@ -4,10 +4,18 @@
module Utils
module Converters
class Sub < ReverseAdoc::Converters::Base
def convert(node, state = {})
content = treat_children(node, state)
+ return stem_notation(content) if node.parent.name == 'eqn'
+
"#{content[/^\s*/]}~#{content.strip}~#{content[/\s*$/]}"
+ end
+
+ private
+
+ def stem_notation(content)
+ "_{#{content}}"
end
end
ReverseAdoc::Converters.register :sub, Sub.new
end
\ No newline at end of file