@vannizhang/living-atlas-content-validator 1.5.9 → 1.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,8 +12,6 @@ const isEmpty_1 = require("../util/isEmpty");
|
|
|
12
12
|
const getScoringRules_1 = require("../util/getScoringRules");
|
|
13
13
|
const stringsConfig_1 = require("../util/stringsConfig");
|
|
14
14
|
const scoringConfig_1 = require("./scoringConfig");
|
|
15
|
-
const findDataSource_1 = require("./findDataSource");
|
|
16
|
-
const checkIsLayer_1 = require("../util/checkIsLayer");
|
|
17
15
|
/**
|
|
18
16
|
* Validate an item's description. A valid description must meet these rules below:
|
|
19
17
|
*
|
|
@@ -33,8 +31,8 @@ const checkIsLayer_1 = require("../util/checkIsLayer");
|
|
|
33
31
|
*/
|
|
34
32
|
const isValidDescription = (item) => {
|
|
35
33
|
const { description } = item;
|
|
36
|
-
// check and see if the input item is Layer
|
|
37
|
-
const isLayer =
|
|
34
|
+
// // check and see if the input item is Layer
|
|
35
|
+
// const isLayer = checkIsLayer(item);
|
|
38
36
|
// scoring rules locale
|
|
39
37
|
const locale = (0, getScoringRules_1.getScoringRulesLocale)(item.culture);
|
|
40
38
|
let weightFactors = scoringConfig_1.scoringConfig.weightFactors.DEFAULT;
|
|
@@ -45,10 +43,10 @@ const isValidDescription = (item) => {
|
|
|
45
43
|
// for non-english items, use the International weight factors
|
|
46
44
|
weightFactors = scoringConfig_1.scoringConfig.weightFactors.INTERNATIONAL;
|
|
47
45
|
}
|
|
48
|
-
else if (isLayer) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
46
|
+
// else if (isLayer) {
|
|
47
|
+
// // for Layers, use the Layers weight factors
|
|
48
|
+
// weightFactors = scoringConfig.weightFactors.LAYERS;
|
|
49
|
+
// }
|
|
52
50
|
// // scoring rules
|
|
53
51
|
// const SCORING = getScoringRules(item, scoringRulesConfig);
|
|
54
52
|
const stringsConfig = (0, stringsConfig_1.getStringsConfig)();
|
|
@@ -69,11 +67,11 @@ const isValidDescription = (item) => {
|
|
|
69
67
|
weightFactor: 0,
|
|
70
68
|
critical: true,
|
|
71
69
|
};
|
|
72
|
-
/**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const shouldCheckDataSource = locale === 'en' && isLayer;
|
|
70
|
+
// /**
|
|
71
|
+
// * We should check the Description and see if it contains key words like "Data Source" or similar
|
|
72
|
+
// * for all layer items (English-based)
|
|
73
|
+
// */
|
|
74
|
+
// const shouldCheckDataSource = locale === 'en' && isLayer;
|
|
77
75
|
// remove html tags
|
|
78
76
|
const sanitizedStr = (0, sanitize_html_1.default)(description, {
|
|
79
77
|
allowedTags: [],
|
|
@@ -117,16 +115,15 @@ const isValidDescription = (item) => {
|
|
|
117
115
|
// issues.score += SCORING.MIN_LENGTH_SCORE;
|
|
118
116
|
issues.weightFactor += weightFactors.MIN_LENGTH_FACTOR;
|
|
119
117
|
}
|
|
120
|
-
// For non-internation items that are also Layers, we need to check if the description
|
|
121
|
-
// contains the key word similar to "data source"
|
|
122
|
-
if (shouldCheckDataSource &&
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
118
|
+
// // For non-internation items that are also Layers, we need to check if the description
|
|
119
|
+
// // contains the key word similar to "data source"
|
|
120
|
+
// if (shouldCheckDataSource && containsDataSource(description) === false) {
|
|
121
|
+
// issues.messages.push({
|
|
122
|
+
// message: stringsConfig.description.CONTAINS_SOURCE_MESSAGE,
|
|
123
|
+
// });
|
|
124
|
+
// } else {
|
|
125
|
+
// issues.weightFactor += weightFactors.HAS_SOURCE;
|
|
126
|
+
// }
|
|
130
127
|
if (locale === 'international') {
|
|
131
128
|
issues.critical = false;
|
|
132
129
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isValidDescription.js","sourceRoot":"","sources":["../../../src/lib/description/isValidDescription.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAyC;AACzC,yDAAyD;AACzD,uDAAoD;AACpD,+DAA4D;AAC5D,6CAA0C;AAC1C,6DAGiC;AAEjC,yDAAyD;AACzD,mDAAgD;
|
|
1
|
+
{"version":3,"file":"isValidDescription.js","sourceRoot":"","sources":["../../../src/lib/description/isValidDescription.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAyC;AACzC,yDAAyD;AACzD,uDAAoD;AACpD,+DAA4D;AAC5D,6CAA0C;AAC1C,6DAGiC;AAEjC,yDAAyD;AACzD,mDAAgD;AAIhD;;;;;;;;;;;;;;;;GAgBG;AACI,MAAM,kBAAkB,GAAG,CAAC,IAAW,EAAkB,EAAE;IAC9D,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;IAE7B,8CAA8C;IAC9C,sCAAsC;IAEtC,uBAAuB;IACvB,MAAM,MAAM,GAAG,IAAA,uCAAqB,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEnD,IAAI,aAAa,GAAG,6BAAa,CAAC,aAAa,CAAC,OAAO,CAAC;IACxD,kBAAkB;IAClB,4CAA4C;IAC5C,mDAAmD;IAEnD,IAAI,MAAM,KAAK,IAAI,EAAE;QACjB,8DAA8D;QAC9D,aAAa,GAAG,6BAAa,CAAC,aAAa,CAAC,aAAa,CAAC;KAC7D;IACD,sBAAsB;IACtB,mDAAmD;IACnD,0DAA0D;IAC1D,IAAI;IAEJ,mBAAmB;IACnB,6DAA6D;IAE7D,MAAM,aAAa,GAAG,IAAA,gCAAgB,GAAE,CAAC;IAEzC,MAAM,MAAM,GAAmB;QAC3B,QAAQ,EAAE,aAAa;QACvB,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,KAAK;QACtC,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,KAAK;QACtC,YAAY;QACZ,mCAAmC;QACnC,iCAAiC;QACjC,iCAAiC;QACjC,8BAA8B;QAC9B,qCAAqC;QACrC,QAAQ,EAAE,CAAC;Q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