Skip to content

Commit

Permalink
Merge pull request #142 from unfoldingWord/RJHimprovements
Browse files Browse the repository at this point in the history
Next round of improvements to markdown checks
  • Loading branch information
mandolyte authored Feb 10, 2021
2 parents 79c9680 + 449499b commit 5410897
Show file tree
Hide file tree
Showing 33 changed files with 1,153 additions and 1,047 deletions.
170 changes: 86 additions & 84 deletions noticeList.txt

Large diffs are not rendered by default.

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.1.1",
"version": "1.1.2",
"private": false,
"homepage": "https://unfoldingword.github.io/uw-content-validation/",
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4176,7 +4176,7 @@ Object {
"C": "2",
"V": "12",
"bookID": "RUT",
"details": "need to carefully check [\\"[Doublet](../figs-doublet/01.md)\\"]",
"details": "need to carefully check \\"[Doublet](../figs-doublet/01.md)\\"",
"extra": "TN",
"fieldName": "OccurrenceNote",
"filename": "en_tn_08-RUT.tsv",
Expand Down
8 changes: 4 additions & 4 deletions src/__tests__/__snapshots__/tn-table-row-check.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ Object {
"C": "1",
"V": "6",
"bookID": "GEN",
"details": "need to carefully check [\\"[[rc://*/ta/man/figs-parallelism]]\\"]",
"details": "need to carefully check \\"[[rc://*/ta/man/figs-parallelism]]\\"",
"fieldName": "OccurrenceNote",
"location": " that was supplied",
"message": "Unusual [[ ]] link(s)—not normal TA or TW links",
Expand Down Expand Up @@ -853,7 +853,7 @@ Object {
"C": "2",
"V": "12",
"bookID": "RUT",
"details": "need to carefully check [\\"[Doublet](../figs-doublet/01.md)\\"]",
"details": "need to carefully check \\"[Doublet](../figs-doublet/01.md)\\"",
"fieldName": "OccurrenceNote",
"location": " that was supplied",
"message": "Unusual [ ]( ) link(s)—not normal Bible or TN links",
Expand Down Expand Up @@ -937,7 +937,7 @@ Object {
"C": "1",
"V": "7",
"bookID": "GEN",
"details": "need to carefully check [\\"[[rc://*/ta/woman/figs-imperative]]\\"]",
"details": "need to carefully check \\"[[rc://*/ta/woman/figs-imperative]]\\"",
"fieldName": "OccurrenceNote",
"location": " that was supplied",
"message": "Unusual [[ ]] link(s)—not normal TA or TW links",
Expand Down Expand Up @@ -1009,7 +1009,7 @@ Object {
"C": "1",
"V": "9",
"bookID": "GEN",
"details": "need to carefully check [\\"[Genesis 1:7](../01/zzz.md)\\"]",
"details": "need to carefully check \\"[Genesis 1:7](../01/zzz.md)\\"",
"fieldName": "OccurrenceNote",
"location": " that was supplied",
"message": "Unusual [ ]( ) link(s)—not normal Bible or TN links",
Expand Down
18 changes: 8 additions & 10 deletions src/core/BCS-usfm-grammar-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DEFAULT_EXTRACT_LENGTH } from './text-handling-functions'
import { userLog, parameterAssert } from './utilities';


// const USFM_GRAMMAR_VALIDATOR_VERSION_STRING = '0.3.2';
// const USFM_GRAMMAR_VALIDATOR_VERSION_STRING = '0.3.3';


export function runBCSGrammarCheck(strictnessString, fileText, filename, givenLocation, checkingOptions) {
Expand Down Expand Up @@ -83,7 +83,7 @@ export function runBCSGrammarCheck(strictnessString, fileText, filename, givenLo

// Save our line number
if (lineNumberString && lineNumberString.length) {
/*
// ourErrorObject.lineNumber = Number(lineNumberString);
// but we need a temporary fix for the BCS bug which doesn’t include blank lines in the count
let lineNumber = Number(lineNumberString)
let notified = false;
Expand All @@ -99,8 +99,6 @@ export function runBCSGrammarCheck(strictnessString, fileText, filename, givenLo
}
}
ourErrorObject.lineNumber = lineNumber;
*/
ourErrorObject.lineNumber = Number(lineNumberString);
}
}

Expand Down Expand Up @@ -140,19 +138,19 @@ export function checkUSFMGrammar(bookID, strictnessString, filename, givenText,
const cugResult = { successList: [], noticeList: [] };

function addSuccessMessage(successString) {
// debugLog(`checkUSFMGrammar success: ${successString}`);
// functionLog(`checkUSFMGrammar success: ${successString}`);
cugResult.successList.push(successString);
}
function addNotice6to7(noticeObject) {
/**
* @description - adds a new notice entry, adding bookID,C,V to the given fields
* @param {Number} priority - notice priority from 1 (lowest) to 999 (highest)
* @param {String} message - the text of the notice message
* @param {string} message - the text of the notice message
* @param {Number} characterIndex - where the issue occurs in the line
* @param {String} extract - short extract from the line centred on the problem (if available)
* @param {String} location - description of where the issue is located
* @param {string} extract - short extract from the line centred on the problem (if available)
* @param {string} location - description of where the issue is located
*/
// debugLog(`checkUSFMGrammar notice: (priority=${priority}) ${message}${characterIndex > 0 ? ` (at character ${characterIndex})` : ""}${extract ? ` ${extract}` : ""}${location}`);
// functionLog(`checkUSFMGrammar notice: (priority=${priority}) ${message}${characterIndex > 0 ? ` (at character ${characterIndex})` : ""}${extract ? ` ${extract}` : ""}${location}`);
parameterAssert(noticeObject.priority !== undefined, "cUSFMgr addNotice6to7: 'priority' parameter should be defined");
parameterAssert(typeof noticeObject.priority === 'number', `cUSFMgr addNotice6to7: 'priority' parameter should be a number not a '${typeof noticeObject.priority}': ${noticeObject.priority}`);
parameterAssert(noticeObject.message !== undefined, "cUSFMgr addNotice6to7: 'message' parameter should be defined");
Expand Down Expand Up @@ -187,7 +185,7 @@ export function checkUSFMGrammar(bookID, strictnessString, filename, givenText,

addSuccessMessage(`Checked USFM Grammar (${strictnessString} mode) ${grammarCheckResult.isValidUSFM ? "without errors" : " (but the USFM DIDN’T validate)"}`);
// debugLog(` checkUSFMGrammar returning with ${result.successList.length.toLocaleString()} success(es) and ${result.noticeList.length.toLocaleString()} notice(s).`);
// debugLog(`checkUSFMGrammar result is ${JSON.stringify(result)}`);
// functionLog(`checkUSFMGrammar result is ${JSON.stringify(result)}`);
return cugResult;
}
// end of checkUSFMGrammar function
Loading

0 comments on commit 5410897

Please sign in to comment.