tpmkms_4wp 8.9.1-beta.5 → 8.9.1-beta.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/common/animals.instance.json +195 -52
- package/common/articles.js +17 -1
- package/common/articles.test.json +338 -0
- package/common/colors.instance.json +210 -81
- package/common/comparable.instance.json +45 -0
- package/common/countable.js +1 -7
- package/common/countable.test.json +0 -586
- package/common/crew.instance.json +390 -104
- package/common/dimension.instance.json +11 -40
- package/common/edible.instance.json +352 -130
- package/common/emotions.instance.json +15 -60
- package/common/errors.js +2 -0
- package/common/fastfood.instance.json +1773 -1064
- package/common/formulas.instance.json +11 -1
- package/common/gdefaults.js +8 -5
- package/common/help.test.json +4 -4
- package/common/kirk.instance.json +15 -0
- package/common/length.instance.json +165 -20
- package/common/math.instance.json +11 -1
- package/common/ordering.instance.json +31 -55
- package/common/people.instance.json +120 -0
- package/common/pipboy.instance.json +187 -154
- package/common/pokemon.instance.json +195 -5
- package/common/pressure.instance.json +44 -7
- package/common/properties.instance.json +15 -44
- package/common/reports.instance.json +23 -3
- package/common/spock.instance.json +15 -0
- package/common/temperature.instance.json +44 -8
- package/common/ui.instance.json +11 -1
- package/common/weight.instance.json +132 -16
- package/common/wp.instance.json +1669 -170
- package/common/wp.js +57 -27
- package/common/wp.test.json +28343 -2847
- package/package.json +2 -2
package/common/wp.js
CHANGED
@@ -17,12 +17,18 @@ const instance = require('./wp.instance.json')
|
|
17
17
|
after
|
18
18
|
bold the first word of every paragraph
|
19
19
|
bold the first letter of every word
|
20
|
+
bold the first letter of every word that starts with t
|
21
|
+
bold the first letter of the words that start with t in the third paragraph
|
20
22
|
|
21
23
|
after
|
22
24
|
make the words that start with t blue
|
23
25
|
|
24
26
|
the bolded words that start with t
|
25
27
|
|
28
|
+
replace better with worse
|
29
|
+
|
30
|
+
change underlines to bolds
|
31
|
+
|
26
32
|
start inserting text until I say banana
|
27
33
|
...
|
28
34
|
or
|
@@ -112,37 +118,54 @@ let config = {
|
|
112
118
|
};
|
113
119
|
|
114
120
|
const changeState = ({api, isA, context, toArray, element, state}) => {
|
115
|
-
let unit = root(context.element.marker)
|
116
121
|
let scope
|
117
122
|
let conditions = []
|
118
123
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
124
|
+
const getElement = (selector, update) => {
|
125
|
+
const unit = root(selector.marker)
|
126
|
+
let scope;
|
127
|
+
const condition = []
|
128
|
+
if (selector.ordinal) {
|
129
|
+
conditions.push({ ordinals: toArray(selector.ordinal).map((context) => context.value)})
|
130
|
+
} else if (isA(selector, 'everything')) {
|
131
|
+
scope = 'all'
|
132
|
+
} else if (selector.quantity) {
|
133
|
+
scope = selector.quantity.quantity
|
134
|
+
} if (selector.distributer) {
|
135
|
+
scope = selector.distributer.value
|
136
|
+
}
|
126
137
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
138
|
+
if (selector.conditions) {
|
139
|
+
for (const condition of selector.conditions) {
|
140
|
+
if (condition.marker == 'wordComparisonWith_wp') {
|
141
|
+
// with or not with that is the question
|
142
|
+
const letters = condition.letters.letters.text
|
143
|
+
conditions.push({ comparison: condition.comparison, letters })
|
144
|
+
} else if (condition.marker == 'wordComparison_wp') {
|
145
|
+
// with or not with that is the question
|
146
|
+
const letters = condition.letters.text
|
147
|
+
conditions.push({ comparison: condition.comparison, letters })
|
148
|
+
} else if (isA(condition, 'styleModifier_wp')) {
|
149
|
+
for (const style of toArray(condition)) {
|
150
|
+
conditions.push({ hasStyle: style.marker })
|
151
|
+
}
|
140
152
|
}
|
141
153
|
}
|
142
154
|
}
|
155
|
+
|
156
|
+
if (selector.context) {
|
157
|
+
debugger
|
158
|
+
for (const context of toArray(selector.context)) {
|
159
|
+
getElement(context, update)
|
160
|
+
}
|
161
|
+
}
|
162
|
+
|
163
|
+
update.selectors.push({ unit, scope, conditions })
|
143
164
|
}
|
144
165
|
|
145
|
-
const update = {
|
166
|
+
const update = { selectors: [] }
|
167
|
+
getElement(context.element, update)
|
168
|
+
|
146
169
|
setUpdate(isA, update, toArray(context.state))
|
147
170
|
api.changeState(update)
|
148
171
|
}
|
@@ -150,9 +173,9 @@ const changeState = ({api, isA, context, toArray, element, state}) => {
|
|
150
173
|
template = {
|
151
174
|
configs: [
|
152
175
|
'setidsuffix _wp',
|
153
|
-
'words are countable orderable and statefulElements',
|
154
|
-
'characters are countable orderable and statefulElements',
|
155
|
-
'paragraphs are countable orderable and statefulElement',
|
176
|
+
'words are countable distributable orderable textContainers and statefulElements',
|
177
|
+
'characters are countable distributable orderable and statefulElements',
|
178
|
+
'paragraphs are countable distributable orderable textContainers and statefulElement',
|
156
179
|
'text is a statefulElement',
|
157
180
|
'letters means characters',
|
158
181
|
'bold, italic, code, capitalize, lowercase and underline are styles',
|
@@ -174,8 +197,15 @@ template = {
|
|
174
197
|
"((word_wp/*) [wordComparison_wp] (a/0)? (letters))",
|
175
198
|
// this one is "the bolded/underlined/italized/... word"
|
176
199
|
"((styleModifier_wp/*) [modifiedByStyle_wp] (statefulElement_wp/* && context.determiner == undefined))",
|
200
|
+
// the first letter of each paragraph
|
201
|
+
"((statefulElement_wp/*) <statefulElementInContext_wp|of> (statefulElement_wp/*))",
|
177
202
|
],
|
178
203
|
bridges: [
|
204
|
+
{
|
205
|
+
id: 'statefulElementInContext_wp',
|
206
|
+
parents: ['preposition'],
|
207
|
+
bridge: "{ ...before[0], context: append(before[0].context, [after[0]]), generate: [before[0], operator, after[0]] }",
|
208
|
+
},
|
179
209
|
{
|
180
210
|
id: 'modifiedByStyle_wp',
|
181
211
|
// parents: ['verb'],
|
@@ -270,7 +300,7 @@ template = {
|
|
270
300
|
},
|
271
301
|
],
|
272
302
|
priorities: [
|
273
|
-
|
303
|
+
{ "context": [['changeState_wp',0], ['every', 0], ['word_wp', 1], ['list', 1]], ordered: true, choose: [1] },
|
274
304
|
{ "context": [['changeState_wp',0], ['statefulElement_wp', 0], ['list', 0]], ordered: true, choose: [0] },
|
275
305
|
{ "context": [['comparisonWith_wp',0], ['unknown', 0], ['list', 1]], ordered: true, choose: [0] },
|
276
306
|
],
|
@@ -293,7 +323,7 @@ knowledgeModule({
|
|
293
323
|
contents: wp_tests,
|
294
324
|
checks: {
|
295
325
|
context: [
|
296
|
-
...defaultContextCheck(),
|
326
|
+
...defaultContextCheck(['distributer', 'subject', 'element', 'letters', 'target', 'conditions' ]),
|
297
327
|
],
|
298
328
|
objects: [
|
299
329
|
'changeState',
|