@@ -24,13 +24,13 @@ def types_de_champ_private = revision_types_de_champ_private.map(&:type_de_champ
2424 def types_de_champ_public_tree = to_tree_roots ( types_de_champ : types_de_champ_public )
2525 def types_de_champ_private_tree = to_tree_roots ( types_de_champ : types_de_champ_private )
2626
27- # Header sections in document order, as [type_de_champ, depth] pairs. Depth
28- # is the position in the tree; it can differ from the stored
27+ # Header sections and repetitions in document order, as [type_de_champ, depth]
28+ # pairs. Depth is the position in the tree; it can differ from the stored
2929 # header_section_level (used by heading tags via level_for_revision) when
3030 # levels are skipped.
31- def header_sections_with_depth ( is_private : false )
31+ def sections_with_depth ( is_private : false )
3232 tree = is_private ? types_de_champ_private_tree : types_de_champ_public_tree
33- flatten_header_sections ( tree , 1 )
33+ flatten_sections ( tree , 1 )
3434 end
3535
3636 has_one :draft_procedure , -> { with_discarded } , class_name : 'Procedure' , foreign_key : :draft_revision_id , dependent : :nullify , inverse_of : :draft_revision
@@ -349,9 +349,9 @@ def apply_llm_rule_suggestion_items(changes)
349349
350350 private
351351
352- def flatten_header_sections ( types_de_champ , depth )
353- types_de_champ . filter ( & : header_section?) . flat_map do |tdc |
354- [ [ tdc , depth ] , *flatten_header_sections ( tdc . children ( self ) , depth + 1 ) ]
352+ def flatten_sections ( types_de_champ , depth )
353+ types_de_champ . filter { it . header_section? || it . repetition? } . flat_map do |tdc |
354+ [ [ tdc , depth ] , *flatten_sections ( tdc . children ( self ) , depth + 1 ) ]
355355 end
356356 end
357357
0 commit comments