From 7759c1ede2507ac30f73a51b808a34ef8f172e3e Mon Sep 17 00:00:00 2001 From: Arlo Breault Date: Wed, 20 Sep 2017 12:58:11 -0400 Subject: [PATCH] Update grammar to yield the results in the examples Change-Id: I5c546e8b80cd7668dce5867b5cabd7940765410e --- Specification.md | 4 ++-- TemplateDataBlob.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Specification.md b/Specification.md index f0c38218..5e2e2e5b 100644 --- a/Specification.md +++ b/Specification.md @@ -284,8 +284,8 @@ The key corresponds to the name of a Consumer variable that relates to the speci A format string describes how whitespace should be added to a template instantiation in wikitext. A format string looks like `{{_|_=_}}`, with optional whitespace and extended underscores. Formally, its structure is given by the following grammar: ``` FormatString = StartFormat ParameterFormat EndFormat -StartFormat = nl? "{{" ws* Hole ws* -ParameterFormat = nl? "|" nl? ws* Hole ws* "=" ws* Hole +StartFormat = nl? "{{" ws* Hole +ParameterFormat = nl? ws* "|" nl? ws* Hole ws* "=" ws* Hole EndFormat = nl? ws* "}}" nl? Hole = "_"+ ws = " " diff --git a/TemplateDataBlob.php b/TemplateDataBlob.php index e06bcd8e..c0248028 100644 --- a/TemplateDataBlob.php +++ b/TemplateDataBlob.php @@ -172,7 +172,7 @@ class TemplateDataBlob { $data->format; if ( !is_string( $f ) || - !preg_match( '/^\n?\{\{ *_+ *\n?\|\n? *_+ *= *_+\n? *\}\}\n?$/', $f ) + !preg_match( '/^\n?\{\{ *_+\n? *\|\n? *_+ *= *_+\n? *\}\}\n?$/', $f ) ) { return Status::newFatal( 'templatedata-invalid-format',