@wdprlib/parser 3.1.0 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -10440,6 +10440,15 @@ async function resolveIncludesAsync(source, fetcher, options) {
10440
10440
  return expandIterativeAsync(source, cachedFetcher, maxIterations);
10441
10441
  }
10442
10442
  var INCLUDE_OPEN_PATTERN = /^\[\[include\s/gim;
10443
+ function hasAttributes(innerSoFar) {
10444
+ if (innerSoFar.includes("|"))
10445
+ return true;
10446
+ const trimmed = innerSoFar.trimStart();
10447
+ const ws = trimmed.search(/\s/);
10448
+ if (ws === -1)
10449
+ return false;
10450
+ return trimmed.slice(ws).trim().length > 0;
10451
+ }
10443
10452
  function isRestOfLineBlank(source, pos) {
10444
10453
  for (let i = pos;i < source.length; i++) {
10445
10454
  const ch = source[i];
@@ -10481,6 +10490,12 @@ function scanIncludeDirectives(source) {
10481
10490
  depth--;
10482
10491
  i += 2;
10483
10492
  if (depth <= 0) {
10493
+ const innerSoFar = source.slice(contentStart, closeStart);
10494
+ if (hasAttributes(innerSoFar)) {
10495
+ while (i < source.length && source[i] === "]") {
10496
+ i++;
10497
+ }
10498
+ }
10484
10499
  const onOpenerLine = firstNewline === -1 || closeStart < firstNewline;
10485
10500
  if (onOpenerLine || isRestOfLineBlank(source, i)) {
10486
10501
  closeEnd = i;
package/dist/index.js CHANGED
@@ -10383,6 +10383,15 @@ async function resolveIncludesAsync(source, fetcher, options) {
10383
10383
  return expandIterativeAsync(source, cachedFetcher, maxIterations);
10384
10384
  }
10385
10385
  var INCLUDE_OPEN_PATTERN = /^\[\[include\s/gim;
10386
+ function hasAttributes(innerSoFar) {
10387
+ if (innerSoFar.includes("|"))
10388
+ return true;
10389
+ const trimmed = innerSoFar.trimStart();
10390
+ const ws = trimmed.search(/\s/);
10391
+ if (ws === -1)
10392
+ return false;
10393
+ return trimmed.slice(ws).trim().length > 0;
10394
+ }
10386
10395
  function isRestOfLineBlank(source, pos) {
10387
10396
  for (let i = pos;i < source.length; i++) {
10388
10397
  const ch = source[i];
@@ -10424,6 +10433,12 @@ function scanIncludeDirectives(source) {
10424
10433
  depth--;
10425
10434
  i += 2;
10426
10435
  if (depth <= 0) {
10436
+ const innerSoFar = source.slice(contentStart, closeStart);
10437
+ if (hasAttributes(innerSoFar)) {
10438
+ while (i < source.length && source[i] === "]") {
10439
+ i++;
10440
+ }
10441
+ }
10427
10442
  const onOpenerLine = firstNewline === -1 || closeStart < firstNewline;
10428
10443
  if (onOpenerLine || isRestOfLineBlank(source, i)) {
10429
10444
  closeEnd = i;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdprlib/parser",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "Parser for Wikidot markup",
5
5
  "keywords": [
6
6
  "ast",