summaryrefslogtreecommitdiff
path: root/src/subtitle_asset.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-02-16 21:56:22 +0100
committerCarl Hetherington <cth@carlh.net>2023-02-16 21:56:22 +0100
commit89fbc8d186378cd72ab3e9a259073d45b7b993ad (patch)
tree57d7cf19ca2f21f1acb9da4e7d7e9888cdab2163 /src/subtitle_asset.cc
parent8b86c990e526e55e273cc408377f13e64a27fb26 (diff)
Change how whitespace in subtitles is handled.
Previously we would discard any whitespace subtitle content we found. This had the side-effect of making a verification test fail (checking that at least one subtitle is in each reel; blank subtitles are often used to avoid this warning). Here we take any subtitle content, whitespace or not, inside a <Text> or <Image> node which I think is a little more correct.
Diffstat (limited to 'src/subtitle_asset.cc')
-rw-r--r--src/subtitle_asset.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc
index f707c665..4baa7b06 100644
--- a/src/subtitle_asset.cc
+++ b/src/subtitle_asset.cc
@@ -324,7 +324,11 @@ SubtitleAsset::parse_subtitles (xmlpp::Element const * node, vector<ParseState>&
void
SubtitleAsset::maybe_add_subtitle (string text, vector<ParseState> const & parse_state, float space_before, Standard standard)
{
- if (empty_or_white_space (text)) {
+ auto wanted = [](ParseState const& ps) {
+ return ps.type && (ps.type.get() == ParseState::Type::TEXT || ps.type.get() == ParseState::Type::IMAGE);
+ };
+
+ if (find_if(parse_state.begin(), parse_state.end(), wanted) == parse_state.end()) {
return;
}