2016-07-02 Carl Hetherington <cth@carlh.net>
+ * Fix problems with markup in subrip/SSA/ASS.
+
* Updated ru_RU translation from Igor Voytovich.
* Updated uk_UA translation from Igor Voytovich.
bool bold = false;
bool underline = false;
BOOST_FOREACH (dcp::SubtitleString const & i, subtitles) {
+
if (i.italic() && !italic) {
out += "<i>";
}
if (i.underline() && !underline) {
out += "<u>";
}
-
- out += i.text ();
-
if (!i.underline() && underline) {
out += "</u>";
}
italic = i.italic ();
bold = i.bold ();
underline = i.underline ();
+
+ out += i.text ();
}
if (underline) {
add (s, "Hello", true, true, true);
BOOST_CHECK_EQUAL (marked_up (s), "<i><b><u>Hello</u></b></i>");
}
+
+/** Test marked_up() in render_subtitles.cc */
+BOOST_AUTO_TEST_CASE (render_markup_test5)
+{
+ std::list<dcp::SubtitleString> s;
+ add (s, "Hello", false, true, false);
+ add (s, " world.", false, false, false);
+ BOOST_CHECK_EQUAL (marked_up (s), "<b>Hello</b> world.");
+}
+
+/** Test marked_up() in render_subtitles.cc */
+BOOST_AUTO_TEST_CASE (render_markup_test6)
+{
+ std::list<dcp::SubtitleString> s;
+ add (s, "Hello", true, false, false);
+ add (s, " world ", false, false, false);
+ add (s, "we are bold.", false, true, false);
+ BOOST_CHECK_EQUAL (marked_up (s), "<i>Hello</i> world <b>we are bold.</b>");
+}