Method: IsoDoc::ClassUtils#start_of_sentence
- Defined in:
- lib/isodoc/class_utils.rb
#start_of_sentence(node) ⇒ Object
node is at the start of sentence in a Metanorma XML context
78 79 80 81 82 83 84 85 |
# File 'lib/isodoc/class_utils.rb', line 78 def start_of_sentence(node) prec = [] # all text nodes before node nearest_block_parent(node).traverse do |x| x == node and break x.text? and prec << x end prec.empty? || /(?!<[^.].)\.\s+$/.match(prec.map(&:text).join) end |