diff --git a/package.json b/package.json index 515c1285..f81bee4d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "uw-content-validation", "description": "Functions for Checking Door43.org Scriptural Content/Resources.", - "version": "1.0.1", + "version": "1.0.2", "private": false, "homepage": "https://unfoldingword.github.io/uw-content-validation/", "repository": { diff --git a/src/__tests__/__snapshots__/tn-table-row-check.test.js.snap b/src/__tests__/__snapshots__/tn-table-row-check.test.js.snap index 76164802..bdd9aa12 100644 --- a/src/__tests__/__snapshots__/tn-table-row-check.test.js.snap +++ b/src/__tests__/__snapshots__/tn-table-row-check.test.js.snap @@ -890,17 +890,6 @@ Object { "priority": 885, "rowID": "zu6f", }, - Object { - "C": "1", - "V": "9", - "bookID": "GEN", - "extract": "[[rc://*/ta/man/translate/figs-activepassivez]]", - "fieldName": "OccurrenceNote", - "location": " that was supplied translate/figs-activepassivez/01.md", - "message": "Unable to find OccurrenceNote TA link", - "priority": 886, - "rowID": "zu6f", - }, Object { "C": "1", "V": "9", @@ -997,17 +986,6 @@ Object { "priority": 885, "rowID": "zu6f", }, - Object { - "C": "1", - "V": "9", - "bookID": "GEN", - "extract": "[[rc://*/ta/man/translate/figs-imperativez]]", - "fieldName": "OccurrenceNote", - "location": " that was supplied translate/figs-imperativez/01.md", - "message": "Unable to find OccurrenceNote TA link", - "priority": 886, - "rowID": "zu6f", - }, Object { "C": "1", "V": "9", diff --git a/src/__tests__/tn-table-row-check.test.js b/src/__tests__/tn-table-row-check.test.js index 57b19971..ff189688 100644 --- a/src/__tests__/tn-table-row-check.test.js +++ b/src/__tests__/tn-table-row-check.test.js @@ -87,14 +87,14 @@ describe('checkTN_TSVDataRow() - ', () => { it('should fail invalid first link', async() => { const chosenLine = "GEN\t1\t9\tzu6f\tfigs-activepassive\t\t0\tLet the waters…be gathered\tThis can be translated with an active verb. This is a command. By commanding that the waters gather together, God made them gather together. Alternate translation: “Let the waters…gather” or “Let the waters…come together” (See: [[rc://*/ta/man/translate/figs-activepassivez]] and [[rc://*/ta/man/translate/figs-imperative]])"; const rawResults = await checkTN_TSVDataRow(languageCode, chosenLine, 'GEN','1','9', 'that was supplied', optionalCheckingOptions); - expect(rawResults.noticeList.length).toEqual(6); + expect(rawResults.noticeList.length).toEqual(5); expect(rawResults).toMatchSnapshot(); }); it('should fail invalid second link', async() => { const chosenLine = "GEN\t1\t9\tzu6f\tfigs-activepassive\t\t0\tLet the waters…be gathered\tThis can be translated with an active verb. This is a command. By commanding that the waters gather together, God made them gather together. Alternate translation: “Let the waters…gather” or “Let the waters…come together” (See: [[rc://*/ta/man/translate/figs-activepassive]] and [[rc://*/ta/man/translate/figs-imperativez]])"; const rawResults = await checkTN_TSVDataRow(languageCode, chosenLine, 'GEN','1','9', 'that was supplied', optionalCheckingOptions); - expect(rawResults.noticeList.length).toEqual(5); + expect(rawResults.noticeList.length).toEqual(4); expect(rawResults).toMatchSnapshot(); }); diff --git a/src/core/orig-quote-check.js b/src/core/orig-quote-check.js index f2300e75..23a3d93d 100644 --- a/src/core/orig-quote-check.js +++ b/src/core/orig-quote-check.js @@ -4,7 +4,7 @@ import { cachedGetFile } from '../core/getApi'; import { ourParseInt } from './utilities'; -// const QUOTE_VALIDATOR_VERSION_STRING = '0.7.6'; +// const QUOTE_VALIDATOR_VERSION_STRING = '0.7.7'; export async function checkOriginalLanguageQuote(languageCode, fieldName, fieldText, occurrenceString, bookID, C, V, givenLocation, checkingOptions) { @@ -328,7 +328,8 @@ export async function checkOriginalLanguageQuote(languageCode, fieldName, fieldT addNotice({ priority: 620, message: "Seems original language quote might not start at the beginning of a word", details: `passage ⸢${verseText}⸣`, characterIndex: 0, extract, location: ourLocation }); } // Note: There's some Hebrew (RTL) characters at the beginning of the following regex - if (fieldText.slice(-1) !== ' ' && remainingBits[1] && remainingBits[1][0].search(/[^׃־A-Za-z\s.,:;?!–)]/) !== -1) { + if (fieldText.slice(-1) !== ' ' && remainingBits[1] && remainingBits[1][0].search(/[^׃־A-Za-z\s.,:;?!–)]…/) !== -1) { + // No problems if quote is followed by expected terminator-type punctuation // const badChar = remainingBits[1][0]; // const badCharString = ` by '${badChar}' {unicodedata.name(badChar)}={hex(ord(badChar))}`; // console.log(`Seems '${fieldText}' might not finish at the end of a word—it’s followed ${badCharString} in '${verseText}'`); diff --git a/src/core/tn-links-check.js b/src/core/tn-links-check.js index 4c1f8b52..f2a4706b 100644 --- a/src/core/tn-links-check.js +++ b/src/core/tn-links-check.js @@ -208,33 +208,36 @@ export async function checkTNLinksToOutside(bookID, givenC, givenV, fieldName, f // console.log(`Got tA filepath=${filepath}`); if (!checkingOptions?.disableAllLinkFetchingFlag) { - // console.log(`Need to check against ${taRepoName}`); + // console.log(`checkTNLinksToOutside: need to check against ${taRepoName}`); const taPathParameters = { username: taRepoUsername, repository: taRepoName, path: filepath, branch: taRepoBranch }; - let taFileContent; + let taFileContent, alreadyGaveError = false; try { taFileContent = await getFile_(taPathParameters); // console.log("Fetched fileContent for", taRepoName, filepath, typeof fileContent, fileContent.length); } catch (trcGCerror) { // console.error(`checkTNLinksToOutside(${bookID}, ${fieldName}, …) failed to load TA for '${taRepoUsername}', '${taRepoName}', '${filepath}', '${taRepoBranch}', ${trcGCerror.message}`); addNoticePartial({ priority: 885, message: `Error loading ${fieldName} TA link`, extract: regexResultArray[0], location: `${ourLocation} ${filepath}: ${trcGCerror}` }); + alreadyGaveError = true; } - if (!taFileContent) - addNoticePartial({ priority: 886, message: `Unable to find ${fieldName} TA link`, extract: regexResultArray[0], location: `${ourLocation} ${filepath}` }); - else if (taFileContent.length < 10) - addNoticePartial({ priority: 884, message: `Linked ${fieldName} TA article seems empty`, extract: regexResultArray[0], location: `${ourLocation} ${filepath}` }); - else if (checkingOptions?.checkLinkedTAArticleFlag === true) { - // console.log(`checkTNLinksToOutside got ${checkingOptions?.checkLinkedTAArticleFlag} so checking TA article: ${filepath}`); - if (await alreadyChecked(taPathParameters) !== true) { - // console.log(`checkTNLinksToOutside needs to check TA article: ${filepath}`); - const checkTAFileResult = await checkMarkdownText(languageCode, `TA ${regexResultArray[3]}.md`, taFileContent, ourLocation, checkingOptions); - for (const noticeObject of checkTAFileResult.noticeList) - ctarResult.noticeList.push({ ...noticeObject, username: taRepoUsername, repoCode: 'TA', repoName: taRepoName, filename: filepath, location: ` linked to${ourLocation}`, extra: 'TA' }); - ctarResult.checkedFileCount += 1; - ctarResult.checkedFilenames.push(`${regexResultArray[3]}.md`); - ctarResult.checkedFilesizes = taFileContent.length; - ctarResult.checkedFilenameExtensions = ['md']; - ctarResult.checkedRepoNames.push(taRepoName); - markAsChecked(taPathParameters); // don’t bother waiting for the result + if (!alreadyGaveError) { + if (!taFileContent) + addNoticePartial({ priority: 886, message: `Unable to find ${fieldName} TA link`, extract: regexResultArray[0], location: `${ourLocation} ${filepath}` }); + else if (taFileContent.length < 10) + addNoticePartial({ priority: 884, message: `Linked ${fieldName} TA article seems empty`, extract: regexResultArray[0], location: `${ourLocation} ${filepath}` }); + else if (checkingOptions?.checkLinkedTAArticleFlag === true) { + // console.log(`checkTNLinksToOutside got ${checkingOptions?.checkLinkedTAArticleFlag} so checking TA article: ${filepath}`); + if (await alreadyChecked(taPathParameters) !== true) { + // console.log(`checkTNLinksToOutside needs to check TA article: ${filepath}`); + const checkTAFileResult = await checkMarkdownText(languageCode, `TA ${regexResultArray[3]}.md`, taFileContent, ourLocation, checkingOptions); + for (const noticeObject of checkTAFileResult.noticeList) + ctarResult.noticeList.push({ ...noticeObject, username: taRepoUsername, repoCode: 'TA', repoName: taRepoName, filename: filepath, location: ` linked to${ourLocation}`, extra: 'TA' }); + ctarResult.checkedFileCount += 1; + ctarResult.checkedFilenames.push(`${regexResultArray[3]}.md`); + ctarResult.checkedFilesizes = taFileContent.length; + ctarResult.checkedFilenameExtensions = ['md']; + ctarResult.checkedRepoNames.push(taRepoName); + markAsChecked(taPathParameters); // don’t bother waiting for the result + } } } }