]> git.lyx.org Git - lyx.git/commitdiff
Reorganized docbook export code and fixed several bugs in the process.
authorJosé Matox <jamatos@lyx.org>
Sun, 24 Oct 2004 00:02:39 +0000 (00:02 +0000)
committerJosé Matox <jamatos@lyx.org>
Sun, 24 Oct 2004 00:02:39 +0000 (00:02 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9114 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/buffer.C
src/insets/ChangeLog
src/insets/insettext.C
src/output_docbook.C
src/output_docbook.h
src/paragraph.C
src/sgml.C

index 3a43219c9952583211f0e170f5b766c562d19818..ba7efadc606ba6f03b0b5550eda9258945caa35e 100644 (file)
@@ -1,3 +1,14 @@
+2004-10-23  José Matos  <jamatos@lyx.org>
+
+       * buffer.C (makeDocBookFile): reorganize the comments about lyx.
+       * output_docbook.[Ch]: new functions to encapsulate the way lyx exports
+       docbook. The new scheme is recursive and makes use of iterators, the
+       same as latex export works.
+       * paragraph.C (simpleDocBookOnePar): removed coud that does not deal
+       directly with the paragraph contents. This code was moved up to
+       output_docbook.C (docbookParagraphs).
+       * sgml.C (openTag, closeTag): removed unneeded newlines.
+       (closeEnvTags) removed.
 
 2003-10-23  André Pönitz  <poenitz@gmx.net>
 
 
 2003-10-23  André Pönitz  <poenitz@gmx.net>
 
index 999b1dd041de8faca49231e0cd2dcea4c28431ef..7c624aaecf726cb9e26f2c9f8565dee222d0037e 100644 (file)
@@ -1119,16 +1119,16 @@ void Buffer::makeDocBookFile(string const & fname,
                top += ' ';
                top += params().options;
        }
                top += ' ';
                top += params().options;
        }
-       sgml::openTag(ofs, 0, false, top);
 
        ofs << "<!-- " << ((runparams.flavor == OutputParams::XML)? "XML" : "SGML")
            << " file was created by LyX " << lyx_version
            << "\n  See http://www.lyx.org/ for more information -->\n";
 
        params().getLyXTextClass().counters().reset();
 
        ofs << "<!-- " << ((runparams.flavor == OutputParams::XML)? "XML" : "SGML")
            << " file was created by LyX " << lyx_version
            << "\n  See http://www.lyx.org/ for more information -->\n";
 
        params().getLyXTextClass().counters().reset();
-       docbookParagraphs(*this, paragraphs(), ofs, runparams);
 
 
-       ofs << "\n\n";
+       sgml::openTag(ofs, 0, false, top);
+       ofs << '\n';
+       docbookParagraphs(paragraphs(), *this, ofs, runparams);
        sgml::closeTag(ofs, 0, false, top_element);
 
        ofs.close();
        sgml::closeTag(ofs, 0, false, top_element);
 
        ofs.close();
index e3553d570e4038852425bb256a79e0ec39c75760..ad64556a71724b21e2d6884db1257489f6ffaa5c 100644 (file)
@@ -1,3 +1,7 @@
+2004-10-23  José Matos  <jamatos@lyx.org>
+
+       * insettext.C (docbook): rearrange arguments, due to change in the upper
+       code.
 
 2004-10-23  André Pönitz  <poenitz@gmx.net>
 
 
 2004-10-23  André Pönitz  <poenitz@gmx.net>
 
index 01428d15a43d9570f5acb376af437f77a50d7c0f..ba6feb7617bebfc96a5168a871c7f8b84bf349dc 100644 (file)
@@ -352,7 +352,7 @@ int InsetText::linuxdoc(Buffer const & buf, ostream & os,
 int InsetText::docbook(Buffer const & buf, ostream & os,
                       OutputParams const & runparams) const
 {
 int InsetText::docbook(Buffer const & buf, ostream & os,
                       OutputParams const & runparams) const
 {
-       docbookParagraphs(buf, paragraphs(), os, runparams);
+       docbookParagraphs(paragraphs(), buf, os, runparams);
        return 0;
 }
 
        return 0;
 }
 
index a5285e51b185fe7a670f2972e2f9b85ea606a4ba..5b8488e4575d0657e6850914d9aed151af007d76 100644 (file)
 #include "support/lyxlib.h"
 #include "support/tostr.h"
 
 #include "support/lyxlib.h"
 #include "support/tostr.h"
 
-#include <stack>
-
 #ifdef HAVE_LOCALE
 #endif
 
 #ifdef HAVE_LOCALE
 #endif
 
-using lyx::support::atoi;
-using lyx::support::split;
 using lyx::support::subst;
 
 using std::endl;
 using lyx::support::subst;
 
 using std::endl;
@@ -44,222 +40,306 @@ using std::stack;
 using std::vector;
 using std::string;
 
 using std::vector;
 using std::string;
 
+namespace {
 
 
-void docbookParagraphs(Buffer const & buf,
-                      ParagraphList const & paragraphs,
-                      ostream & os,
-                      OutputParams const & runparams)
+ParagraphList::const_iterator searchParagraph(ParagraphList::const_iterator const & par,
+                                             ParagraphList::const_iterator const & pend)
 {
 {
-       vector<string> environment_stack(10);
-       vector<string> environment_inner(10);
-       vector<string> command_stack(10);
-
-       bool command_flag = false;
-       Paragraph::depth_type command_depth = 0;
-       Paragraph::depth_type command_base = 0;
-       Paragraph::depth_type cmd_depth = 0;
-       Paragraph::depth_type depth = 0; // paragraph depth
+       ParagraphList::const_iterator p = par + 1;
 
 
-       string command_name;
+       for( ; p != pend && p->layout()->latextype == LATEX_PARAGRAPH; ++p);
 
 
-       string item_tag;
+       return p;
+}
 
 
-       ParagraphList::const_iterator par = paragraphs.begin();
-       ParagraphList::const_iterator pend = paragraphs.end();
 
 
-       Counters & counters = buf.params().getLyXTextClass().counters();
+ParagraphList::const_iterator searchCommand(ParagraphList::const_iterator const & par,
+                                           ParagraphList::const_iterator const & pend)
+{
+       LyXLayout_ptr const & bstyle = par->layout();
+       ParagraphList::const_iterator p = par + 1;
 
 
-       for (; par != pend; ++par) {
+       for( ; p != pend; ++p) {
+               LyXLayout_ptr const & style = p->layout();
+               if( style->latextype == LATEX_COMMAND && style->commanddepth <= bstyle->commanddepth)
+                       return p;
+       }
+       return pend;
+}
 
 
-               LyXLayout_ptr const & style = par->layout();
 
 
-               // environment tag closing
-               for (; depth > par->params().depth(); --depth) {
-                       sgml::closeEnvTags(os, false, environment_inner[depth],
-                               item_tag, command_depth + depth);
-                       sgml::closeTag(os, depth + command_depth, false, environment_stack[depth]);
-                       environment_stack[depth].erase();
-                       environment_inner[depth].erase();
+ParagraphList::const_iterator searchEnvironment(ParagraphList::const_iterator const & par,
+                                               ParagraphList::const_iterator const & pend)
+{
+       LyXLayout_ptr const & bstyle = par->layout();
+       ParagraphList::const_iterator p = par + 1;
+       for( ; p != pend; ++p) {
+               LyXLayout_ptr const & style = p->layout();
+               if( style->latextype == LATEX_COMMAND)
+                       return p;
+
+               if( style->latextype == LATEX_PARAGRAPH) {
+                       if (p->params().depth() > par->params().depth())
+                               continue;
+                       return p;
                }
 
                }
 
-               if (depth == par->params().depth()
-                  && environment_stack[depth] != style->latexname()
-                  && !environment_stack[depth].empty()) {
-                               sgml::closeEnvTags(os, false, environment_inner[depth],
-                                       item_tag, command_depth + depth);
-                       sgml::closeTag(os, depth + command_depth, false, environment_stack[depth]);
+               if( style->latexname() != bstyle->latexname() and p->params().depth() <= par->params().depth())
+                       return p;
+       }
+       return pend;
+}
 
 
-                       environment_stack[depth].erase();
-                       environment_inner[depth].erase();
-               }
 
 
-               string ls = par->getDocbookId();
-               if (!ls.empty())
-                       ls = " id = \"" + ls + "\"";
+ParagraphList::const_iterator makeParagraph(Buffer const & buf,
+                                           ostream & os,
+                                           OutputParams const & runparams,
+                                           ParagraphList const & paragraphs,
+                                           ParagraphList::const_iterator const & pbegin,
+                                           ParagraphList::const_iterator const & pend) {
+       ParagraphList::const_iterator par = pbegin;
+       Counters & counters = buf.params().getLyXTextClass().counters();
+       const int depth = 0;
 
 
-               // Write opening SGML tags.
-               switch (style->latextype) {
-               case LATEX_PARAGRAPH:
-                       if (!style->latexparam().empty()) {
-                               counters.step("para");
-                               int i = counters.value("para");
-                               ls = subst(style->latexparam(), "#", tostr(i));
-                       }
+       for(; par != pend; ++par) {
+               LyXLayout_ptr const & style = par->layout();
+               string id = par->getDocbookId();
+       
+               if (!style->latexparam().empty()) {
+                       counters.step("para");
+                       int i = counters.value("para");
+                       id = subst(style->latexparam(), "#", tostr(i));
+               }
 
 
-                       sgml::openTag(os, depth + command_depth,
-                                   false, style->latexname(), ls);
-                       break;
+               id = id.empty()? "": " id = \"" + id + "\"";
+               sgml::openTag(os, depth, true, style->latexname(), id);
+               par->simpleDocBookOnePar(buf, os, outerFont(par - paragraphs.begin(), paragraphs), runparams, depth);
+       
+               sgml::closeTag(os, depth, true, style->latexname());
+               os << '\n';
+       }
+       return pend;
+}
 
 
-               case LATEX_COMMAND:
-                       if (depth != 0)
-                               //error(ErrorItem(_("Error"), _("Wrong depth for LatexType Command."), par->id(), 0, par->size()));
-                               ;
-
-                       command_name = style->latexname();
-
-                       cmd_depth = style->commanddepth;
-
-                       if (command_flag) {
-                               if (cmd_depth < command_base) {
-                                       for (Paragraph::depth_type j = command_depth;
-                                            j >= command_base; --j) {
-                                               sgml::closeTag(os, j, false, command_stack[j]);
-                                               os << endl;
-                                       }
-                                       command_depth = command_base = cmd_depth;
-                               } else if (cmd_depth <= command_depth) {
-                                       for (int j = command_depth;
-                                            j >= int(cmd_depth); --j) {
-                                               sgml::closeTag(os, j, false, command_stack[j]);
-                                               os << endl;
-                                       }
-                                       command_depth = cmd_depth;
-                               } else
-                                       command_depth = cmd_depth;
-                       } else {
-                               command_depth = command_base = cmd_depth;
-                               command_flag = true;
-                       }
-                       if (command_stack.size() == command_depth + 1)
-                               command_stack.push_back(string());
-                       command_stack[command_depth] = command_name;
 
 
-                       if (style->latexparam().find('#') != string::npos) {
-                               counters.step(style->counter);
-                       }
+ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
+                                             ostream & os,
+                                             OutputParams const & runparams,
+                                             ParagraphList const & paragraphs,
+                                             ParagraphList::const_iterator const & pbegin,
+                                             ParagraphList::const_iterator const & pend) {
+       ParagraphList::const_iterator par = pbegin;
 
 
-                       if (!style->latexparam().empty()) {
-                               ls = style->latexparam();
-                               if (ls.find('#') != string::npos) {
-                                       string el = expandLabel(buf.params().getLyXTextClass(),
-                                               style, false);
-                                       ls = subst(ls, "#", el);
-                               }
-                       }
+       Counters & counters = buf.params().getLyXTextClass().counters();
+       LyXLayout_ptr const & defaultstyle = buf.params().getLyXTextClass().defaultLayout();
+       const int depth = 0;
 
 
-                       sgml::openTag(os, depth + command_depth, false, command_name, ls);
+       LyXLayout_ptr const & bstyle = par->layout();
+       string item_tag;
+       
+       string id = par->getDocbookId();
+       string env_name = bstyle->latexname();
+       // Opening outter tag
+       sgml::openTag(os, depth, false, env_name, bstyle->latexparam() + id);
+       os << '\n';
+       if (bstyle->latextype == LATEX_ENVIRONMENT and bstyle->innertag() == "CDATA")
+               os << "<![CDATA[";
+
+       while (par != pend) {
+               LyXLayout_ptr const & style = par->layout();
+               string id = "";
+               ParagraphList::const_iterator send;
+               string wrapper = "";
 
 
-                       // Label around sectioning number:
-                       if (!style->labeltag().empty()) {
-                               sgml::openTag(os, depth + 1 + command_depth, false,
-                                       style->labeltag());
-                               os << expandLabel(buf.params().getLyXTextClass(), style, false);
-                               sgml::closeTag(os, depth + 1 + command_depth, false,
-                                       style->labeltag());
+               // Opening inner tag
+               switch (bstyle->latextype) {
+               case LATEX_ENVIRONMENT:
+                       if (!bstyle->innertag().empty() and bstyle->innertag() != "CDATA") {
+                               sgml::openTag(os, depth, true, bstyle->innertag());
                        }
                        }
-
-                       // Inner tagged header text, e.g. <title> for sectioning:
-                       sgml::openTag(os, depth + 1 + command_depth, false,
-                               style->innertag());
                        break;
 
                        break;
 
-               case LATEX_ENVIRONMENT:
                case LATEX_ITEM_ENVIRONMENT:
                case LATEX_ITEM_ENVIRONMENT:
-                       if (depth < par->params().depth()) {
-                               depth = par->params().depth();
-                               environment_stack[depth].erase();
-                       }
-
-                       if (environment_stack[depth] != style->latexname()) {
-                               if (environment_stack.size() == depth + 1) {
-                                       environment_stack.push_back("!-- --");
-                                       environment_inner.push_back("!-- --");
-                               }
-                               environment_stack[depth] = style->latexname();
-                               environment_inner[depth] = "!-- --";
-                               // outputs <environment_stack[depth] latexparam()>
-                               sgml::openTag(os, depth + command_depth, false,
-                                               environment_stack[depth], style->latexparam() + ls);
+                       if (!bstyle->labeltag().empty()) {
+                               sgml::openTag(os, depth, true, bstyle->labeltag());
                        } else {
                        } else {
-                               sgml::closeEnvTags(os, false, environment_inner[depth],
-                                       style->itemtag(), command_depth + depth);
-                       }
-
-                       if (style->latextype == LATEX_ENVIRONMENT) {
-                               if (!style->innertag().empty()) {
-                                       if (style->innertag() == "CDATA")
-                                               os << "<![CDATA[";
-                                       else
-                                               sgml::openTag(os, depth + command_depth, false,
-                                                       style->innertag());
+                               if (!defaultstyle->latexparam().empty()) {
+                                       counters.step("para");
+                                       id = tostr(counters.value("para"));
+                                       id = " id=\""+ subst(defaultstyle->latexparam(), "#", id) + '"';
+                                       wrapper = defaultstyle->latexname();
                                }
                                }
-                               break;
+                               sgml::openTag(os, depth, true, bstyle->itemtag());
                        }
                        }
+               default:
+                       break;
+               }
 
 
-                       environment_inner[depth] = style->innertag();
+               switch (style->latextype) {
+               case LATEX_ENVIRONMENT:
+               case LATEX_ITEM_ENVIRONMENT: {
+                       if(par->params().depth() == pbegin->params().depth()) {
+                               sgml::openTag(os, depth, true, wrapper, id);
+                               par->simpleDocBookOnePar(buf, os, outerFont(par - paragraphs.begin(), paragraphs), runparams, depth);
+                               sgml::closeTag(os, depth, true, wrapper);
+                               ++par;
+                       }
+                       else {
+                               send = searchEnvironment(par, pend);
+                               par = makeEnvironment(buf, os, runparams, paragraphs, par,send);
+                       }
+                       break;
+               }
+               case LATEX_PARAGRAPH:
+                       send = searchParagraph(par, pend);
+                       par = makeParagraph(buf, os, runparams, paragraphs, par,send);
+                       break;
+               default:
+                       break;
+               }
 
 
-                       if (!environment_inner[depth].empty())
-                               sgml::openTag(os, depth + 1 + command_depth,
-                                   false, environment_inner[depth]);
+               // Closing inner tag
+               switch (bstyle->latextype) {
+               case LATEX_ENVIRONMENT:
+                       if (!bstyle->innertag().empty() and bstyle->innertag() != "CDATA") {
+                               sgml::closeTag(os, depth, true, bstyle->innertag());
+                               os << '\n';
+                       }
+                       break;
+               case LATEX_ITEM_ENVIRONMENT:
+                       sgml::closeTag(os, depth, true, bstyle->itemtag());
                        break;
                default:
                        break;
                default:
-                       sgml::openTag(os, depth + command_depth,
-                                   false, style->latexname(), ls);
                        break;
                }
                        break;
                }
+       }
+
+       if (bstyle->latextype == LATEX_ENVIRONMENT and bstyle->innertag() == "CDATA")
+               os << "]]>";
+
+       // Closing outter tag
+       sgml::closeTag(os, depth, false, env_name);
+
+       return pend;
+}
+
+
+ParagraphList::const_iterator makeCommand(Buffer const & buf,
+                                         ostream & os,
+                                         OutputParams const & runparams,
+                                         ParagraphList const & paragraphs,
+                                         ParagraphList::const_iterator const & pbegin,
+                                         ParagraphList::const_iterator const & pend)
+{
+       Paragraph::depth_type depth = 0; // paragraph depth
 
 
-               par->simpleDocBookOnePar(buf, os,
-                       outerFont(par - paragraphs.begin(), paragraphs),
-                       runparams, depth + 1 + command_depth);
+       ParagraphList::const_iterator par = pbegin;
+
+       Counters & counters = buf.params().getLyXTextClass().counters();
+       LyXLayout_ptr const & bstyle = par->layout();
+       
+       string id = par->getDocbookId();
+       id = id.empty()? "" : " id = \"" + id + "\"";
+
+       if (bstyle->latexparam().find('#') != string::npos) {
+               counters.step(bstyle->counter);
+       }
+       
+       if (!bstyle->latexparam().empty()) {
+               id = bstyle->latexparam();
+               if (id.find('#') != string::npos) {
+                       string el = expandLabel(buf.params().getLyXTextClass(),
+                                               bstyle, false);
+                       id = subst(id, "#", el);
+               }
+       }
+
+       //Open outter tag
+       sgml::openTag(os, depth, false, bstyle->latexname(), id);
+       os << '\n';
+
+       // Label around sectioning number:
+       if (!bstyle->labeltag().empty()) {
+               sgml::openTag(os, depth, false, bstyle->labeltag());
+               os << expandLabel(buf.params().getLyXTextClass(), bstyle, false);
+               sgml::closeTag(os, depth, false, bstyle->labeltag());
+       }
+       
+       // Opend inner tag
+       sgml::openTag(os, depth, true, bstyle->innertag());
+
+       par->simpleDocBookOnePar(buf, os, outerFont(par - paragraphs.begin(), paragraphs),
+                                runparams, depth);
+
+       // Close inner tags
+       sgml::closeTag(os, depth, true, bstyle->innertag());
+       os << '\n';
+       
+       ++par;
+       while (par != pend) {
+               LyXLayout_ptr const & style = par->layout();
+               ParagraphList::const_iterator send;
 
 
-               // write closing SGML tags
                switch (style->latextype) {
                switch (style->latextype) {
-               case LATEX_COMMAND:
-                       sgml::closeTag(os, depth + command_depth, false,
-                               style->innertag());
+               case LATEX_COMMAND: {
+                       send = searchCommand(par, pend);
+                       par = makeCommand(buf, os, runparams, paragraphs, par,send);
                        break;
                        break;
+               }
                case LATEX_ENVIRONMENT:
                case LATEX_ENVIRONMENT:
-                       if (!style->innertag().empty()) {
-                               if (style->innertag() == "CDATA")
-                                       os << "]]>";
-                               else
-                                       sgml::closeTag(os, depth + command_depth, false,
-                                               style->innertag());
-                       }
-                       break;
-               case LATEX_ITEM_ENVIRONMENT:
-                       item_tag = style->itemtag();
+               case LATEX_ITEM_ENVIRONMENT: {
+                       send = searchEnvironment(par, pend);
+                       par = makeEnvironment(buf, os, runparams, paragraphs, par,send);
                        break;
                        break;
+               }
                case LATEX_PARAGRAPH:
                case LATEX_PARAGRAPH:
-                       sgml::closeTag(os, depth + command_depth, false, style->latexname());
+                       send = searchParagraph(par, pend);
+                       par = makeParagraph(buf, os, runparams, paragraphs, par,send);
                        break;
                default:
                        break;
                default:
-                       sgml::closeTag(os, depth + command_depth, false, style->latexname());
                        break;
                }
        }
 
                        break;
                }
        }
 
-       // Close open tags
-       for (int d = depth; d >= 0; --d) {
-               if (!environment_stack[depth].empty()) {
-                       sgml::closeEnvTags(os, false, environment_inner[d], item_tag, command_depth + d);
-                       sgml::closeTag(os, d + command_depth, false, environment_stack[d]);
-               }
-       }
+       // Close outter tag
+       sgml::closeTag(os, depth, false, bstyle->latexname());
+
+       return pend;
+}
+
+} // end anonym namespace
+
+
+void docbookParagraphs(ParagraphList const & paragraphs,
+                      Buffer const & buf,
+                      ostream & os,
+                      OutputParams const & runparams)
+{
+       ParagraphList::const_iterator par = paragraphs.begin();
+       ParagraphList::const_iterator pend = paragraphs.end();
 
 
-       for (int j = command_depth; j >= 0 ; --j)
-               if (!command_stack[j].empty()) {
-                       sgml::closeTag(os, j, false, command_stack[j]);
-                       os << endl;
+       while (par != pend) {
+               LyXLayout_ptr const & style = par->layout();
+               ParagraphList::const_iterator send;
+
+               switch (style->latextype) {
+               case LATEX_COMMAND: {
+                       send = searchCommand(par, pend);
+                       par = makeCommand(buf, os, runparams, paragraphs, par,send);
+                       break;
+               }
+               case LATEX_ENVIRONMENT:
+               case LATEX_ITEM_ENVIRONMENT: {
+                       send = searchEnvironment(par, pend);
+                       par = makeEnvironment(buf, os, runparams, paragraphs, par,send);
+                       break;
                }
                }
+               case LATEX_PARAGRAPH:
+                       send = searchParagraph(par, pend);
+                       par = makeParagraph(buf, os, runparams, paragraphs, par,send);
+                       break;
+               default:
+                       break;
+               }
+       }
 }
 }
index 5c5092c4fffd7ab93e39843a3e28646e82fc34ba..41657ade8bc12f6c7bccea49a48c62c81b3995e6 100644 (file)
@@ -20,9 +20,8 @@ class OutputParams;
 class ParagraphList;
 
 ///
 class ParagraphList;
 
 ///
-void docbookParagraphs(Buffer const & buf,
-                      ParagraphList const & paragraphs,
+void docbookParagraphs(ParagraphList const & subset,
+                      Buffer const & buf,
                       std::ostream & os,
                       OutputParams const & runparams);
                       std::ostream & os,
                       OutputParams const & runparams);
-
 #endif
 #endif
index 83cc81d24a42452ba509fbb6e4ede3270f3e71b4..fce394073b38d7ae6049afd45bde6a9aa3dfae22 100644 (file)
@@ -1354,6 +1354,7 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
                                    lyx::depth_type depth) const
 {
        bool emph_flag = false;
                                    lyx::depth_type depth) const
 {
        bool emph_flag = false;
+       int char_line_count = 0;
 
        LyXLayout_ptr const & style = layout();
        LyXLayout_ptr const & defaultstyle =
 
        LyXLayout_ptr const & style = layout();
        LyXLayout_ptr const & defaultstyle =
@@ -1362,31 +1363,7 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
        LyXFont font_old =
                style->labeltype == LABEL_MANUAL ? style->labelfont : style->font;
 
        LyXFont font_old =
                style->labeltype == LABEL_MANUAL ? style->labelfont : style->font;
 
-       int char_line_count = depth;
        bool label_closed = true;
        bool label_closed = true;
-       bool para_closed = true;
-
-       if (style->latextype == LATEX_ITEM_ENVIRONMENT) {
-               string ls = "";
-               Counters & counters = buf.params().getLyXTextClass().counters();
-               if (!style->free_spacing)
-                       os << string(depth,' ');
-               if (!style->labeltag().empty()) {
-                       os << "<" << style->labeltag() << ">\n";
-                       label_closed = false;
-               } else {
-                       if (!defaultstyle->latexparam().empty()) {
-                               counters.step("para");
-                               ls = tostr(counters.value("para"));
-                               ls = " id=\""
-                                       + subst(defaultstyle->latexparam(), "#", ls) + '"';
-                       }
-                       os << "<" << style->itemtag() << ">\n"
-                          << string(depth, ' ') << "<"
-                          << defaultstyle->latexname() << ls << ">\n";
-                       para_closed = false;
-               }
-       }
 
        // parsing main loop
        for (pos_type i = 0; i < size(); ++i) {
 
        // parsing main loop
        for (pos_type i = 0; i < size(); ++i) {
@@ -1434,7 +1411,6 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
                                   << style->itemtag() << "><"
                                   << defaultstyle->latexname() << ">";
                                label_closed = true;
                                   << style->itemtag() << "><"
                                   << defaultstyle->latexname() << ">";
                                label_closed = true;
-                               para_closed = false;
                        } else {
                                os << ' ';
                        }
                        } else {
                                os << ' ';
                        }
@@ -1457,10 +1433,6 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
                   << style->itemtag() << "><"
                   << defaultstyle->latexname() << ">&nbsp;";
        }
                   << style->itemtag() << "><"
                   << defaultstyle->latexname() << ">&nbsp;";
        }
-       if (!para_closed) {
-               os << "\n" << string(depth, ' ') << "</"
-                  << defaultstyle->latexname() << ">\n";
-       }
        if (style->free_spacing)
                os << '\n';
 }
        if (style->free_spacing)
                os << '\n';
 }
index 574bd1d124b3a487eb9a73658778a846c414c3c5..730eec1925b73ade995fc3a81fbd709dfc9836ff 100644 (file)
@@ -99,9 +99,6 @@ int openTag(ostream & os, Paragraph::depth_type depth,
                os << '>';
        }
 
                os << '>';
        }
 
-       if (!mixcont)
-               os << endl;
-
        return !mixcont;
 }
 
        return !mixcont;
 }
 
@@ -111,31 +108,14 @@ int closeTag(ostream & os, Paragraph::depth_type depth,
 {
        if (!latexname.empty() && latexname != "!-- --") {
                if (!mixcont)
 {
        if (!latexname.empty() && latexname != "!-- --") {
                if (!mixcont)
-                       os << endl << string(depth, ' ');
+                       os << '\n' << string(depth, ' ');
                os << "</" << latexname << '>';
        }
 
        if (!mixcont)
                os << "</" << latexname << '>';
        }
 
        if (!mixcont)
-               os << endl;
+               os << '\n';
 
        return !mixcont;
 }
 
 
        return !mixcont;
 }
 
-
-unsigned int closeEnvTags(ostream & os, bool mixcont,
-                       string const & environment_inner_depth,
-                       string const & itemtag,
-                       lyx::depth_type total_depth)
-{
-       unsigned int lines = 0;
-       if (environment_inner_depth != "!-- --") {
-               lines += closeTag(os, total_depth, mixcont, itemtag);
-               if (!environment_inner_depth.empty())
-                       lines += closeTag(os, total_depth, mixcont,
-                               environment_inner_depth);
-       }
-       return lines;
-}
-
-
 } // namespace sgml
 } // namespace sgml