Skip to content

Commit

Permalink
Merge pull request #16698 from ralfbrown/nl
Browse files Browse the repository at this point in the history
enable $(NL) in watermark text
  • Loading branch information
TurboGit authored Apr 29, 2024
2 parents d4671cd + 27c3e18 commit a8df62e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/common/variables.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2010-2023 darktable developers.
Copyright (C) 2010-2024 darktable developers.
darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -442,7 +442,12 @@ static char *_get_base_value(dt_variables_params_t *params, char **variable)
else if(_has_prefix(variable, "EXIF.ISO") || _has_prefix(variable, "EXIF_ISO"))
result = g_strdup_printf("%d", params->data->exif_iso);
else if(_has_prefix(variable, "NL") && g_strcmp0(params->jobcode, "infos") == 0)
result = g_strdup_printf("\n");
{
if (params->use_html_newline)
result = g_strdup_printf("
");
else
result = g_strdup_printf("\n");
}
else if(_has_prefix(variable, "EXIF.EXPOSURE.BIAS")
|| _has_prefix(variable, "EXIF_EXPOSURE_BIAS"))
{
Expand Down Expand Up @@ -1299,7 +1304,6 @@ char *dt_variables_expand(dt_variables_params_t *params,
char *result = _expand_source(params, &source, '\0');

_cleanup_expansion(params);

return result;
}

Expand Down
5 changes: 4 additions & 1 deletion src/common/variables.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2010-2023 darktable developers.
Copyright (C) 2010-2024 darktable developers.
darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -44,6 +44,9 @@ typedef struct dt_variables_params_t
/** do we need to escape variables text for markup ? */
gboolean escape_markup;

/** do we need to use an HTML entity for new lines instead of a newline character? */
gboolean use_html_newline;

/** img cache already controlled */
void *img;

Expand Down
3 changes: 2 additions & 1 deletion src/iop/watermark.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2010-2023 darktable developers.
Copyright (C) 2010-2024 darktable developers.
darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -560,6 +560,7 @@ static gchar *_watermark_get_svgdoc(dt_iop_module_t *self, dt_iop_watermark_data
dt_image_full_path(image->id, image_path, sizeof(image_path), &from_cache);
params->filename = image_path;
params->jobcode = "infos";
params->use_html_newline = TRUE;
params->sequence = 0;
params->imgid = image->id;
dt_variables_set_tags_flags(params, flags);
Expand Down

0 comments on commit a8df62e

Please sign in to comment.