diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-09-11 00:10:22 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-01-28 02:01:22 +0100 |
| commit | 591c89275bfa26c3b2e1b0f1926909fc4bf5b219 (patch) | |
| tree | 75dd0838141b38081bc754f6b88d4c56f7f5b083 /src/lib/text_content.cc | |
| parent | d0e74dea9d189187d456173702a54a3b3c72aca0 (diff) | |
Normalise XML attribute names to be camelCase (#2241).
Diffstat (limited to 'src/lib/text_content.cc')
| -rw-r--r-- | src/lib/text_content.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/text_content.cc b/src/lib/text_content.cc index 92a35b822..09f6e41b6 100644 --- a/src/lib/text_content.cc +++ b/src/lib/text_content.cc @@ -235,8 +235,11 @@ TextContent::TextContent (Content* parent, cxml::ConstNodePtr node, int version, if (lang) { try { _language = dcp::LanguageTag(lang->content()); - auto add = lang->optional_bool_attribute("Additional"); - _language_is_additional = add && *add; + auto additional = lang->optional_bool_attribute("Additional"); + if (!additional) { + additional = lang->optional_bool_attribute("additional"); + } + _language_is_additional = additional.get_value_or(false); } catch (dcp::LanguageTagError&) { /* The language tag can be empty or invalid if it was loaded from a * 2.14.x metadata file; we'll just ignore it in that case. @@ -409,7 +412,7 @@ TextContent::as_xml (xmlpp::Node* root) const if (_language) { auto lang = text->add_child("Language"); lang->add_child_text (_language->to_string()); - lang->set_attribute ("Additional", _language_is_additional ? "1" : "0"); + lang->set_attribute("additional", _language_is_additional ? "1" : "0"); } } |
