X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsgml.C;h=9104cda839cb7b3f2eb7ca913a951f7e7f3b7dbf;hb=09e01879979643949f1f2c7216023f1f35d5ada2;hp=b170d7b76f194dd79b71c410b6e80596a3b102b5;hpb=0b95bed2953cf7d9dcdf950851fea08a12f21af6;p=lyx.git diff --git a/src/sgml.C b/src/sgml.C index b170d7b76f..9104cda839 100644 --- a/src/sgml.C +++ b/src/sgml.C @@ -7,24 +7,25 @@ * \author John Levon */ -#include "sgml.h" +#include + +#include "support/LOstream.h" + #include "paragraph.h" - +#include "sgml.h" + using std::pair; using std::make_pair; - +using std::ostream; +using std::endl; + namespace sgml { pair escapeChar(char c) { string str; - + switch (c) { - case Paragraph::META_HFILL: - break; - case Paragraph::META_NEWLINE: - str = '\n'; - break; case ' ': return make_pair(true, string(" ")); break; @@ -77,4 +78,36 @@ pair escapeChar(char c) return make_pair(false, str); } + +int openTag(ostream & os, Paragraph::depth_type depth, + bool mixcont, string const & latexname) +{ + if (!latexname.empty() && latexname != "!-- --") { + if (!mixcont) + os << string(depth, ' '); + os << '<' << latexname << '>'; + } + + if (!mixcont) + os << endl; + + return !mixcont; +} + + +int closeTag(ostream & os, Paragraph::depth_type depth, + bool mixcont, string const & latexname) +{ + if (!latexname.empty() && latexname != "!-- --") { + if (!mixcont) + os << endl << string(depth, ' '); + os << "'; + } + + if (!mixcont) + os << endl; + + return !mixcont; +} + } // namespace sgml