aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--subsurface-core/save-html.c23
-rw-r--r--subsurface-core/save-html.h1
-rw-r--r--subsurface-core/worldmap-save.c6
3 files changed, 27 insertions, 3 deletions
diff --git a/subsurface-core/save-html.c b/subsurface-core/save-html.c
index 64ce94f66..5fc5b000a 100644
--- a/subsurface-core/save-html.c
+++ b/subsurface-core/save-html.c
@@ -259,6 +259,29 @@ void put_HTML_time(struct membuffer *b, struct dive *dive, const char *pre, cons
put_format(b, "%s%02u:%02u:%02u%s", pre, tm.tm_hour, tm.tm_min, tm.tm_sec, post);
}
+void put_HTML_depth(struct membuffer *b, struct dive *dive, const char *pre, const char *post)
+{
+ const char *unit;
+ double value;
+ struct units *units_p = get_units();
+
+ if (!dive->maxdepth.mm) {
+ put_format(b, "%s--%s", pre, post);
+ return;
+ }
+ value = get_depth_units(dive->maxdepth.mm, NULL, &unit);
+
+ switch (units_p->length) {
+ case METERS:
+ default:
+ put_format(b, "%s%.1f %s%s", pre, value, unit, post);
+ break;
+ case FEET:
+ put_format(b, "%s%.0f %s%s", pre, value, unit, post);
+ break;
+ }
+}
+
void put_HTML_airtemp(struct membuffer *b, struct dive *dive, const char *pre, const char *post)
{
const char *unit;
diff --git a/subsurface-core/save-html.h b/subsurface-core/save-html.h
index 20743e90a..13bb102b1 100644
--- a/subsurface-core/save-html.h
+++ b/subsurface-core/save-html.h
@@ -9,6 +9,7 @@ extern "C" {
#include "membuffer.h"
void put_HTML_date(struct membuffer *b, struct dive *dive, const char *pre, const char *post);
+void put_HTML_depth(struct membuffer *b, struct dive *dive, const char *pre, const char *post);
void put_HTML_airtemp(struct membuffer *b, struct dive *dive, const char *pre, const char *post);
void put_HTML_watertemp(struct membuffer *b, struct dive *dive, const char *pre, const char *post);
void put_HTML_time(struct membuffer *b, struct dive *dive, const char *pre, const char *post);
diff --git a/subsurface-core/worldmap-save.c b/subsurface-core/worldmap-save.c
index 25c5ee33f..f79978495 100644
--- a/subsurface-core/worldmap-save.c
+++ b/subsurface-core/worldmap-save.c
@@ -40,9 +40,9 @@ void writeMarkers(struct membuffer *b, const bool selected_only)
snprintf(pre, sizeof(pre), "<p>%s ", translate("gettextFromC", "Duration:"));
snprintf(post, sizeof(post), " %s</p>", translate("gettextFromC", "min"));
put_duration(b, dive->duration, pre, post);
- snprintf(pre, sizeof(pre), "<p>%s ", translate("gettextFromC", "Max. depth:"));
- snprintf(post, sizeof(post), " %s</p>", translate("gettextFromC", "m"));
- put_depth(b, dive->maxdepth, pre, post);
+ put_string(b, "<p> ");
+ put_HTML_quoted(b, translate("gettextFromC", "Max. depth:"));
+ put_HTML_depth(b, dive, " ", "</p>");
put_string(b, "<p> ");
put_HTML_quoted(b, translate("gettextFromC", "Air temp.:"));
put_HTML_airtemp(b, dive, " ", "</p>");