Allow colours in font color tags to have no surrounding
authorCarl Hetherington <cth@carlh.net>
Wed, 30 Sep 2020 19:07:28 +0000 (21:07 +0200)
committerCarl Hetherington <cth@carlh.net>
Wed, 30 Sep 2020 19:07:28 +0000 (21:07 +0200)
quotation marks.

src/subrip_reader.cc
test/subrip_reader_test.cc

index beb81e1c41db1cbaefbbd358a574161128f412a2..89a5599d54328adcccbedcf608a1f61e32f59807 100644 (file)
@@ -237,7 +237,7 @@ SubripReader::convert_line (string t, RawSubtitle& p)
                                        p.underline = false;
                                } else if (boost::starts_with (tag, "font")) {
                                        maybe_content (p);
-                                       boost::regex re (".*color=\"#([[:xdigit:]]+)\"");
+                                       boost::regex re (".*color=\"?#([[:xdigit:]]+)\"?");
                                        boost::smatch match;
                                        if (boost::regex_search (tag, match, re) && string (match[1]).size() == 6) {
                                                p.colour = Colour::from_rgb_hex (match[1]);
index a77e8d7146b445d6d18434e3fbc647d000546852..6f8e5b8d63cd0f517b8fd66345b408ef8b58310b 100644 (file)
@@ -424,6 +424,7 @@ BOOST_AUTO_TEST_CASE (subrip_read_test)
        test ("Fight.Club.1999.720p.BRRip.x264-x0r.srt");
        test ("EU13.srt");
        test ("Subtitulos_HURTO_eng.srt");
+       test ("SWING_PARA_SORDOS_CASTELLANO_24.srt");
        test_throw ("subtitulo1.srt");
 }