imdone-core 1.53.12 → 1.53.13

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.
@@ -36,9 +36,9 @@ module.exports = class ReadStreamCodeParser extends ReadStreamTaskParser {
36
36
  Object.keys(comments).forEach((comment) => {
37
37
  const { begin, end, content } = comments[comment];
38
38
  const line = begin;
39
- const lastLine = end; // DOING lastLine should not be - 1
39
+ const lastLine = end; // TODO lastLine should not be - 1
40
40
  // <!--
41
- // order:0
41
+ // order:-140
42
42
  // -->
43
43
  const lines = content.split('\n');
44
44
 
package/lib/file.js CHANGED
@@ -961,10 +961,9 @@ File.prototype.extractTaskWithDescription = function ({
961
961
  this.project
962
962
  )
963
963
 
964
- task.updateOrderMeta(config)
965
-
966
- task.orderModified = task.order + "" !== order + "" && !bothAreUndefNull(task.order, order)
967
964
  task.init()
965
+ task.updateOrderMeta(config, task.format(task.descriptionString))
966
+ task.orderModified = task.order + "" !== order + "" && !bothAreUndefNull(task.order, order)
968
967
 
969
968
  return task
970
969
  }
@@ -3,6 +3,12 @@ const {getIsoDateWithOffset} = require('../adapters/date-time')
3
3
  const path = require('path')
4
4
  const simpleTemplate = '\n<!--\ncreated:${timestamp}\n-->\n'
5
5
 
6
+ function flattenObject(object) {
7
+ return Object.keys(object).reduce((acc, key) => {
8
+ return { ...acc, [`template_${key}`]: object[key] };
9
+ }, {});
10
+ }
11
+
6
12
  module.exports = class DefaultBoardPropertiesPlugin extends Plugin {
7
13
  constructor(project) {
8
14
  super(project)
@@ -14,15 +20,18 @@ module.exports = class DefaultBoardPropertiesPlugin extends Plugin {
14
20
  }
15
21
 
16
22
  getBoardProperties() {
17
- const self = this;
18
-
23
+ const templates = flattenObject(this.templates);
24
+ const clearFilterURL = this.getFilterURL('');
25
+ const getFilterURL = (filter) => this.getFilterURL(filter);
26
+ const getFilterLink = (filter) => `[Filter By: ${filter}](${this.getFilterURL(filter)})`;
27
+
19
28
  return {
20
29
  date: `${getIsoDateWithOffset(new Date()).substring(0, 10)}`,
21
30
  timestamp: getIsoDateWithOffset(new Date()),
22
- clearFilterURL: self.getFilterURL(''),
23
- templates: this.templates,
24
- getFilterURL: (filter) => self.getFilterURL(filter),
25
- getFilterLink: (filter) => `[Filter By: ${filter}](${self.getFilterURL(filter)})`
31
+ clearFilterURL,
32
+ getFilterURL,
33
+ getFilterLink,
34
+ ...templates
26
35
  }
27
36
  }
28
37
 
package/lib/task.js CHANGED
@@ -83,6 +83,10 @@ class Task {
83
83
  get order() {
84
84
  return this.innerOrder
85
85
  }
86
+
87
+ get descriptionString() {
88
+ return this.description.join(lineEnd)
89
+ }
86
90
 
87
91
  updateLastLine() {
88
92
  this.lastLine = this.getLastLine()
@@ -135,10 +139,8 @@ class Task {
135
139
  }
136
140
 
137
141
  getTextAndDescription() {
138
- const description = _clone(this.description)
139
- const taskContent = `${this.markdownBeforeText}${this.text}${lineEnd}${description.join(
140
- lineEnd
141
- )}`.replace(/<!--\s*\[\s*([\s\S]*?)\s*\]\s*-->/gm, '$1')
142
+ const taskContent = `${this.markdownBeforeText}${this.text}${lineEnd}${this.descriptionString}`
143
+ .replace(/<!--\s*\[\s*([\s\S]*?)\s*\]\s*-->/gm, '$1')
142
144
  return this.getText(
143
145
  {
144
146
  stripMeta: true,
@@ -150,11 +152,9 @@ class Task {
150
152
  }
151
153
 
152
154
  getRawTextAndDescription() {
153
- const description = _clone(this.description)
154
155
  const text = this.text
155
- if (description.length < 1) return text
156
- const descriptionMD = description.join(lineEnd)
157
- return `${text}${lineEnd}${descriptionMD}${lineEnd}`
156
+ if (this.description.length < 1) return text
157
+ return `${text}${lineEnd}${this.descriptionString}${lineEnd}`
158
158
  }
159
159
 
160
160
  getProgress() {
@@ -174,7 +174,7 @@ class Task {
174
174
  }
175
175
 
176
176
  updateContent() {
177
- this.content = this.text + lineEnd + this.description.join(lineEnd)
177
+ this.content = this.text + lineEnd + this.descriptionString
178
178
  }
179
179
 
180
180
  updateFromContent(content) {
@@ -434,7 +434,7 @@ Task.getMetaOrderRegex = function (config) {
434
434
  )
435
435
  }
436
436
 
437
- Task.prototype.updateOrderMeta = function (config, descContent = this.description.join(lineEnd)) {
437
+ Task.prototype.updateOrderMeta = function (config, descContent = this.descriptionString) {
438
438
  if (config.orderMeta) {
439
439
  if (!isNumber(this.order)) return this.order = ''
440
440
  const addNewLine = config.isMetaNewLine()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imdone-core",
3
- "version": "1.53.12",
3
+ "version": "1.53.13",
4
4
  "description": "imdone-core",
5
5
  "main": "index.js",
6
6
  "scripts": {