Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent 621 punct at end for UGNT ellipsis #128

Merged
merged 4 commits into from
Jan 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
22 changes: 0 additions & 22 deletions src/__tests__/__snapshots__/tn-table-row-check.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/tn-table-row-check.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down
5 changes: 3 additions & 2 deletions src/core/orig-quote-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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}'`);
Expand Down
41 changes: 22 additions & 19 deletions src/core/tn-links-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
}
Expand Down