imdone-core 1.40.0 → 1.40.2
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/card.js +15 -5
- package/lib/file.js +6 -4
- package/package.json +2 -2
package/lib/card.js
CHANGED
|
@@ -3,9 +3,11 @@ const _path = require('path')
|
|
|
3
3
|
const template = require('lodash.template')
|
|
4
4
|
const _pick = require('lodash.pick')
|
|
5
5
|
const _isFunction = require('lodash.isfunction')
|
|
6
|
+
const _isObject = require('lodash.isobject')
|
|
6
7
|
const _isEmpty = require('lodash.isempty')
|
|
7
8
|
const _get = require('lodash.get')
|
|
8
9
|
const eol = require('eol')
|
|
10
|
+
const moment = require('moment')
|
|
9
11
|
const allEmoji = require('markdown-it-emoji/lib/data/full.json')
|
|
10
12
|
|
|
11
13
|
const { removeMD, renderMarkdown } = require('./adapters/markdown')
|
|
@@ -115,6 +117,7 @@ module.exports = function newCard(task, _project, dontParse) {
|
|
|
115
117
|
|
|
116
118
|
get defaultData() {
|
|
117
119
|
return {
|
|
120
|
+
timestamp: moment().format(),
|
|
118
121
|
..._pick(
|
|
119
122
|
this,
|
|
120
123
|
...['beforeText',
|
|
@@ -186,12 +189,22 @@ module.exports = function newCard(task, _project, dontParse) {
|
|
|
186
189
|
? { ...pluginManager.getCardProperties(defaultData) }
|
|
187
190
|
: {}
|
|
188
191
|
const data = {
|
|
189
|
-
...defaultData,
|
|
190
192
|
...pluginData,
|
|
191
193
|
...props,
|
|
192
|
-
...computed
|
|
194
|
+
...computed,
|
|
195
|
+
...defaultData
|
|
193
196
|
}
|
|
194
197
|
|
|
198
|
+
const keys = Object.keys(data)
|
|
199
|
+
keys.forEach((key) => {
|
|
200
|
+
const value = data[key]
|
|
201
|
+
if (_isObject(value) && !Array.isArray(value)) {
|
|
202
|
+
|
|
203
|
+
keys.push(...Object.keys(value).map((k) => `${key}.${k}`))
|
|
204
|
+
}
|
|
205
|
+
})
|
|
206
|
+
this.dataKeys = keys
|
|
207
|
+
|
|
195
208
|
this.data = { ...data }
|
|
196
209
|
this.desc = this.getDescriptionData()
|
|
197
210
|
this.data = { ...data, ...this.desc }
|
|
@@ -242,9 +255,6 @@ module.exports = function newCard(task, _project, dontParse) {
|
|
|
242
255
|
content = content.replace(opts.interpolate, `~~{{${e}}}~~`)
|
|
243
256
|
}
|
|
244
257
|
}
|
|
245
|
-
// Fix list endings
|
|
246
|
-
// const listEndingRegex = /(\n\s*([-+*]{1}|\d+.)\s.*[\n\r])([^1-9-+* \t])/gm
|
|
247
|
-
// description = description.replace(listEndingRegex, '$1\n$3')
|
|
248
258
|
|
|
249
259
|
return content
|
|
250
260
|
}
|
package/lib/file.js
CHANGED
|
@@ -20,6 +20,7 @@ var _clone = require('lodash.clone'),
|
|
|
20
20
|
newCard = require('./card'),
|
|
21
21
|
fastSort = require('fast-sort/dist/sort'),
|
|
22
22
|
XRegExp = require('xregexp'),
|
|
23
|
+
moment = require('moment'),
|
|
23
24
|
{
|
|
24
25
|
FILE_TYPES,
|
|
25
26
|
getTaskContent,
|
|
@@ -148,7 +149,7 @@ File.addCompleted = function ({ task, content, config }) {
|
|
|
148
149
|
if (task.list !== doneList) return content
|
|
149
150
|
if (task.completed || task.meta.completed) return content
|
|
150
151
|
if (content.includes(`completed${config.getMetaSep()}`)) return content
|
|
151
|
-
const now =
|
|
152
|
+
const now = moment().format()
|
|
152
153
|
content = task.addToLastCommentInContent(
|
|
153
154
|
content,
|
|
154
155
|
`completed${config.getMetaSep()}${now}`,
|
|
@@ -165,10 +166,11 @@ File.parseDueDate = function (config, text) {
|
|
|
165
166
|
if (dueString) return dueMatch
|
|
166
167
|
try {
|
|
167
168
|
const due = chrono.parseDate(dueMatch, new Date(), {forwardDate: true})
|
|
168
|
-
|
|
169
|
+
if (!due) return dueMatch
|
|
170
|
+
dueString = moment(due).format()
|
|
169
171
|
return `${p1.toLowerCase()}${config.getMetaSep()}${dueString}`
|
|
170
172
|
} catch (e) {
|
|
171
|
-
|
|
173
|
+
console.log(`Unable to parse due date for ${text}`)
|
|
172
174
|
return dueMatch
|
|
173
175
|
}
|
|
174
176
|
})
|
|
@@ -832,7 +834,7 @@ File.prototype.modifyDescription = function (task, config) {
|
|
|
832
834
|
if (
|
|
833
835
|
this.isMarkDownFile() &&
|
|
834
836
|
description.length > 0 &&
|
|
835
|
-
(
|
|
837
|
+
(hasBlankLines(description) || isWrappedWithCardTag || trailingBlankLines)
|
|
836
838
|
) {
|
|
837
839
|
task.isWrappedWithCardTag = isWrappedWithCardTag // DOING Find out where this is used and stop using it
|
|
838
840
|
// <!-- order:-30 -->
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imdone-core",
|
|
3
|
-
"version": "1.40.
|
|
3
|
+
"version": "1.40.2",
|
|
4
4
|
"description": "imdone-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"lodash.isundefined": "^3.0.1",
|
|
82
82
|
"lodash.noop": "^3.0.1",
|
|
83
83
|
"lodash.omit": "^4.5.0",
|
|
84
|
-
"lodash.pick": "^
|
|
84
|
+
"lodash.pick": "^3.1.0",
|
|
85
85
|
"lodash.reject": "^4.6.0",
|
|
86
86
|
"lodash.remove": "^4.7.0",
|
|
87
87
|
"lodash.some": "^4.6.0",
|