imdone-core 1.43.6 → 1.44.0

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/file.js CHANGED
@@ -176,6 +176,23 @@ File.parseDueDate = function (config, text) {
176
176
  })
177
177
  }
178
178
 
179
+ File.parseRemindDate = function (config, text) {
180
+ if (text.includes(`remind${config.getMetaSep()}`)) return text
181
+ let remindString
182
+ return text.replace(/(\sremind)\s.*?\./gi, (remindMatch, p1) => {
183
+ if (remindString) return remindMatch
184
+ try {
185
+ const remind = chrono.parseDate(remindMatch, new Date(), {forwardDate: true})
186
+ if (!remind) return remindMatch
187
+ remindString = getIsoDateWithOffset(remind)
188
+ return `${p1.toLowerCase()}${config.getMetaSep()}${remindString}`
189
+ } catch (e) {
190
+ console.log(`Unable to parse remind date for ${text}`)
191
+ return remindMatch
192
+ }
193
+ })
194
+ }
195
+
179
196
  function trackMarkdownChecklistChanges({task, config, modify}) {
180
197
  const doneList = config.getDoneList()
181
198
  let beforeTextModified = false
@@ -263,6 +280,7 @@ File.prototype.transformTask = function ({config, modify, task}) {
263
280
  })
264
281
  content = trackListChanges.content
265
282
  content = File.parseDueDate(config, content)
283
+ content = File.parseRemindDate(config, content)
266
284
  content = File.addCompleted({ task, content, config })
267
285
  if (
268
286
  content.trim() !== task.content.trim()
@@ -264,7 +264,7 @@ module.exports = class PluginManager extends Emitter {
264
264
  })
265
265
  }
266
266
 
267
- async onBeforeAddTask({path, list, content, tags, contexts, meta, addTemplate}) {
267
+ async onBeforeAddTask({path, list, content, tags, contexts, meta, useCardTemplate}) {
268
268
  await this.eachPluginAsync(async ({ pluginInstance }) => {
269
269
  try {
270
270
  const pluginMods = await pluginInstance.onBeforeAddTask({path, list, content, tags, contexts, meta, useCardTemplate})
package/lib/task.js CHANGED
@@ -291,7 +291,7 @@ Task.MetaRegExp = new RegExp(
291
291
  )
292
292
  Task.getMetaRegExp = function (config) {
293
293
  return new RegExp(
294
- `(^|\\s)([a-zA-Z-_]+?)${config.getMetaSep()}(?!\\*+)(?!\\/\\/)([${
294
+ `(^|\\s)([a-zA-Z-_]+?)${config.getMetaSep()}(?![*_]+)(?!\\/\\/)([${
295
295
  Task.AnyLanguageGroup
296
296
  }${Task.EmojiGroup}]+)`,
297
297
  'gu'
@@ -299,7 +299,7 @@ Task.getMetaRegExp = function (config) {
299
299
  }
300
300
  Task.getMetaRegExpQuotes = function (config) {
301
301
  return new RegExp(
302
- `(^|\\s)([a-zA-Z-_]+?)${config.getMetaSep()}(?!\\*+)"((?${config.getMetaSep()}""|[^"]|[${
302
+ `(^|\\s)([a-zA-Z-_]+?)${config.getMetaSep()}(?![*_]+)"((?${config.getMetaSep()}""|[^"]|[${
303
303
  Task.AnyLanguageGroup
304
304
  }${Task.EmojiGroup}])*)"`,
305
305
  'gu'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imdone-core",
3
- "version": "1.43.6",
3
+ "version": "1.44.0",
4
4
  "description": "imdone-core",
5
5
  "main": "index.js",
6
6
  "scripts": {