imdone-core 1.44.4 → 1.44.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.
@@ -43,6 +43,13 @@ function getContentLines(content) {
43
43
  })
44
44
  }
45
45
 
46
+ function isCustomCardTerminator(config, line) {
47
+ return config.customCardTerminator
48
+ && config.customCardTerminator.trim()
49
+ && line
50
+ && line.trim() === config.customCardTerminator
51
+ }
52
+
46
53
  function isCheckBoxTask (config, line, beforeText) {
47
54
  if (!config.isAddCheckBoxTasks()) return
48
55
 
@@ -146,6 +153,7 @@ function getCardTagsTaskContent ({
146
153
  }
147
154
  }
148
155
 
156
+ // This finds the end of task
149
157
  function getCodeFileTaskContent ({
150
158
  config,
151
159
  content,
@@ -208,13 +216,13 @@ function getTextFileTaskContent ({
208
216
 
209
217
  for (let i = 1; i < lines.length; i++) {
210
218
  let line = lines[i]
211
- let taskContentLine = `${line}`
212
219
  if (hasTaskInText(config, line)) break
213
220
  if (isCheckBoxTask(config, line, beforeText)) break
214
221
  if (isTaskInList && isLineOutsideMarkdownList(line, beforeText)) break
222
+ if (isCustomCardTerminator(config, line)) break
215
223
 
216
- taskContentLines.push(taskContentLine)
217
224
  rawTaskContentLines.push(line)
225
+ taskContentLines.push(`${line}`)
218
226
 
219
227
  // Check for matching block comments in markdown files
220
228
  if (isMarkDownFile && line.trim().indexOf('<!--') > -1)
package/lib/card.js CHANGED
@@ -56,7 +56,12 @@ module.exports = function newCard(task, _project, dontParse) {
56
56
  }
57
57
 
58
58
  onTaskUpdate() {
59
- pluginManager.onTaskUpdate(this)
59
+ // TODO We should be mapping to the imdone-api task
60
+ // #imdone-1.45.0
61
+ const interpretedContent = pluginManager.onTaskUpdate(this)
62
+ if (interpretedContent && interpretedContent.length > 0) {
63
+ this.interpretedContent = interpretedContent
64
+ }
60
65
  }
61
66
 
62
67
  initProps() {
@@ -296,7 +301,7 @@ module.exports = function newCard(task, _project, dontParse) {
296
301
  imagePath = _path.join(
297
302
  _path.dirname(this.fullPath),
298
303
  imagePath
299
- )
304
+ ).replace(/ /g, '%20')
300
305
  const imageURL = `file://${imagePath}`
301
306
  return p1 + imageURL + p3
302
307
  }
package/lib/config.js CHANGED
@@ -20,6 +20,7 @@ class Config {
20
20
  _assign(this, opts)
21
21
  if (!this.settings) this.settings = {}
22
22
  if (!this.settings.views) this.settings.views = []
23
+ if (!this.settings.cards) this.settings.cards = {}
23
24
  }
24
25
 
25
26
  get defaultFilter() {
@@ -94,6 +95,14 @@ class Config {
94
95
  return _get(this, 'settings.cards.addCompletedMeta', false)
95
96
  }
96
97
 
98
+ get customCardTerminator() {
99
+ return _get(this, 'settings.cards.customCardTerminator')
100
+ }
101
+
102
+ set customCardTerminator(terminator) {
103
+ this.settings.cards.customCardTerminator = terminator
104
+ }
105
+
97
106
  get markdownOnly() {
98
107
  return this.settings.markdownOnly
99
108
  }
package/lib/project.js CHANGED
@@ -622,10 +622,12 @@ module.exports = class WorkerProject extends Project {
622
622
  }
623
623
  }
624
624
 
625
- sanitizeFileName(name) {
626
- let fileName = sanitize(name)
625
+ sanitizeFileName(fileName) {
626
+ fileName = fileName.replace(/:\w+:/g, '').trim()
627
+ fileName = sanitize(fileName)
627
628
  if (this.config.replaceSpacesWith)
628
629
  fileName = fileName.replace(/ /g, this.config.replaceSpacesWith)
630
+ // Remove markdown emoji
629
631
  return fileName
630
632
  }
631
633
 
package/lib/repository.js CHANGED
@@ -1117,7 +1117,8 @@ Repository.prototype.appendTask = function({file, content, list}, cb) {
1117
1117
  }
1118
1118
  appendContent = File.trimBlankLines(appendContent)
1119
1119
  fileContent = `${fileContent}${sep}`
1120
- file.setContent(`${fileContent}${appendContent}${"\n".repeat(2)}`)
1120
+ const cardTerminator = "\n".repeat(2)
1121
+ file.setContent(`${fileContent}${appendContent}${cardTerminator}`)
1121
1122
  this.writeAndExtract(file, true, (err, file) => {
1122
1123
  if (err) return cb(err)
1123
1124
  const task = file.getTasks().find(task => task.text === text && task.list === list)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imdone-core",
3
- "version": "1.44.4",
3
+ "version": "1.44.6",
4
4
  "description": "imdone-core",
5
5
  "main": "index.js",
6
6
  "scripts": {