mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Export tags in json array
This will help in searching based on tags Also some minor coding-style fixes Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ecb5e15dab
commit
5b8f0dd488
1 changed files with 7 additions and 5 deletions
|
@ -100,15 +100,17 @@ void put_HTML_watertemp(struct membuffer *b, struct dive *dive, const char *pre,
|
||||||
void put_HTML_tags(struct membuffer *b, struct dive *dive, const char *pre, const char *post)
|
void put_HTML_tags(struct membuffer *b, struct dive *dive, const char *pre, const char *post)
|
||||||
{
|
{
|
||||||
put_string(b, pre);
|
put_string(b, pre);
|
||||||
|
put_string(b, "[");
|
||||||
struct tag_entry *tag = dive->tag_list;
|
struct tag_entry *tag = dive->tag_list;
|
||||||
|
|
||||||
if (!tag)
|
if (!tag)
|
||||||
put_string(b, "--");
|
put_string(b, "\"--\",");
|
||||||
|
|
||||||
while (tag) {
|
while (tag) {
|
||||||
put_format(b, "%s ", tag->tag->name);
|
put_format(b, "\"%s\",", tag->tag->name);
|
||||||
tag = tag->next;
|
tag = tag->next;
|
||||||
}
|
}
|
||||||
|
put_string(b, "]");
|
||||||
put_string(b, post);
|
put_string(b, post);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +138,7 @@ void write_one_dive(struct membuffer *b, struct dive *dive, int *dive_no)
|
||||||
write_attribute(b, "buddy", dive->buddy);
|
write_attribute(b, "buddy", dive->buddy);
|
||||||
write_attribute(b, "divemaster", dive->divemaster);
|
write_attribute(b, "divemaster", dive->divemaster);
|
||||||
write_attribute(b, "suit", dive->suit);
|
write_attribute(b, "suit", dive->suit);
|
||||||
put_HTML_tags(b, dive, "\"tags\":\"", "\",");
|
put_HTML_tags(b, dive, "\"tags\":", ",");
|
||||||
put_HTML_notes(b, dive ,"\"notes\":\"" ,"\",");
|
put_HTML_notes(b, dive ,"\"notes\":\"" ,"\",");
|
||||||
put_string(b, "},\n");
|
put_string(b, "},\n");
|
||||||
(*dive_no)++;
|
(*dive_no)++;
|
||||||
|
|
Loading…
Add table
Reference in a new issue