@diagrammo/dgmo 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,6 +44,37 @@ export const TITLE_RE = /^title\s*:\s*(.+)/i;
44
44
  /** Matches `option: value` header lines. */
45
45
  export const OPTION_RE = /^([a-z][a-z0-9-]*)\s*:\s*(.+)$/i;
46
46
 
47
+ /**
48
+ * Collect indented continuation lines as individual values.
49
+ * Used when a property like `series:` has an empty value — subsequent
50
+ * indented lines each become one value entry.
51
+ *
52
+ * - Skips blank lines and `//` comment lines within the block
53
+ * - Stops at first non-indented non-empty line (or EOF)
54
+ * - Strips trailing commas from values (user habit tolerance)
55
+ * - Returns `newIndex` so caller does `i = newIndex` and the loop's `i++` lands correctly
56
+ */
57
+ export function collectIndentedValues(
58
+ lines: string[],
59
+ startIndex: number,
60
+ ): { values: string[]; newIndex: number } {
61
+ const values: string[] = [];
62
+ let j = startIndex + 1;
63
+ for (; j < lines.length; j++) {
64
+ const raw = lines[j];
65
+ const trimmed = raw.trim();
66
+ // Skip blank lines within the block
67
+ if (!trimmed) continue;
68
+ // Skip comment lines within the block
69
+ if (trimmed.startsWith('//')) continue;
70
+ // Stop at non-indented lines (first char is not whitespace)
71
+ if (raw[0] !== ' ' && raw[0] !== '\t') break;
72
+ // Strip trailing comma and collect
73
+ values.push(trimmed.replace(/,\s*$/, ''));
74
+ }
75
+ return { values, newIndex: j - 1 };
76
+ }
77
+
47
78
  /** Parse pipe-delimited metadata from segments after the first (name) segment. */
48
79
  export function parsePipeMetadata(
49
80
  segments: string[],