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