Retain original element IDs for correct anchor links. Fixes #1721.
Unified · Split
| @@ -40,19 +40,6 @@ module Docs · 39 unmodified lines | ||
| 40 | 40 | node.content = node.content |
| 41 | 41 | end |
| 42 | 42 | |
| 43 | − css('h3 > code, h4 > code, h5 > code').each do |node| | |
| 44 | − tmp = node.content | |
| 45 | − has_parethesis = true if tmp =~ /\(/ | |
| 46 | − tmp.gsub!(/\(.*\)/, '') | |
| 47 | − | |
| 48 | − if has_parethesis | |
| 49 | − tmp << '()' | |
| 50 | − end | |
| 51 | − | |
| 52 | − node.parent['id'] = tmp | |
| 53 | − | |
| 54 | − end | |
| 55 | − | |
| 56 | 43 | doc |
| 57 | 44 | end |
| 58 | 45 | end |
| @@ -14,18 +14,20 @@ module Docs · 13 unmodified lines | ||
| 14 | 14 | entries = [] |
| 15 | 15 | |
| 16 | 16 | css('h3 > code, h4 > code, h5 > code').each do |node| |
| 17 | + name = node.content.gsub(/\(.*\)/, '()') | |
| 18 | + id = node.parent['id'] | |
| 17 | 19 | |
| 18 | 20 | case node.parent.child.content |
| 19 | 21 | when /Class/ |
| 20 | − entries << ["Class #{node.parent['id']}", node.parent['id'], type] | |
| 22 | + entries << ["Class #{name}", id, type] | |
| 21 | 23 | when /Event/ |
| 22 | − entries << ["Event #{node.parent['id']}", node.parent['id'], type] | |
| 24 | + entries << ["Event #{name}", id, type] | |
| 23 | 25 | end |
| 24 | 26 | |
| 25 | 27 | if node.parent.child.is_a?(Nokogiri::XML::Text) |
| 26 | 28 | next |
| 27 | 29 | else |
| 28 | − entries << [node.parent['id'], node.parent['id'], type] | |
| 30 | + entries << [name, id, type] | |
| 29 | 31 | end |
| 30 | 32 | |
| 31 | 33 | end |