Currently I'm parsing a HTML document using Nokogiri and iterating through all the code
tags like this:
html = Nokogiri::HTML(doc)
html.css("code").each do |code|
# do something with code
if /^@@@@/.match(code.text.split("\n")[0])
return "this code element is at line blah"
end
end
I don't have to use Nokogiri, it was just convenient to use to iterate through all the code elements.
In the case where the code
tag begins with @@@@
then I want to be able to reference the line number in the document where that code
tag occurred. Keep in mind that two code tags can be identical.