wikiparser-node 1.12.2 → 1.12.3

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.
@@ -33,13 +33,21 @@ const isStartCol = (rowLayout, i, oneCol) => {
33
33
  const coords = rowLayout[i];
34
34
  return rowLayout[i - 1] !== coords && (!oneCol || rowLayout[i + 1] !== coords);
35
35
  };
36
- function occupied(layout, i, oneRow, cells) {
36
+ /**
37
+ * 起点位于第`i`行的单元格序号
38
+ * @param layout 表格布局
39
+ * @param i 行号
40
+ * @param oneRow 是否要求单元格跨行数为1
41
+ * @param cells 改行全部单元格
42
+ * @throws `RangeError` 表格布局不包含第`i`行
43
+ */
44
+ const occupied = (layout, i, oneRow, cells) => {
37
45
  const rowLayout = layout[i];
38
46
  if (rowLayout) {
39
47
  return rowLayout.map(({ row, column }, j) => row === i && (!oneRow || cells[column]?.rowspan === 1) ? j : undefined).filter((j) => j !== undefined);
40
48
  }
41
49
  throw new RangeError(`The table layout does not contain row ${i}!`);
42
- }
50
+ };
43
51
  /**
44
52
  * 设置表格格式
45
53
  * @param cells 单元格
package/dist/lib/title.js CHANGED
@@ -246,7 +246,7 @@ class Title {
246
246
  }
247
247
  /** @private */
248
248
  getTitleAttr() {
249
- return this.title.replace(/Media:/u, '').replace(/["_]/gu, p => p === '"' ? '"' : ' ');
249
+ return this.title.replace(/^Media:/u, '').replace(/["_]/gu, p => p === '"' ? '"' : ' ');
250
250
  }
251
251
  }
252
252
  exports.Title = Title;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wikiparser-node",
3
- "version": "1.12.2",
3
+ "version": "1.12.3",
4
4
  "description": "A Node.js parser for MediaWiki markup with AST",
5
5
  "keywords": [
6
6
  "mediawiki",