lib/pione/literate-action/parser.rb in pione-0.4.1 vs lib/pione/literate-action/parser.rb in pione-0.4.2
- old
+ new
@@ -32,21 +32,25 @@
end
end
private
- # Find a rule name from the element.
+ # Find a rule name from the document element.
def find_rule_name(elt)
if elt.type == :header and elt.options[:level] == 2
elt.options[:raw_text]
end
end
- # Find an action from the element.
+ # Find an action from the document element.
def find_action(elt)
if elt.type == :codeblock
if elt.attr["class"] and elt.attr["class"].start_with?("language-")
+ # with language
return [elt.attr["class"].sub("language-", ""), elt.value]
+ else
+ # without language
+ return [nil, elt.value]
end
end
end
end
end