Method: IsoDoc::WordFunction::Comments#reorder_comments_by_comment_link

Defined in:
lib/isodoc/word_function/comments.rb


139
140
141
142
143
144
145
146
147
# File 'lib/isodoc/word_function/comments.rb', line 139

def reorder_comments_by_comment_link(docxml)
  link_order = {}
  docxml.xpath(COMMENT_TARGET_XREFS1).each_with_index do |target, i|
    link_order[target.value] = i
  end
  comments = get_comments_from_text(docxml, link_order)
  list = docxml.at("//*[@style='mso-element:comment-list']") || return
  list.children = comments.map { |c| c[:text] }.join("\n")
end