diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-09-11 00:10:22 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-02-04 00:21:36 +0100 |
| commit | 27446bb97f50645ea57b07c120c4b8e87859e113 (patch) | |
| tree | d6ddba629d237d3c172fc3bc791c072634eca889 /src/lib/text_content.cc | |
| parent | b8854f940dde148468ec8aa57379e0fe643eebf0 (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 a85b271a8..d4468f7e5 100644 --- a/src/lib/text_content.cc +++ b/src/lib/text_content.cc @@ -236,8 +236,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. @@ -410,7 +413,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"); } } |
