Update grammar to yield the results in the examples

Change-Id: I5c546e8b80cd7668dce5867b5cabd7940765410e
This commit is contained in:
Arlo Breault 2017-09-20 12:58:11 -04:00
parent e7323c051b
commit 7759c1ede2
2 changed files with 3 additions and 3 deletions

View file

@ -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 = " "

View file

@ -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',