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>
30 using lyx::support::subst;
35 using std::ostringstream;
41 pair<bool, string> escapeChar(char c)
47 return make_pair(true, string(" "));
49 case '\0': // Ignore :-)
97 return make_pair(false, str);
101 string escapeString(string const & raw)
105 for(string::size_type i = 0; i < raw.size(); ++i) {
108 boost::tie(ws, str) = sgml::escapeChar(raw[i]);
115 int openTag(Buffer const & buf, ostream & os, Paragraph::depth_type depth,
116 bool mixcont, string const & name, string const & param)
118 Counters & counters = buf.params().getLyXTextClass().counters();
119 LyXLayout_ptr const & defaultstyle = buf.params().getLyXTextClass().defaultLayout();
121 string attribute = param;
122 // code for paragraphs like the standard paragraph in AGU.
123 if ( defaultstyle->latexname() == name and !defaultstyle->latexparam().empty()) {
125 int i = counters.value(name);
126 attribute += "" + subst(defaultstyle->latexparam(), "#", tostr(i));
129 if (!name.empty() && name != "!-- --") {
131 os << string(depth, ' ');
133 if (!attribute.empty())
134 os << " " << attribute;
142 int closeTag(ostream & os, Paragraph::depth_type depth,
143 bool mixcont, string const & name)
145 if (!name.empty() && name != "!-- --") {
147 os << '\n' << string(depth, ' ');
148 os << "</" << name << '>';