wikibase-cli 15.15.5 → 15.15.6
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.
- package/lib/minimize_claims.js +1 -0
- package/lib/output_templates.js +1 -0
- package/lib/summary_parser.js +10 -6
- package/package.json +1 -1
package/lib/minimize_claims.js
CHANGED
|
@@ -9,6 +9,7 @@ const minimizeSnaks = snaks => {
|
|
|
9
9
|
if (!propSnaks) return
|
|
10
10
|
snaks[property] = propSnaks.map(snak => {
|
|
11
11
|
if (snak.snaktype === 'value') delete snak.snaktype
|
|
12
|
+
if (snak.rank === 'normal') delete snak.rank
|
|
12
13
|
if (snak.qualifiers) {
|
|
13
14
|
minimizeSnaks(snak.qualifiers)
|
|
14
15
|
if (Object.keys(snak.qualifiers).length === 0) delete snak.qualifiers
|
package/lib/output_templates.js
CHANGED
|
@@ -12,6 +12,7 @@ const simplifyOptions = {
|
|
|
12
12
|
keepRichValues: true,
|
|
13
13
|
keepNonTruthy: true,
|
|
14
14
|
keepSnaktypes: true,
|
|
15
|
+
keepRanks: true,
|
|
15
16
|
// No need to keep the hashes as every edited claim (identified with a GUID)
|
|
16
17
|
// will have it's qualifiers and references fully overriden
|
|
17
18
|
keepHashes: false
|
package/lib/summary_parser.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const entityAttributeParser = require('../lib/entity_attribute_parser')
|
|
2
2
|
const { simplify } = require('wikibase-sdk')
|
|
3
3
|
const logClaims = require('../lib/log_claims')
|
|
4
|
-
const { bgGreen, bgBlue, grey } = require('chalk')
|
|
4
|
+
const { bgGreen, bgMagenta, bgBlue, grey, white } = require('chalk')
|
|
5
5
|
const _ = require('lodash')
|
|
6
6
|
const { mainProps } = require('../lib/properties')
|
|
7
7
|
const errors_ = require('../lib/errors')
|
|
@@ -37,19 +37,23 @@ const parseEntity = async (entity, params) => {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
const { lang, program } = params
|
|
40
|
-
const { type } = entity
|
|
40
|
+
const { type, datatype } = entity
|
|
41
|
+
|
|
42
|
+
if (datatype) {
|
|
43
|
+
console.log(bgMagenta(white('Datatype')), datatype)
|
|
44
|
+
}
|
|
41
45
|
|
|
42
46
|
if (type === 'item' || type === 'property') {
|
|
43
47
|
const label = entityAttributeParser(entity, 'label', lang)
|
|
44
|
-
console.log(bgGreen('Label'), label)
|
|
48
|
+
console.log(bgGreen(white('Label')), label)
|
|
45
49
|
const description = entityAttributeParser(entity, 'description', lang)
|
|
46
|
-
if (description) console.log(bgBlue('Description'), description)
|
|
50
|
+
if (description) console.log(bgBlue(white('Description')), description)
|
|
47
51
|
} else if (type === 'lexeme') {
|
|
48
52
|
const lemma = entityAttributeParser(entity, 'lemma', lang)
|
|
49
|
-
console.log(bgGreen('Lemma'), lemma)
|
|
53
|
+
console.log(bgGreen(white('Lemma')), lemma)
|
|
50
54
|
entity.senses.forEach(sense => {
|
|
51
55
|
const glosse = entityAttributeParser(sense, 'glosse', lang)
|
|
52
|
-
console.log(bgBlue('Glosse'), glosse)
|
|
56
|
+
console.log(bgBlue(white('Glosse')), glosse)
|
|
53
57
|
})
|
|
54
58
|
}
|
|
55
59
|
|