lib/review/index_builder.rb in review-5.3.0 vs lib/review/index_builder.rb in review-5.4.0

- old
+ new

@@ -99,15 +99,11 @@ @sec_counter.inc(level) return if level < 2 cursor = level - 2 - if label - @headline_stack[cursor] = label - else - @headline_stack[cursor] = caption - end + @headline_stack[cursor] = (label || caption) if @headline_stack.size > cursor + 1 @headline_stack = @headline_stack.take(cursor + 1) end item_id = @headline_stack.join('|') @@ -121,15 +117,11 @@ check_id(label) return if level < 2 cursor = level - 2 - if label - @headline_stack[cursor] = label - else - @headline_stack[cursor] = caption - end + @headline_stack[cursor] = (label || caption) if @headline_stack.size > cursor + 1 @headline_stack = @headline_stack.take(cursor + 1) end item_id = @headline_stack.join('|') @@ -145,15 +137,11 @@ check_id(label) return if level < 2 cursor = level - 2 - if label - @headline_stack[cursor] = label - else - @headline_stack[cursor] = caption - end + @headline_stack[cursor] = (label || caption) if @headline_stack.size > cursor + 1 @headline_stack = @headline_stack.take(cursor + 1) end item_id = @headline_stack.join('|') @@ -169,14 +157,10 @@ check_id(label) return if level < 2 cursor = level - 2 - if label - @headline_stack[cursor] = label - else - @headline_stack[cursor] = caption - end + @headline_stack[cursor] = (label || caption) if @headline_stack.size > cursor + 1 @headline_stack = @headline_stack.take(cursor + 1) end item_id = @headline_stack.join('|')