schematex 0.9.15 → 0.9.16

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.
@@ -21,6 +21,8 @@ var ParseError = class extends Error {
21
21
  };
22
22
  var COUPLE_OPS = [
23
23
  { token: "~/~", type: "cohabiting-ended" },
24
+ { token: "~x~", type: "divorced" },
25
+ // the form the grammar advertises; `-x-` is the ASCII alias
24
26
  { token: "-//", type: "separated" },
25
27
  // alias for -/-
26
28
  { token: "-x-", type: "divorced" },
@@ -37,6 +39,16 @@ var VALID_STATUS = /* @__PURE__ */ new Set([
37
39
  "miscarriage",
38
40
  "abortion"
39
41
  ]);
42
+ var STATUS_ALIASES = {
43
+ stillbirth: "stillborn",
44
+ stillbirths: "stillborn",
45
+ miscarried: "miscarriage",
46
+ miscarry: "miscarriage",
47
+ aborted: "abortion",
48
+ dead: "deceased",
49
+ died: "deceased",
50
+ decd: "deceased"
51
+ };
40
52
  var SPECIAL_CHILD_PROPS = /* @__PURE__ */ new Set([
41
53
  "adopted",
42
54
  "foster",
@@ -456,8 +468,8 @@ function buildIndividual(id, propsStr, lineNum, lineText) {
456
468
  const tokenLower = token.toLowerCase();
457
469
  if (VALID_SEX.has(tokenLower)) {
458
470
  individual.sex = tokenLower;
459
- } else if (VALID_STATUS.has(tokenLower)) {
460
- individual.status = tokenLower;
471
+ } else if (VALID_STATUS.has(tokenLower) || STATUS_ALIASES[tokenLower]) {
472
+ individual.status = STATUS_ALIASES[tokenLower] ?? tokenLower;
461
473
  } else if (tokenLower === "index") {
462
474
  if (!individual.markers) individual.markers = [];
463
475
  individual.markers.push("index-person");
@@ -467,6 +479,8 @@ function buildIndividual(id, propsStr, lineNum, lineText) {
467
479
  if (!individual.label || individual.label === id) individual.label = "?";
468
480
  } else if (SPECIAL_CHILD_PROPS.has(tokenLower) || tokenLower === "guardian") {
469
481
  continue;
482
+ } else if (/^\d{1,3}$/.test(tokenLower)) {
483
+ individual.age = parseInt(token, 10);
470
484
  } else if (/^\d{4}$/.test(tokenLower)) {
471
485
  if (individual.birthYear !== void 0) {
472
486
  individual.deathYear = parseInt(token, 10);
@@ -553,7 +567,7 @@ function parseConditions(raw, lineNum, lineText) {
553
567
  const parts = raw.split("+").map((s) => s.trim());
554
568
  const conditions = [];
555
569
  for (const part of parts) {
556
- const match = part.match(/^([a-zA-Z0-9_-]+)\(([^)]+)\)$/);
570
+ const match = part.match(/^([^(]+)\(([^)]+)\)$/);
557
571
  if (!match) {
558
572
  throw new ParseError(
559
573
  `Invalid condition format '${part}'. Expected: name(fill) or name(fill, #color)`,
@@ -562,7 +576,8 @@ function parseConditions(raw, lineNum, lineText) {
562
576
  lineText
563
577
  );
564
578
  }
565
- const [, label, innerRaw] = match;
579
+ const label = match[1].trim();
580
+ const innerRaw = match[2];
566
581
  const innerParts = innerRaw.split(",").map((s) => s.trim());
567
582
  const fill = innerParts[0];
568
583
  const color = innerParts[1];
@@ -2737,5 +2752,5 @@ exports.layoutGenogram = layoutGenogram;
2737
2752
  exports.parseGenogram = parseGenogram;
2738
2753
  exports.renderGenogram = renderGenogram;
2739
2754
  exports.renderIndividualSymbol = renderIndividualSymbol;
2740
- //# sourceMappingURL=chunk-CYBBBBMZ.cjs.map
2741
- //# sourceMappingURL=chunk-CYBBBBMZ.cjs.map
2755
+ //# sourceMappingURL=chunk-PG7TOHPZ.cjs.map
2756
+ //# sourceMappingURL=chunk-PG7TOHPZ.cjs.map