tpmkms_4wp 8.9.1-beta.2 → 8.9.1

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/wp.js CHANGED
@@ -9,8 +9,6 @@ const wp_tests = require('./wp.test.json')
9
9
  const instance = require('./wp.instance.json')
10
10
 
11
11
  /*
12
- the bolded words that start with t
13
-
14
12
  start inserting text until I say banana
15
13
  ...
16
14
  or
@@ -19,16 +17,12 @@ const instance = require('./wp.instance.json')
19
17
  make the text of the 1st to 3rd paragraphs blue
20
18
 
21
19
 
22
- make the words that start with a bold
23
-
24
20
  make every word bold and underlines and blue -> weirdly "bold underlined and blue" works
25
21
 
26
22
  make the font ...
27
23
  make the color blue
28
24
  make the color of the first paragraph blue
29
25
 
30
- undeline the bolded text / the text that is bolded
31
-
32
26
  words that start with a
33
27
  make all the bold text uppercase
34
28
  underline all the bold text
@@ -43,12 +37,6 @@ const instance = require('./wp.instance.json')
43
37
  in the first paragraph make the words that start with abc bold
44
38
  bold the first three words that start with t
45
39
  bold much and many
46
- make the words that start with t bold and underlined
47
- make all the capital letters|punctuation bold
48
-
49
- move this paragraph up 2
50
- move the next paragraph up 1
51
- move the last paragraph before this one
52
40
  */
53
41
 
54
42
  class API {
@@ -101,16 +89,11 @@ const changeState = ({api, isA, context, toArray, element, state}) => {
101
89
  let conditions = []
102
90
  if (isA(context.element, 'everything')) {
103
91
  scope = 'all'
104
- } else if (context.element.conditions) {
105
- const condition = context.element.conditions[0]
106
- if (condition.marker == 'wordComparisonWith_wp') {
107
- // with or not with that is the question
92
+ } else if (context.element.condition) {
93
+ const condition = context.element.condition
94
+ if (condition.marker == 'start_wp') {
108
95
  const letters = condition.letters.letters.text
109
- conditions.push({ comparison: condition.comparison, letters })
110
- } else if (condition.marker == 'wordComparison_wp') {
111
- // with or not with that is the question
112
- const letters = condition.letters.text
113
- conditions.push({ comparison: condition.comparison, letters })
96
+ conditions.push({ comparison: 'prefix', letters })
114
97
  }
115
98
  } else {
116
99
  scope = context.element.quantity.quantity
@@ -125,61 +108,47 @@ template = {
125
108
  'setidsuffix _wp',
126
109
  'words are countable and statefulElements',
127
110
  'characters are countable',
128
- 'paragraphs are countable and statefulElement',
129
- 'text is a statefulElement',
111
+ 'paragraphs are countable',
130
112
  'bold, italic, code, capitalize, lowercase and underline are styles',
131
113
  'underlined means underline',
132
114
  'capitalized means capitalize',
133
115
  'uppercase means capitalize',
134
116
  'italicize means italic',
135
117
  'italicized means italic',
136
- // TODO have a mode where I can stay this is a definition sentence then just say style modifies and it will do it right
137
- 'capitalized, bolded, italicized and underlined are styleModifiers',
138
- // 'start end and contain are wordComparisonWiths',
139
118
  // 'styles are negatable',
140
119
  "resetIdSuffix",
141
120
  {
142
121
  operators: [
122
+ // TODO write a parser for this so I can use statefulElement as the id
123
+ "(<thatVerb|that> (verb/0))",
143
124
  "([changeState_wp|make] ([statefulElement_wp]) ([stateValue_wp|]))",
144
125
  "((style_wp/*) [applyStyle_wp] ([statefulElement_wp|]))",
145
- "((word_wp/*) [wordComparisonWith_wp] ([comparisonWith_wp|with] (a/0)? (letters)))",
146
- "((word_wp/*) [wordComparison_wp] (a/0)? (letters))",
147
- "((styleModifier_wp/*) [modifiedByStyle_wp] (statefulElement_wp/*))",
126
+ "((word_wp/*) [start_wp] ([startsWith_wp|with] (a/0)? (letters)))",
148
127
  ],
149
128
  bridges: [
150
129
  {
151
- id: 'modifiedByStyle_wp',
152
- parents: ['adjective'],
153
- convolution: true,
154
- bridge: "{ ...after[0], style: before[0], target: after[0], generate: ['style', 'target'], conditions: append(after[0].conditions, [before[0]]) }",
130
+ id: 'thatVerb',
131
+ // before: ['verb'],
132
+ bridge: "{ ...after[0], verb: after[0], that: operator, generate: ['that', 'verb'], localPriorities: { before: [\"verb\"] }, bridge_override: { operator: after[0].marker, bridge: '{ ...bridge.subject, postModifiers: [\"condition\"], condition: bridge }' } }",
133
+ /*
134
+ semantic: (args) => {
135
+ changeState({...args, element: args.context.element, state: args.context.state})
136
+ }
137
+ */
155
138
  },
156
139
  {
157
- id: 'wordComparisonWith_wp',
140
+ id: 'start_wp',
158
141
  parents: ['verb'],
159
- words: [
160
- { word: 'start', comparison: 'prefix' },
161
- { word: 'starts', comparison: 'prefix', },
162
- { word: 'end', comparison: 'suffix' },
163
- { word: 'ends', comparison: 'suffix' },
164
- ],
142
+ words: ['start', 'starts'],
165
143
  bridge: "{ ...next(operator), element: before[0], subject: before[0], letters: after[0], verb: operator, generate: ['element', 'verb', 'letters'] }",
144
+ /*
145
+ semantic: (args) => {
146
+ changeState({...args, element: args.context.element, state: args.context.state})
147
+ }
148
+ */
166
149
  },
167
150
  {
168
- id: 'wordComparison_wp',
169
- parents: ['verb'],
170
- words: [
171
- { word: 'contain', comparison: 'include' },
172
- { word: 'contains', comparison: 'include' },
173
- { word: 'include', comparison: 'include' },
174
- { word: 'includes', comparison: 'include' },
175
- ],
176
- optional: {
177
- 1: "{ marker: 'a' }",
178
- },
179
- bridge: "{ ...next(operator), element: before[0], subject: before[0], letters: after[1], verb: operator, generate: ['element', 'verb', 'letters'] }",
180
- },
181
- {
182
- id: 'comparisonWith_wp',
151
+ id: 'startsWith_wp',
183
152
  parents: ['preposition'],
184
153
  optional: {
185
154
  1: "{ marker: 'a' }",
@@ -241,7 +210,6 @@ template = {
241
210
  ],
242
211
  priorities: [
243
212
  { "context": [['changeState_wp',0], ['statefulElement_wp', 0], ['list', 0]], ordered: true, choose: [0] },
244
- { "context": [['comparisonWith_wp',0], ['unknown', 0], ['list', 1]], ordered: true, choose: [0] },
245
213
  ],
246
214
  },
247
215
  // "([changeState_wp|make] ([statefulElement_wp]) ([stateValue_wp|]))",