Method: IsoDoc::HtmlFunction::Comments#reorder_comments_by_comment_link

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


131
132
133
134
135
136
137
138
139
# File 'lib/isodoc/html_function/comments.rb', line 131

def reorder_comments_by_comment_link(docxml)
  link_order = {}
  docxml.xpath(COMMENT_TARGET_XREFS).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