@wdprlib/parser 3.1.1 → 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,15 +10440,23 @@ 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];
10446
10455
  if (ch === `
10447
10456
  `)
10448
10457
  return true;
10449
- if (ch === " " || ch === "\t" || ch === "\r" || ch === "]")
10450
- continue;
10451
- return false;
10458
+ if (ch !== " " && ch !== "\t" && ch !== "\r")
10459
+ return false;
10452
10460
  }
10453
10461
  return true;
10454
10462
  }
@@ -10482,6 +10490,12 @@ function scanIncludeDirectives(source) {
10482
10490
  depth--;
10483
10491
  i += 2;
10484
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
+ }
10485
10499
  const onOpenerLine = firstNewline === -1 || closeStart < firstNewline;
10486
10500
  if (onOpenerLine || isRestOfLineBlank(source, i)) {
10487
10501
  closeEnd = i;
package/dist/index.js CHANGED
@@ -10383,15 +10383,23 @@ 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];
10389
10398
  if (ch === `
10390
10399
  `)
10391
10400
  return true;
10392
- if (ch === " " || ch === "\t" || ch === "\r" || ch === "]")
10393
- continue;
10394
- return false;
10401
+ if (ch !== " " && ch !== "\t" && ch !== "\r")
10402
+ return false;
10395
10403
  }
10396
10404
  return true;
10397
10405
  }
@@ -10425,6 +10433,12 @@ function scanIncludeDirectives(source) {
10425
10433
  depth--;
10426
10434
  i += 2;
10427
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
+ }
10428
10442
  const onOpenerLine = firstNewline === -1 || closeStart < firstNewline;
10429
10443
  if (onOpenerLine || isRestOfLineBlank(source, i)) {
10430
10444
  closeEnd = i;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdprlib/parser",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "Parser for Wikidot markup",
5
5
  "keywords": [
6
6
  "ast",