diff --git a/main.js b/main.js index 7121a03f..be3041d9 100644 --- a/main.js +++ b/main.js @@ -23681,6 +23681,12 @@ function makeWiki(wikiQ, str) { } return copy; } +function dropWikilinks(str) { + let copy = str.slice(); + if (copy.startsWith("[[") && copy.endsWith("]]")) + copy = copy.slice(2, -2); + return copy; +} /** * Get all the fields in `dir`. * Returns all fields if `dir === 'all'` @@ -50090,10 +50096,11 @@ class BCPlugin extends require$$0.Plugin { const rowObj = {}; row .split(",") - .map((head) => head.trim()) + .map((head) => dropWikilinks(head.trim())) .forEach((item, i) => { rowObj[headers[i]] = item; }); + loglevel.debug({ rowObj }); CSVRows.push(rowObj); }); return CSVRows; diff --git a/src/main.ts b/src/main.ts index 6e28c125..316b1408 100644 --- a/src/main.ts +++ b/src/main.ts @@ -40,7 +40,6 @@ import { addEdgeIfNot, addNodesIfNot, getFieldInfo, - getInNeighbours, getOppDir, getOppFields, getReflexiveClosure, @@ -60,8 +59,7 @@ import type { } from "./interfaces"; import { createOrUpdateYaml, - // debugGroupEnd, - // debugGroupStart, + dropWikilinks, getBaseFromPath, getDVBasename, getFields, @@ -495,10 +493,11 @@ export default class BCPlugin extends Plugin { const rowObj = {}; row .split(",") - .map((head) => head.trim()) + .map((head) => dropWikilinks(head.trim())) .forEach((item, i) => { rowObj[headers[i]] = item; }); + debug({ rowObj }); CSVRows.push(rowObj); }); return CSVRows; diff --git a/src/sharedFunctions.ts b/src/sharedFunctions.ts index c2478a48..0bd1f84f 100644 --- a/src/sharedFunctions.ts +++ b/src/sharedFunctions.ts @@ -138,6 +138,12 @@ export function makeWiki(wikiQ: boolean, str: string) { return copy; } +export function dropWikilinks(str: string) { + let copy = str.slice(); + if (copy.startsWith("[[") && copy.endsWith("]]")) copy = copy.slice(2, -2); + return copy; +} + /** * Get all the fields in `dir`. * Returns all fields if `dir === 'all'`