core: Fix CSS palette import regex

GIMP expects CSS palettes to end with a ";" when importing. However,
GIMP exports CSS lines without ";". This means GIMP can't reopen its
own exported CSS palettes.
The ";" was removed from the regex since CSS2 does not require
the last line to end with a ";". However, CSS3 and above
require ending all lines with a ";", so it is added to the
export script.
This commit is contained in:
Alx Sa 2023-02-19 18:45:47 +00:00
parent 340edf4f1e
commit dbaea2ac50
2 changed files with 2 additions and 2 deletions

View file

@ -587,7 +587,7 @@ gimp_palette_load_css (GimpContext *context,
g_return_val_if_fail (G_IS_INPUT_STREAM (input), NULL); g_return_val_if_fail (G_IS_INPUT_STREAM (input), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL);
regex = g_regex_new (".*color.*:(?P<param>.*);", G_REGEX_CASELESS, 0, error); regex = g_regex_new (".*color.*:(?P<param>.*)", G_REGEX_CASELESS, 0, error);
if (! regex) if (! regex)
return NULL; return NULL;

View file

@ -90,7 +90,7 @@
(define (color-rgb-to-css color) (define (color-rgb-to-css color)
(string-append "rgb(" (number->string (color-get-red color)) (string-append "rgb(" (number->string (color-get-red color))
", " (number->string (color-get-green color)) ", " (number->string (color-get-green color))
", " (number->string (color-get-blue color)) ")") ", " (number->string (color-get-blue color)) ");")
) )
; Convert a color to a simple pair of braces with comma separated values ; Convert a color to a simple pair of braces with comma separated values