mirror of
https://github.com/Kornstalx/5etools-mirror-2.github.io.git
synced 2025-10-28 20:45:35 -05:00
v1.203.0
This commit is contained in:
@@ -89,6 +89,7 @@ class CreatureParser extends BaseParser {
|
||||
if (!nxtLine) return false;
|
||||
|
||||
if (ConvertUtil.isNameLine(nxtLine)) return false; // avoid absorbing the start of traits
|
||||
if (ConvertUtil.isListItemLine(nxtLine)) return false;
|
||||
if (this._NO_ABSORB_TITLES.some(it => nxtLine.toUpperCase().includes(it))) return false;
|
||||
if (this._NO_ABSORB_SUBTITLES.some(it => nxtLine.toUpperCase().startsWith(it))) return false;
|
||||
|
||||
@@ -745,7 +746,7 @@ class CreatureParser extends BaseParser {
|
||||
for (let i = 0; i < block.entries.length; ++i) {
|
||||
const curLine = block.entries[i];
|
||||
|
||||
if (typeof curLine !== "string" || !curLine.trim().endsWith(":")) continue;
|
||||
if (typeof curLine !== "string") continue;
|
||||
|
||||
let lst = null;
|
||||
let offset = 1;
|
||||
@@ -756,13 +757,14 @@ class CreatureParser extends BaseParser {
|
||||
if (typeof nxtLine !== "string" || !/^[•●]/.test(nxtLine.trim())) break;
|
||||
|
||||
nxtLine = nxtLine.replace(/^[•●]\s*/, "");
|
||||
const listItem = this._doMergeBulletedLists_getListItem(nxtLine);
|
||||
|
||||
if (!lst) {
|
||||
lst = {type: "list", items: [nxtLine]};
|
||||
lst = {type: "list", items: [listItem]};
|
||||
block.entries[i + offset] = lst;
|
||||
offset++;
|
||||
} else {
|
||||
lst.items.push(nxtLine);
|
||||
lst.items.push(listItem);
|
||||
block.entries.splice(i + offset, 1);
|
||||
}
|
||||
}
|
||||
@@ -770,6 +772,17 @@ class CreatureParser extends BaseParser {
|
||||
});
|
||||
}
|
||||
|
||||
static _doMergeBulletedLists_getListItem (str) {
|
||||
if (!ConvertUtil.isNameLine(str)) return str;
|
||||
|
||||
const {name, entry} = ConvertUtil.splitNameLine(str);
|
||||
return {
|
||||
type: "item",
|
||||
name,
|
||||
entry,
|
||||
};
|
||||
}
|
||||
|
||||
static _mutAssignPrettyType ({obj, type}) {
|
||||
const tmp = {...obj};
|
||||
Object.keys(obj).forEach(k => delete obj[k]);
|
||||
|
||||
Reference in New Issue
Block a user