#include "BufferParams.h"
#include "Counters.h"
#include "LaTeXFeatures.h"
-#include "OutputParams.h"
#include "output_xhtml.h"
#include "xml.h"
#include "texstream.h"
return;
string const cmd = getCmdName();
- docstring cntr = getParam("counter");
+ docstring const & cntr = getParam("counter");
Counters & cnts = buffer().params().documentClass().counters();
+ docstring const & latexname = cnts.latexName(cntr);
+
if (cmd == "set") {
docstring const & val = getParam("value");
- os << "\\setcounter{" << cntr << "}{" << val << "}";
+ os << "\\setcounter{" << latexname << "}{" << val << "}";
} else if (cmd == "addto") {
docstring const & val = getParam("value");
- os << "\\addtocounter{" << cntr << "}{" << val << "}";
+ os << "\\addtocounter{" << latexname << "}{" << val << "}";
} else if (cmd == "reset") {
- os << "\\setcounter{" << cntr << "}{0}";
+ os << "\\setcounter{" << latexname << "}{0}";
} else if (cmd == "save") {
cnts.saveValue(cntr);
- os << "\\setcounter{" << lyxSaveCounter()
- << "}{\\value{" << cntr << "}}";
+ os << "\\setcounter{" << lyxSaveCounter()
+ << "}{\\value{" << latexname << "}}";
} else if (cmd == "restore") {
cnts.restoreValue(cntr);
- os << "\\setcounter{" << cntr
- << "{\\value{" << lyxSaveCounter() << "}}";
+ os << "\\setcounter{" << latexname
+ << "}{\\value{" << lyxSaveCounter() << "}}";
}
}
void InsetCounter::toString(odocstream & os) const
{
- os << "[Counter " << from_utf8(getCmdName()) << ": "
+ os << "[Counter " << from_utf8(getCmdName()) << ": "
<< getParam("counter") << "]";
}
}
}
-void InsetCounter::docbook(odocstream &, OutputParams const &) const
+void InsetCounter::docbook(XMLStream &, OutputParams const &) const
{
// Here, we need to track counter values ourselves,
// since unlike in the LaTeX case, there is no external
screen_label_ = bformat(_("Counter: Add to %1$s"), guiname);
tooltip_ = bformat(_("Add %1$s to value of counter %2$s"), val, cntr);
} else if (cmd == "reset") {
- cnts.reset(cntr);
+ cnts.reset(cntr);
screen_label_ = bformat(_("Counter: Reset %1$s"), guiname);
tooltip_ = bformat(_("Reset value of counter %1$s"), cntr);
} else if (cmd == "save") {
}
-string InsetCounter::contextMenuName() const
-{
- return "context-counter";
+string InsetCounter::contextMenuName() const
+{
+ return "context-counter";
}
} // namespace lyx