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 using lyx::support::subst;
37 pair<bool, string> escapeChar(char c)
43 return make_pair(true, string(" "));
45 case '\0': // Ignore :-)
93 return make_pair(false, str);
97 int openTag(Buffer const & buf, ostream & os, Paragraph::depth_type depth,
98 bool mixcont, string const & name, string const & param)
100 Counters & counters = buf.params().getLyXTextClass().counters();
101 LyXLayout_ptr const & defaultstyle = buf.params().getLyXTextClass().defaultLayout();
103 string attribute = param;
104 // code for paragraphs like the standard paragraph in AGU.
105 if ( defaultstyle->latexname() == name and !defaultstyle->latexparam().empty()) {
107 int i = counters.value(name);
108 attribute += "" + subst(defaultstyle->latexparam(), "#", tostr(i));
111 if (!name.empty() && name != "!-- --") {
113 os << string(depth, ' ');
115 if (!attribute.empty())
116 os << " " << attribute;
124 int closeTag(ostream & os, Paragraph::depth_type depth,
125 bool mixcont, string const & name)
127 if (!name.empty() && name != "!-- --") {
129 os << '\n' << string(depth, ' ');
130 os << "</" << name << '>';