diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2014-08-23 22:22:24 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-08-27 07:18:41 -0700 |
commit | d00390d46d83b07fe03c815df3af2cd2371c02a8 (patch) | |
tree | e20f6ae54e6a3ec0b290ab5a672736ccea683052 /save-html.c | |
parent | 7fa8fd0e6b8ecbaf00969d6c54c44e897240861d (diff) | |
download | subsurface-d00390d46d83b07fe03c815df3af2cd2371c02a8.tar.gz |
HTML: Save divecomputer data to the HTML exports
Save divecomputers data to the JSON files. and show them in the HTML
dive detailed view.
Fixes #711
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'save-html.c')
-rw-r--r-- | save-html.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/save-html.c b/save-html.c index c3d5073b2..11d16a481 100644 --- a/save-html.c +++ b/save-html.c @@ -25,6 +25,22 @@ void save_photos(struct membuffer *b, const char *photos_dir, struct dive *dive) put_string(b, "],"); } +void write_divecomputers(struct membuffer *b, struct dive *dive) +{ + put_string(b, "\"divecomputers\":["); + struct divecomputer *dc; + for_each_dc(dive, dc) { + put_format(b, "{"); + write_attribute(b, "model", dc->model); + if (dc->deviceid) + put_format(b, "\"deviceid\":\"%08x\",", dc->deviceid); + if (dc->diveid) + put_format(b, "\"diveid\":\"%08x\",", dc->diveid); + put_format(b, "},"); + } + put_string(b, "],"); +} + void write_dive_status(struct membuffer *b, struct dive *dive) { put_format(b, "\"sac\":\"%d\",", dive->sac); @@ -245,6 +261,7 @@ void write_one_dive(struct membuffer *b, struct dive *dive, const char *photos_d put_HTML_bookmarks(b, dive); write_dive_status(b, dive); save_photos(b, photos_dir, dive); + write_divecomputers(b, dive); } put_string(b, "},\n"); (*dive_no)++; |