]> git.lyx.org Git - lyx.git/blobdiff - src/sgml.C
include sys/time.h
[lyx.git] / src / sgml.C
index b170d7b76f194dd79b71c410b6e80596a3b102b5..435d71cc13cf8a57a94337d87ef17c35307d1c36 100644 (file)
@@ -7,18 +7,24 @@
  * \author John Levon <levon@movementarian.org>
  */
 
-#include "sgml.h"
+#include <config.h>
+
+#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<bool, string> escapeChar(char c)
 {
        string str;
+
        switch (c) {
        case Paragraph::META_HFILL:
                break;
@@ -77,4 +83,36 @@ pair<bool, string> 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 << "</" << latexname << '>';
+       }
+
+       if (!mixcont)
+               os << endl;
+
+       return !mixcont;
+}
+
 } // namespace sgml