From 297cfb622c62e90753463692386551449179c008 Mon Sep 17 00:00:00 2001 From: Liliana Marie Prikler Date: Thu, 20 Jan 2022 11:21:37 +0100 Subject: [PATCH] recfmt: Allow curly-brace markup in template. 2022-01-20 Liliana Marie Prikler * utils/recfmt.c (recfmt_apply_template): Add open brace as excluded character in regexp. * torture/utils/recfmt.sh (recfmt-curly): New test. --- torture/utils/recfmt.sh | 11 +++++++++++ utils/recfmt.c | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/torture/utils/recfmt.sh b/torture/utils/recfmt.sh index 9acdc40..f127408 100755 --- a/torture/utils/recfmt.sh +++ b/torture/utils/recfmt.sh @@ -127,6 +127,17 @@ value21 value22value23 value31 value32value33 ' +# Apply a template containing curly-brace markup. +test_tool recfmt-curly ok \ + recfmt \ + '"\def\field1{{{field1}}} +"' \ + multiple-records \ +'\def\field1{value11} +\def\field1{value21} +\def\field1{value31} +' + # Try to apply an empty slot. test_tool recfmt-empty-slot xfail \ recfmt \ diff --git a/utils/recfmt.c b/utils/recfmt.c index 7c0b5fa..082e0f5 100644 --- a/utils/recfmt.c +++ b/utils/recfmt.c @@ -174,7 +174,7 @@ recfmt_apply_template (rec_record_t record, slot with the empty string. */ - if (regcomp (®exp, "\\{\\{" "[^}]*" "\\}\\}", REG_EXTENDED) != 0) + if (regcomp (®exp, "\\{\\{" "[^{}]*" "\\}\\}", REG_EXTENDED) != 0) recutl_fatal (_("recfmt_apply_template: error compiling regexp.\ Please report this.\n")); -- 2.34.0