Avoid repetition in getRawPathFromCell and fix up paths with bold/italic

This commit is contained in:
mtkennerly 2020-07-17 15:24:37 -04:00
parent 5bedaff845
commit f9fdb28d8b
3 changed files with 102 additions and 42 deletions

View file

@ -245,22 +245,14 @@ function getRawPathFromCell(cell: string | PathCell): [string, boolean] {
if (segment === undefined) {
break;
}
if (typeof segment === "string") {
composite += segment;
} else if (segment.type === "transclusion") {
const [stringified, segmentRegular] = stringifyTransclusionCell(segment);
if (!segmentRegular) {
regular = false;
}
composite += stringified;
} else if (segment.type === "tag") {
const [stringified, segmentRegular] = stringifyTagCell(segment);
if (!segmentRegular) {
regular = false;
}
composite += stringified;
const [stringified, segmentRegular] = getRawPathFromCell(segment);
if (!segmentRegular) {
regular = false;
}
composite += stringified;
}
} else if (cell.type !== "comment" && cell.type !== "page_title") {
regular = false;
}
return [composite.trim(), regular];