Use range offsets instead of quote for substitution

This commit is contained in:
Amaia Castro
2017-02-10 15:55:03 +01:00
parent b298fb7316
commit 4cb1bba5a7

View File

@@ -29,7 +29,7 @@ class Legislation::Annotation < ActiveRecord::Base
doc = Nokogiri::HTML(html) doc = Nokogiri::HTML(html)
selector = "/#{range_start}" selector = "/#{range_start}"
text = doc.xpath(selector).text text = doc.xpath(selector).text
text[quote] = "<span class=annotator-hl>#{quote}</span>" text[range_start_offset .. range_end_offset-1] = "<span class=annotator-hl>#{quote}</span>"
self.context = text self.context = text
end end