summaryrefslogtreecommitdiff
path: root/dviware/dvisvgm/src/XMLNode.cpp
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-01-12 03:01:29 +0000
committerNorbert Preining <norbert@preining.info>2023-01-12 03:01:29 +0000
commit6a7900c93acc16d1bbd2f1e26286c7dd7387e6c0 (patch)
tree76196287351cba68a51934c49468bf1a7846aa76 /dviware/dvisvgm/src/XMLNode.cpp
parentc1c19023b4b1d43cb874f84df5102b485853e672 (diff)
CTAN sync 202301120301
Diffstat (limited to 'dviware/dvisvgm/src/XMLNode.cpp')
-rw-r--r--dviware/dvisvgm/src/XMLNode.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/dviware/dvisvgm/src/XMLNode.cpp b/dviware/dvisvgm/src/XMLNode.cpp
index 0f2602f8f0..d5342e4d1e 100644
--- a/dviware/dvisvgm/src/XMLNode.cpp
+++ b/dviware/dvisvgm/src/XMLNode.cpp
@@ -2,7 +2,7 @@
** XMLNode.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2022 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2023 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -63,6 +63,14 @@ unique_ptr<XMLNode> XMLNode::removeNext () {
return oldnext;
}
+
+XMLElement* XMLNode::nextElement () const {
+ for (XMLNode *node = next(); node; node = node->next())
+ if (node->toElement())
+ return node->toElement();
+ return nullptr;
+}
+
/////////////////////////////////////////////////////////////////////
XMLElement::XMLElement (string name) : _name(std::move(name)) {
@@ -375,7 +383,8 @@ ostream& XMLElement::write (ostream &os) const {
if (attrib.name.front() != '@')
os << attrib.name << "='" << attrib.value << '\'';
else {
- os << attrib.name.substr(1) << "='";
+ bool keep = (attrib.name.size() > 1 && attrib.name[1] == '@');
+ os << attrib.name.substr(keep ? 2 : 1) << "='";
auto pos = attrib.value.find("base64,");
if (pos == string::npos)
os << attrib.value;
@@ -387,7 +396,7 @@ ostream& XMLElement::write (ostream &os) const {
os << '\n';
util::base64_copy(ifs, os, 200);
ifs.close();
- if (!KEEP_ENCODED_FILES)
+ if (!KEEP_ENCODED_FILES && !keep)
FileSystem::remove(fname);
}
}