3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
17 #include "bufferparams.h"
20 #include "paragraph.h"
22 #include "support/lstrings.h"
23 #include "support/std_ostream.h"
24 #include "support/tostr.h"
26 #include <boost/tuple/tuple.hpp>
29 using lyx::support::subst;
34 using std::ostringstream;
40 pair<bool, string> escapeChar(char c)
46 return make_pair(true, string(" "));
48 case '\0': // Ignore :-)
96 return make_pair(false, str);
100 string escapeString(string const & raw)
104 for(unsigned int i=0; i < raw.size(); ++i) {
107 boost::tie(ws, str) = sgml::escapeChar(raw[i]);
114 int openTag(Buffer const & buf, ostream & os, Paragraph::depth_type depth,
115 bool mixcont, string const & name, string const & param)
117 Counters & counters = buf.params().getLyXTextClass().counters();
118 LyXLayout_ptr const & defaultstyle = buf.params().getLyXTextClass().defaultLayout();
120 string attribute = param;
121 // code for paragraphs like the standard paragraph in AGU.
122 if ( defaultstyle->latexname() == name and !defaultstyle->latexparam().empty()) {
124 int i = counters.value(name);
125 attribute += "" + subst(defaultstyle->latexparam(), "#", tostr(i));
128 if (!name.empty() && name != "!-- --") {
130 os << string(depth, ' ');
132 if (!attribute.empty())
133 os << " " << attribute;
141 int closeTag(ostream & os, Paragraph::depth_type depth,
142 bool mixcont, string const & name)
144 if (!name.empty() && name != "!-- --") {
146 os << '\n' << string(depth, ' ');
147 os << "</" << name << '>';