summaryrefslogtreecommitdiffstats
path: root/save-html.c
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2014-07-27 21:38:50 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-04 10:03:09 -0700
commit4d6ff4c8d1836361900a257f25ce83d8e639745b (patch)
treeeb0018f97cb78979df78e385beb114f33f1f41bf /save-html.c
parent979ea564a058254205c2ec9594294f35658c65f0 (diff)
downloadsubsurface-4d6ff4c8d1836361900a257f25ce83d8e639745b.tar.gz
HTML: add weight systems to the dive equipments section.
Add weights systems to the dive equipment list. 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>
Diffstat (limited to 'save-html.c')
-rw-r--r--save-html.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/save-html.c b/save-html.c
index f777de05d..652ffb411 100644
--- a/save-html.c
+++ b/save-html.c
@@ -44,6 +44,27 @@ void put_HTML_bookmarks(struct membuffer *b, struct dive *dive)
put_string(b, "],");
}
+static void put_weightsystem_HTML(struct membuffer *b, struct dive *dive)
+{
+ int i, nr;
+
+ nr = nr_weightsystems(dive);
+
+ put_string(b, "\"Weights\":[");
+
+ for (i = 0; i < nr; i++) {
+ weightsystem_t *ws = dive->weightsystem + i;
+ int grams = ws->weight.grams;
+ const char *description = ws->description;
+
+ put_string(b, "{");
+ put_format(b, "\"weight\":\"%d\",", grams);
+ write_attribute(b, "description", description);
+ put_string(b, "},");
+ }
+ put_string(b, "],");
+}
+
static void put_cylinder_HTML(struct membuffer *b, struct dive *dive)
{
int i, nr;
@@ -199,6 +220,7 @@ void write_one_dive(struct membuffer *b, struct dive *dive, const char *photos_d
put_HTML_notes(b, dive, "\"notes\":\"", "\",");
if (!list_only) {
put_cylinder_HTML(b, dive);
+ put_weightsystem_HTML(b, dive);
put_HTML_samples(b, dive);
put_HTML_bookmarks(b, dive);
write_dive_status(b, dive);