diff --git a/.changeset/itchy-eyes-make.md b/.changeset/itchy-eyes-make.md new file mode 100644 index 0000000..739060a --- /dev/null +++ b/.changeset/itchy-eyes-make.md @@ -0,0 +1,8 @@ +--- +"gedcom": patch +--- + +Allow all text in plain text fields + +Plaintext fields (CONC, CONT, and NOTE) all allow any kind of text +and do not match for pointers. diff --git a/lib/parse-to-unist.test.ts b/lib/parse-to-unist.test.ts index ea3b4a8..754b9d8 100644 --- a/lib/parse-to-unist.test.ts +++ b/lib/parse-to-unist.test.ts @@ -287,13 +287,15 @@ test("parser - concatenation", () => { ); }); -test("parser - concatenation", () => { - expect(() => { +test("parser - concatenation with @ symbols", () => { + expect( parse(` 0 SOUR Waters, Henry F., Genealogical Gleanings in England: Abstracts of W 1 CONC ills Relating to Early American Families. 2 vols., reprint 1901, 190 -1 CONC @123@`).children[0].data?.value; - }).toThrow(); +1 CONC @123@`).children[0].data?.value, + ).toEqual( + "Waters, Henry F., Genealogical Gleanings in England: Abstracts of Wills Relating to Early American Families. 2 vols., reprint 1901, 190@123@", + ); }); test("parser - error, too large a jump", (t) => { diff --git a/lib/tokenize.ts b/lib/tokenize.ts index 439727d..b5129c3 100644 --- a/lib/tokenize.ts +++ b/lib/tokenize.ts @@ -71,10 +71,11 @@ export function tokenize(buf: string, lineNumber: number): Line { if (xref_id) line.xref_id = xref_id; + const plaintext = tag === "CONC" || tag === "CONT" || tag === "NOTE"; const delim = buf.match(rDelim); if (delim) { buf = buf.substring(delim[0].length); - const pointer_match = buf.match(rPointer); + const pointer_match = !plaintext && buf.match(rPointer); const value_match = buf.match(rLineItem); if (pointer_match) { line.pointer = pointer_match[0];