From 43779e110a00f5aafd8e5c7dde5092bb02883887 Mon Sep 17 00:00:00 2001 From: kree Date: Thu, 6 Aug 2026 20:36:15 -0400 Subject: [PATCH] me: 1 documentation: 0 --- src/util/gin.ts | 4 ++++ test/util/gin.test.ts | 8 +++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/util/gin.ts b/src/util/gin.ts index 0b9d36a..039a9a8 100644 --- a/src/util/gin.ts +++ b/src/util/gin.ts @@ -61,6 +61,10 @@ function _parse(text: string, root: Node): Node { const j = open.pop()!; textNode.endIndex = j; + + if (textNode.startIndex! > 0 && text.charAt(textNode.startIndex!) == '\n') { + textNode.startIndex!++; + } textNode.text = text.substring(textNode.startIndex!, textNode.endIndex!) switch (scope.type) { diff --git a/test/util/gin.test.ts b/test/util/gin.test.ts index cadd526..9941bf1 100644 --- a/test/util/gin.test.ts +++ b/test/util/gin.test.ts @@ -41,7 +41,6 @@ Josie`; const expected = `Dear Aunt Mildred, - It was a pleasure to see you at the wedding. Thank you for the lovely bone china tea set. @@ -49,7 +48,6 @@ Best wishes, Josie Dear Uncle John, - It is a shame you couldn't make it to the wedding. Thank you for the lovely moleskin pants. @@ -57,15 +55,15 @@ Best wishes, Josie Dear Cousin Rodney, - It is a shame you couldn't make it to the wedding. Best wishes, Josie` - const actual = data.map(r => Gin.execute(template, r)).join('\n'); - console.log(actual) + const actual = data.map(r => Gin.execute(template, r)).join('\n\n'); + console.debug(Gin.execute(template, data[0])) expect(actual).toEqual(expected); + }) // it('parseGlob', async () => {