imdone-core 1.44.1 → 1.44.3

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.
@@ -1,4 +1,5 @@
1
- const removeMD = require('remove-markdown')
1
+ // const removeMD = require('remove-markdown')
2
+ const { renderMarkdown } = require('../adapters/markdown')
2
3
  const Plugin = require('imdone-api')
3
4
 
4
5
  function getIsEpicMeta(task) {
@@ -61,7 +62,8 @@ module.exports = class EpicPlugin extends Plugin {
61
62
  addEpicItem(name, task) {
62
63
  const list = task.list
63
64
  this.initEpic(name)
64
- if (!this.getEpicItems(name, list)) this.epics[name].items[list] = []
65
+ if (!this.getEpicItemsInList(name, list)) this.epics[name].items[list] = []
66
+ if (this.getEpicItemsInList(name, list).find((t) => t.id === task.id)) return
65
67
  this.epics[name].items[list].push(task)
66
68
  }
67
69
 
@@ -73,11 +75,15 @@ module.exports = class EpicPlugin extends Plugin {
73
75
  return this.epics[name].epic
74
76
  }
75
77
 
76
- getEpicItems(name, list) {
77
- if (!list) return this.epics[name].items
78
+ getEpicItems(name) {
79
+ return this.epics[name].items
80
+ }
81
+
82
+ getEpicItemsInList(name, list) {
78
83
  return this.epics[name].items[list]
79
84
  }
80
85
 
86
+
81
87
  getEpicLists(name) {
82
88
  return Object.keys(this.getEpicItems(name))
83
89
  }
@@ -104,7 +110,7 @@ module.exports = class EpicPlugin extends Plugin {
104
110
  return
105
111
  }
106
112
 
107
- const epicText = removeMD(epic.text)
113
+ const epicText = epic.text // removeMD(epic.text)
108
114
  const epicFilter = encodeURIComponent(
109
115
  `(allMeta.epic="${epicId}" or allMeta.is-epic="${epicId}")`
110
116
  )
@@ -114,21 +120,21 @@ module.exports = class EpicPlugin extends Plugin {
114
120
  const epicUrl = `imdone://${epicFilePath}?line=${epic.line}&filter=${epicFilter}`
115
121
  const epicLink = `**Epic:** [${epicText}](${epicUrl})\n\n`
116
122
 
117
- const taskList =
118
- epicLists.length === 0
119
- ? '*None*\n'
120
- : '\n<div class="imdone-epic-items">\n\n' +
121
- this.getTaskListMD(lists, epicFilter, epicUrl, epicId) +
122
- '\n\n</div>\n'
123
-
124
123
  // Add epic link to epic tasks
125
124
  epicLists.forEach((list) => {
126
- this.getEpicItems(epicId, list).forEach((task) => {
125
+ this.getEpicItemsInList(epicId, list).forEach((task) => {
127
126
  task.interpretedContent = epicLink + task.interpretedContent
128
127
  task.init()
129
128
  })
130
129
  })
131
130
 
131
+ const taskList =
132
+ epicLists.length === 0
133
+ ? '*None*\n'
134
+ : '\n<div class="imdone-epic-items">\n\n' +
135
+ this.getTaskListMD(lists, epicFilter, epicUrl, epicId) +
136
+ '\n\n</div>\n'
137
+
132
138
  if (epic.allMeta.epic && epic.allMeta.epic.includes(epicId)) {
133
139
  const index = epic.allMeta.epic.findIndex((value) => value === epicId)
134
140
  epic.allMeta.epic.splice(index, 1)
@@ -144,16 +150,17 @@ module.exports = class EpicPlugin extends Plugin {
144
150
  let content = ''
145
151
 
146
152
  lists
147
- .filter((list) => this.getEpicItems(epicId, list.name))
153
+ .filter((list) => this.getEpicItemsInList(epicId, list.name))
154
+ .reverse()
148
155
  .forEach((list) => {
149
- const tasks = this.getEpicItems(epicId, list.name)
156
+ const tasks = this.getEpicItemsInList(epicId, list.name)
150
157
  const listUrl = epicUrl + encodeURIComponent(` and list=${list.name}`)
151
158
  const listLink = `[${list.name}](${listUrl})`
152
159
  content = content + '\n\n#### ' + listLink + '\n'
153
160
  content += '<ul style="list-style: none;">'
154
161
  content += tasks
155
162
  .map((task) => {
156
- const taskText = removeMD(task.text)
163
+ const taskText = renderMarkdown(task.text).replaceAll(/<p>|<\/p>/ig, '') // removeMD(task.text)
157
164
  const checked =
158
165
  task.list === this.project.doneList ? ' checked="true"' : ''
159
166
  const taskFilePath = encodeURI(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imdone-core",
3
- "version": "1.44.1",
3
+ "version": "1.44.3",
4
4
  "description": "imdone-core",
5
5
  "main": "index.js",
6
6
  "scripts": {