3 # SPDX-FileCopyrightText: 2023 Xavier Bordoy
5 # SPDX-License-Identifier: GPL-3.0-or-later
8 # Taskboard to Markdown
9 # This program is to pass information from taskboard JSON file [https://github.com/mickael-menu/zk]
10 # to markdown [https://commonmark.org/]
12 # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
17 fitxer
= "tasques/taskbook/storage/storage.json"
19 ## Import JSON taskboard file
20 with
open(fitxer
) as f
:
23 j
= json
.loads(contents
)
25 ## Export Hash as List of tasks
32 ### A task could has several boards
33 sboards
= [t
['boards'] for t
in tasks
]
39 # So the boards is the sorted boards along all tasks
40 boards
= sorted(list(set(boards
)))
43 ## Just incompleted tasks
44 msg
= "# Versions \n\n"
47 msg
= msg
+ "\n## " + b
[1:] + " \n\n"
49 tasksinb
= [t
for t
in tasks
if b
in t
['boards'] and t
['_isTask'] == True and t
['isComplete'] == False]
50 notesinb
= [t
for t
in tasks
if b
in t
['boards'] and t
['_isTask'] == False]
55 msg
= msg
+ "### Notes \n\n"
58 msg
= msg
+ "- [#{_id}] {description}\n".format(_id
= n
['_id'], description
=n
['description'])
65 msg
= msg
+ "### Tasques \n\n"
68 msg
= msg
+ "- [#{_id}] {description} \n".format(_id
= t
['_id'], description
= t
['description'])