mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-29 14:06:14 +02:00
Add tags to json and xml exporters (#975)
* tag array for json * add tags to entry in xml * xml test * json test * black * removed called
This commit is contained in:
parent
c1b93cf81b
commit
be38cfa87a
4 changed files with 30 additions and 4 deletions
|
@ -20,6 +20,7 @@ class JSONExporter(TextExporter):
|
|||
"body": entry.body,
|
||||
"date": entry.date.strftime("%Y-%m-%d"),
|
||||
"time": entry.date.strftime("%H:%M"),
|
||||
"tags": entry.tags,
|
||||
"starred": entry.starred,
|
||||
}
|
||||
if hasattr(entry, "uuid"):
|
||||
|
|
|
@ -35,6 +35,11 @@ class XMLExporter(JSONExporter):
|
|||
if hasattr(entry, "uuid"):
|
||||
entry_el.setAttribute("uuid", entry.uuid)
|
||||
entry_el.setAttribute("starred", entry.starred)
|
||||
tags = entry.tags
|
||||
for tag in tags:
|
||||
tag_el = doc.createElement("tag")
|
||||
tag_el.setAttribute("name", tag)
|
||||
entry_el.appendChild(tag_el)
|
||||
entry_el.appendChild(doc.createTextNode(entry.fulltext))
|
||||
return entry_el
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue