string style;
current.vertical_position.line = 0;
+ /* XXX: arbitrary */
+ current.vertical_position.lines = 32;
current.vertical_position.reference = TOP_OF_SUBTITLE;
for (size_t i = 0; i < line.length(); ++i) {
state = STYLE;
} else if (c == '\\') {
state = BACKSLASH;
- } else {
+ } else if (c != '\r' && c != '\n') {
current.text += c;
}
break;
}
break;
case BACKSLASH:
- if (c == 'n' && !current.text.empty ()) {
+ if ((c == 'n' || c == 'N') && !current.text.empty ()) {
subs.push_back (current);
current.text = "";
current.vertical_position.line = current.vertical_position.line.get() + 1;
}
trim (*line);
+ remove_unicode_bom (line);
if (starts_with (*line, ";") || line->empty ()) {
continue;
vector<string> event;
split (event, body, is_any_of (","));
+ /* There may be commas in the subtitle part; reassemble any extra parts
+ from when we just split it.
+ */
+ while (event.size() > event_format.size()) {
+ string const ex = event.back ();
+ event.pop_back ();
+ event.back() += "," + ex;
+ }
+
SUB_ASSERT (!event.empty());
SUB_ASSERT (event_format.size() == event.size());
sub.vertical_position.line = 0;
} else if (event_format[i] == "Text") {
- sub.text = event[i];
+ BOOST_FOREACH (sub::RawSubtitle j, parse_line (sub, event[i])) {
+ _subs.push_back (j);
+ }
}
}
-
- _subs.push_back (sub);
}
}