From eae920f21fa8d19aabaf26834160275b66d7b639 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 10 Apr 2023 17:03:10 +0200 Subject: [PATCH] fixes found while testing --- src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 72fccba..72f75d7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -98,7 +98,7 @@ export const parse = async function(file: FileHandle, strict = true) { } if (line.slice(0, TOC_PREFIX_TAG.length) === TOC_PREFIX_TAG) { - const tagData = line.slice(TOC_PREFIX_TAG.length+1).split(TOC_TAG_DELIMITER) + const tagData = line.slice(TOC_PREFIX_TAG.length).split(TOC_TAG_DELIMITER) if(tagData.length !== 2){ if(strict){ throw new Error(`Tag could not be parsed: ${tagData}`) @@ -173,14 +173,14 @@ export const parse = async function(file: FileHandle, strict = true) { if(Object.keys(WOW_LOCALES).includes(locale)){ result.TitleLocalized[locale as WOW_LOCALES] = tagValue } else if(strict){ - throw new Error(`locale not found ${locale}`) + throw new Error(`Locale not found: ${locale}`) } } else if(tagName.toLowerCase().startsWith(TOC_TAG_PREFIX_NOTESLOCALIZED) && tagName.length === TOC_TAG_PREFIX_NOTESLOCALIZED.length+4){ const locale = tagName.slice(TOC_TAG_PREFIX_NOTESLOCALIZED.length,TOC_TAG_PREFIX_NOTESLOCALIZED.length+4) if(Object.keys(WOW_LOCALES).includes(locale)){ result.NotesLocalized[locale as WOW_LOCALES] = tagValue } else if(strict){ - throw new Error(`locale not found ${locale}`) + throw new Error(`Locale not found: ${locale}`) } } else if(tagName.toLowerCase().startsWith(TOC_TAG_PREFIX_DEP)){ result.Dependencies = tagValue.split(TOC_TAG_LIST_DELIMITER).map((s) => s.trim()) @@ -190,7 +190,7 @@ export const parse = async function(file: FileHandle, strict = true) { throw new Error(`Unknown Tag name: ${tagName}`) } } - } else if (line.slice(0, 1) !== TOC_PREFIX_COMMENT && !line.trim()) { + } else if (line.slice(0, 1) !== TOC_PREFIX_COMMENT && line.trim()) { result.files.push(line.trimEnd()); } }