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/klaudiosinani/taskbook] to markdown [https://commonmark.org/]
11 # 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.
12 # 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.
13 # You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
16 tbfile
= "tasques/taskbook/storage/storage.json"
18 ## Import JSON taskboard file
19 with
open(tbfile
) as f
:
22 j
= json
.loads(contents
)
24 ## Export Hash as List of tasks
31 ### A task could has several boards
32 sboards
= [t
['boards'] for t
in tasks
]
38 # So the boards is the sorted boards along all tasks
39 boards
= sorted(list(set(boards
)))
42 ## Just incompleted tasks
46 msg
= msg
+ "\n## " + b
[1:] + " \n\n"
48 tasksinb
= [t
for t
in tasks
if b
in t
['boards'] and t
['_isTask'] == True and t
['isComplete'] == False]
49 notesinb
= [t
for t
in tasks
if b
in t
['boards'] and t
['_isTask'] == False]
54 msg
= msg
+ "### Notes \n\n"
57 msg
= msg
+ "- [#{_id}] {description}\n".format(_id
= n
['_id'], description
=n
['description'])
64 msg
= msg
+ "### Tasques \n\n"
67 msg
= msg
+ "- [#{_id}] {description} \n".format(_id
= t
['_id'], description
= t
['description'])