From 6ab3a0e0c06f21d0101f2c4bccac6fdb1f2a3adf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tomasz=20Sa=C5=82aci=C5=84ski?= Date: Sat, 23 Feb 2008 09:51:26 +0000 Subject: [PATCH] Forward slashes at the beginning and end of a line also signify italics (Fixes: #518162). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Original commit message from CVS: Based on patch by: Tomasz Sałaciński * gst/subparse/gstsubparse.c: (parse_mdvdsub): * tests/check/elements/subparse.c: (test_microdvd_with_italics), (subparse_suite): Forward slashes at the beginning and end of a line also signify italics (Fixes: #518162). --- ChangeLog | 10 ++++++++++ common | 2 +- gst/subparse/gstsubparse.c | 12 ++++++++++++ tests/check/elements/subparse.c | 17 +++++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b4e6262..f3d94c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-02-23 Tim-Philipp Müller + + Based on patch by: Tomasz Sałaciński + + * gst/subparse/gstsubparse.c: (parse_mdvdsub): + * tests/check/elements/subparse.c: (test_microdvd_with_italics), + (subparse_suite): + Forward slashes at the beginning and end of a line also signify + italics (Fixes: #518162). + 2008-02-22 Sebastian Dröge * tests/check/gst-plugins-base.supp: diff --git a/common b/common index 84c6d3e..bd6ec57 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 84c6d3efac27669ad45856ebe84a17d33359dc36 +Subproject commit bd6ec57040fe3fa93e21ca440dfe494e3ee18555 diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c index ab18bd4..30fdc1b 100644 --- a/gst/subparse/gstsubparse.c +++ b/gst/subparse/gstsubparse.c @@ -455,10 +455,22 @@ parse_mdvdsub (ParserState * state, const gchar * line) if (sscanf (line, "{s:%u}", &fontsize) == 1) { line = strchr (line, '}') + 1; } + /* forward slashes at beginning/end signify italics too */ + if (g_str_has_prefix (line, "/")) { + italic = TRUE; + ++line; + } if ((line_split = strchr (line, '|'))) line_chunk = g_markup_escape_text (line, line_split - line); else line_chunk = g_markup_escape_text (line, strlen (line)); + + /* Remove italics markers at end of line/stanza (CHECKME: are end slashes + * always at the end of a line or can they span multiple lines?) */ + if (g_str_has_suffix (line_chunk, "/")) { + line_chunk[strlen (line_chunk) - 1] = '\0'; + } + markup = g_string_append (markup, "italics\n" "not italics"} + }; + + test_microdvd_do_test (microdvd_italics, G_N_ELEMENTS (microdvd_italics)); +} + +GST_END_TEST; + GST_START_TEST (test_microdvd_with_fps) { static SubParseInputChunk microdvd_input[] = { @@ -558,6 +574,7 @@ subparse_suite (void) tcase_add_test (tc_chain, test_tmplayer_style4); tcase_add_test (tc_chain, test_tmplayer_style4_with_bogus_lines); tcase_add_test (tc_chain, test_microdvd_with_fps); + tcase_add_test (tc_chain, test_microdvd_with_italics); tcase_add_test (tc_chain, test_mpl2); tcase_add_test (tc_chain, test_subviewer); tcase_add_test (tc_chain, test_subviewer2); -- 2.7.4