Skip to content

Commit 8cc4302

Browse files
committed
fix(isc): array field continuation lines and split boundaries
- parse_array_field joins continuation lines with space (was newline) - Preserves first-line split for single heredoc items - Only splits on explicit - markers Result: 269/289 deep equivalent
1 parent 61c421f commit 8cc4302

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

lib/interscript/isc/document_builder.rb

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,20 @@ def unescape_braces(text)
7979

8080
def parse_array_field(val)
8181
return [] if val.nil? || val.to_s.strip.empty?
82-
# If the value contains newlines or `- ` markers, split into items
83-
items = val.to_s.split(/\n+/)
84-
.map { |l| l.strip.sub(/\A-\s*/, "") }
85-
.reject(&:empty?)
86-
return [val.to_s.strip] if items.empty?
87-
items
82+
text = val.to_s
83+
return [text.strip] unless text.include?("\n-")
84+
# Multi-line YAML list: merge continuation lines (joined with space)
85+
items = []
86+
current = nil
87+
text.lines.each do |l|
88+
stripped = l.strip
89+
if stripped.start_with?("- ")
90+
items << stripped[2..]
91+
elsif !stripped.empty? && items.any?
92+
items[-1] += " " + stripped
93+
end
94+
end
95+
items.empty? ? [text.strip] : items
8896
end
8997

9098
def normalize_heredoc(text)

0 commit comments

Comments
 (0)