浏览代码

Merge pull request #2080 from mateusdeap/main

Remove parent divs only once for each `ul` element
Simon Legner 1 年之前
父节点
当前提交
6c81f97d79
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      lib/docs/filters/cppref/clean_html.rb

+ 3 - 2
lib/docs/filters/cppref/clean_html.rb

@@ -19,8 +19,9 @@ module Docs
           node.before(node.children).remove
           node.before(node.children).remove
         end
         end
 
 
-        css('div > ul').each do |node|
-          node.parent.before(node.parent.children).remove
+        parents = css('div > ul').map(&:parent).uniq
+        parents.each do |parent|
+          parent.before(parent.children).remove
         end
         end
 
 
         css('dl > dd:first-child:last-child > ul:first-child:last-child').each do |node|
         css('dl > dd:first-child:last-child > ul:first-child:last-child').each do |node|