mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-27 11:32:51 +00:00
Forward slashes at the beginning and end of a line also signify italics (Fixes: #518162).
Original commit message from CVS: Based on patch by: Tomasz Sałaciński <tsalacinski gmail com> * 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).
This commit is contained in:
parent
b88a725148
commit
6ab3a0e0c0
4 changed files with 40 additions and 1 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2008-02-23 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
Based on patch by: Tomasz Sałaciński <tsalacinski gmail com>
|
||||
|
||||
* 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 <slomo@circular-chaos.org>
|
||||
|
||||
* tests/check/gst-plugins-base.supp:
|
||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
|||
Subproject commit 84c6d3efac27669ad45856ebe84a17d33359dc36
|
||||
Subproject commit bd6ec57040fe3fa93e21ca440dfe494e3ee18555
|
|
@ -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, "<span");
|
||||
if (italic)
|
||||
g_string_append (markup, " style=\"italic\"");
|
||||
|
|
|
@ -423,6 +423,22 @@ GST_START_TEST (test_tmplayer_style4_with_bogus_lines)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_microdvd_with_italics)
|
||||
{
|
||||
static SubParseInputChunk microdvd_italics[] = {
|
||||
{
|
||||
"{1}{1}25.000 movie info: XVID 608x256 25.0fps 699.0 MB|"
|
||||
"/SubEdit b.4060(http://subedit.com.pl)/\n"
|
||||
"{100}{200}/italics/|not italics\n",
|
||||
4 * GST_SECOND, 8 * GST_SECOND,
|
||||
"<span style=\"italic\">italics</span>\n" "<span>not italics</span>"}
|
||||
};
|
||||
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue