From 760ce7d16abbc8befcda802f045c3f2af9b59b2a Mon Sep 17 00:00:00 2001
From: Marcelo Mendez
Date: Thu, 29 Aug 2024 21:39:06 -0500
Subject: [PATCH 1/3] Modernize WebUI Gallery export
---
data/style/style.css | 180 ++++++++++++++--------------------
src/imageio/storage/gallery.c | 55 ++++++-----
2 files changed, 105 insertions(+), 130 deletions(-)
diff --git a/data/style/style.css b/data/style/style.css
index 0c482eb122e1..34f7cf899548 100644
--- a/data/style/style.css
+++ b/data/style/style.css
@@ -1,131 +1,97 @@
-a:link { font-weight:bold; font-style:normal; color:white; text-decoration:none; }
-a:visited { font-weight:bold; font-style:normal; color:white; text-decoration:none; }
-a:focus { font-weight:bold; font-style:normal; color:white; text-decoration:underline; }
-a:hover { font-weight:bold; font-style:normal; color:#6a6868; text-decoration:none; }
-
-body{
- background-color:#5a5858;
- font-family:trebuchet ms,bitstream vera sans,verdana,helvetica,arial,sans-serif; font-size: 8pt;
+body {
+ background-color: #5a5858;
+ font-family: 'Trebuchet MS', 'Bitstream Vera Sans', Verdana, Helvetica, Arial, sans-serif;
+ font-size: 8pt;
margin: 0;
padding: 0;
border: 0;
}
-body.navbody{
- font-family:trebuchet ms,bitstream vera sans,verdana,helvetica,arial,sans-serif; font-size: 8pt;
- background-color:#d2d0d0;
- margin: 0;
- padding: 0;
- border: 0;
+header {
+ max-width: 742px;
+ height: 90px;
+ position: relative;
+ margin: 0 auto;
}
-.title{
- margin-left: auto;
- margin-right: auto;
- margin-top: 50pt;
- margin-bottom: -5pt;
- background-color:#5a5858;
- color:#d2d0d0;
- padding: 0pt;
- font-weight:bold;
- font-size:20pt;
- width: 746px; /* width of page + padding. */
-}
-.page{
- background-color:#d2d0d0;
- padding: 20pt;
- padding-bottom: 40pt;
- margin-left: auto;
- margin-right: auto;
- margin-top: 0pt;
- margin-bottom: 0pt;
- width: 692px;
- counter-reset: section;
- border-style:solid;
- border-width:1px;
- border-color:#222222;
-}
-.footer{
- background-image:none;
- background-color:#5a5858;
- padding: 0pt;
- text-align:right;
- margin-left: auto;
- margin-right: auto;
- margin-top: 5pt;
- margin-bottom: 20pt;
- width: 692px;
+header h1 {
+ color: #d2d0d0;
+ font-weight: bold;
+ font-size: 26px;
+ position: absolute;
+ bottom: -6px;
+ left: 0;
+ margin: 0;
}
-.dia img {
- align-self: center;
+main {
+ background-color: #d2d0d0;
+ border: 1px solid #222;
+ border-bottom: none;
+ display: grid;
+ gap: 1em;
+ grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
+ max-width: 700px;
+ margin: 0 auto;
+ padding: 20px;
+ align-items: start;
}
-.page div {
- height:250px;
- float:left;
- max-width:200px;
- margin:0px;
- margin-right:30px;
- margin-bottom:30px;
-}
-.page .dia{
- background-color:#5a5858;
- margin-right:10pt;
- margin-bottom:10pt;
- margin-top:4px;
- width:200px;
- height:200px;
- border-style:solid;
- border-width:1px;
- border-color:#222222;
- display:table-cell;
- vertical-align:middle;
- text-align:center;
+figure {
display: flex;
+ flex-flow: column;
justify-content: center;
+ text-align: left;
+ margin: 0;
+ padding: 0;
}
-/* IE/Mac \*//*/
-* html .page a {
- display: block;
-}
-* html .page a span {
- display: inline-block;
- height: 100%;
- width: 1px;
-}
-/**/
-
-.page .dia *{
- max-width:200px;
- max-height:200px;
- border-style:none;
- vertical-align:middle;
+figure > * {
+ color: #6a6868;
+ margin-inline: 12px;
}
-.headline{
- position:relative;
- margin-bottom:10pt;
- margin-left:2em;
- color:#6a6868;
- vertical-align:text-top;
+h2 {
+ margin-block: 4px;
+ font-size: 18px;
}
-h1, h2{
- /*position:relative;*/
- margin-bottom:5pt;
- color:#6a6868;
- margin-top:4pt;
- font-size:12pt;
- text-align:left;
+
+.thumbnail {
+ background-color: #ababab;
+ border: 1px solid #6a6868;
+ box-shadow: 0 5px 10px #a6a6a6;
+ margin: 12px;
+ height: 200px;
+ object-fit: contain;
+ width: calc(100% - 24px);
}
-br{
- margin-bottom:1em;
+footer {
+ background-color: #c0c0c0;
+ max-width: 740px;
+ margin: 0 auto;
+ padding-block: 10px;
+ border: 1px solid #222;
+ border-top: none;
+ text-align: right;
}
-.text{
- line-height:12pt;
- margin-bottom:20pt;
+footer p {
+ padding: 10px;
+ font-weight: bold;
+ color: #666;
+ font-size: 12px;
+ margin: 0;
}
+
+footer code {
+ padding: 0.2rem 0.5rem;
+ margin: 5em auto;
+ line-height: 22px;
+ white-space: pre-wrap;
+ background-color: #f1f1f1;
+ color: #585858;
+ border: 1px solid #e1e1e1;
+ border-radius: 4px;
+}
\ No newline at end of file
diff --git a/src/imageio/storage/gallery.c b/src/imageio/storage/gallery.c
index cc096d2b235c..72f87b664f15 100644
--- a/src/imageio/storage/gallery.c
+++ b/src/imageio/storage/gallery.c
@@ -382,15 +382,21 @@ int store(dt_imageio_module_storage_t *self,
gchar *esc_relfilename = g_strescape(relfilename, NULL);
gchar *esc_relthumbfilename = g_strescape(relthumbfilename, NULL);
+ char *title_element = title ? g_strdup_printf("%s
\n", title) : g_strdup("");
+ char *figcaption_element = description ? g_strdup_printf("%s\n",
+ description) : g_strdup("");
snprintf(pair->line, sizeof(pair->line),
"\n"
- " \n"
- "

\n"
- "
%s
\n"
- " %s
\n",
- esc_relthumbfilename,
- num, num-1, title ? title : " ", description ? description : " ");
+ " \n"
+ "
\n"
+ " %s"
+ " %s"
+ " \n",
+ esc_relthumbfilename, num, num-1, title_element, figcaption_element);
+
+ g_free(title_element);
+ g_free(figcaption_element);
if(res_title)
g_list_free_full(res_title, &g_free);
@@ -503,13 +509,13 @@ void finalize_store(dt_imageio_module_storage_t *self, dt_imageio_module_data_t
FILE *f = g_fopen(filename, "wb");
if(!f) return;
fprintf(f,
- "\n"
- "\n"
+ "\n"
+ "\n"
" \n"
- " \n"
- " \n"
- " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
" \n"
" \n"
" \n"
@@ -517,8 +523,10 @@ void finalize_store(dt_imageio_module_storage_t *self, dt_imageio_module_data_t
" %s\n"
" \n"
" \n"
- " %s
\n"
- " \n",
+ "
\n"
+ "
\n",
title, title);
size_t count = 0;
@@ -529,14 +537,15 @@ void finalize_store(dt_imageio_module_storage_t *self, dt_imageio_module_data_t
count++;
}
- fprintf(f, " \n"
- " \n"
- " \n"
+ "
\n"
+ "
\n"
+ " \n"
" \n"
"
\n"
"
\n"
@@ -577,8 +586,8 @@ void finalize_store(dt_imageio_module_storage_t *self, dt_imageio_module_data_t
"