]> git.lyx.org Git - lyx.git/blobdiff - src/output_docbook.cpp
Fix text direction issue for InsetInfo in RTL context
[lyx.git] / src / output_docbook.cpp
index 432b2e710903c2222ddbefd48b0f45a64591c58e..6ed409c5dda04c69eafadcf2e0f3131bd2fa4abe 100644 (file)
@@ -30,8 +30,9 @@
 #include "support/lassert.h"
 #include "support/debug.h"
 #include "support/lstrings.h"
+#include "support/lyxalgo.h"
 
-#include <boost/next_prior.hpp>
+#include <iostream>
 
 using namespace std;
 using namespace lyx::support;
@@ -42,7 +43,7 @@ namespace {
 
 ParagraphList::const_iterator searchParagraph(
        ParagraphList::const_iterator p,
-  ParagraphList::const_iterator const & pend)
+       ParagraphList::const_iterator const & pend)
 {
        for (++p; p != pend && p->layout().latextype == LATEX_PARAGRAPH; ++p)
                ;
@@ -52,8 +53,8 @@ ParagraphList::const_iterator searchParagraph(
 
 
 ParagraphList::const_iterator searchCommand(
-               ParagraphList::const_iterator p,
-               ParagraphList::const_iterator const & pend)
+       ParagraphList::const_iterator p,
+       ParagraphList::const_iterator const & pend)
 {
        Layout const & bstyle = p->layout();
 
@@ -68,8 +69,8 @@ ParagraphList::const_iterator searchCommand(
 
 
 ParagraphList::const_iterator searchEnvironment(
-               ParagraphList::const_iterator p,
-               ParagraphList::const_iterator const & pend)
+       ParagraphList::const_iterator p,
+       ParagraphList::const_iterator const & pend)
 {
        Layout const & bstyle = p->layout();
        size_t const depth = p->params().depth();
@@ -95,26 +96,27 @@ ParagraphList::const_iterator searchEnvironment(
 }
 
 
-ParagraphList::const_iterator makeParagraph(Buffer const & buf,
-                                           odocstream & os,
-                                           OutputParams const & runparams,
-                                           Text const & text,
-                                           ParagraphList::const_iterator const & pbegin,
-                                           ParagraphList::const_iterator const & pend)
+ParagraphList::const_iterator makeParagraph(
+       Buffer const & buf,
+       odocstream & os,
+       OutputParams const & runparams,
+       Text const & text,
+       ParagraphList::const_iterator const & pbegin,
+       ParagraphList::const_iterator const & pend)
 {
        ParagraphList const & paragraphs = text.paragraphs();
        for (ParagraphList::const_iterator par = pbegin; par != pend; ++par) {
                if (par != pbegin)
                        os << '\n';
-               bool const default_or_plain = 
-                       (buf.params().documentClass().isDefaultLayout(par->layout()) 
+               bool const default_or_plain =
+                       (buf.params().documentClass().isDefaultLayout(par->layout())
                                || buf.params().documentClass().isPlainLayout(par->layout()));
                if (default_or_plain && par->emptyTag()) {
-                       par->simpleDocBookOnePar(buf, os, runparams, 
+                       par->simpleDocBookOnePar(buf, os, runparams,
                                        text.outerFont(distance(paragraphs.begin(), par)));
                } else {
                        sgml::openTag(buf, os, runparams, *par);
-                       par->simpleDocBookOnePar(buf, os, runparams, 
+                       par->simpleDocBookOnePar(buf, os, runparams,
                                        text.outerFont(distance(paragraphs.begin(), par)));
                        sgml::closeTag(os, *par);
                }
@@ -123,19 +125,19 @@ ParagraphList::const_iterator makeParagraph(Buffer const & buf,
 }
 
 
-ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
-                                             odocstream & os,
-                                             OutputParams const & runparams,
-                                             Text const & text,
-                                             ParagraphList::const_iterator const & pbegin,
-                                             ParagraphList::const_iterator const & pend)
+ParagraphList::const_iterator makeEnvironment(
+       Buffer const & buf,
+       odocstream & os,
+       OutputParams const & runparams,
+       Text const & text,
+       ParagraphList::const_iterator const & pbegin,
+       ParagraphList::const_iterator const & pend)
 {
        ParagraphList const & paragraphs = text.paragraphs();
        ParagraphList::const_iterator par = pbegin;
 
        Layout const & defaultstyle = buf.params().documentClass().defaultLayout();
        Layout const & bstyle = par->layout();
-       string item_tag;
 
        // Opening outter tag
        sgml::openTag(buf, os, runparams, *pbegin);
@@ -237,19 +239,20 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
        if (bstyle.latextype == LATEX_ENVIRONMENT && bstyle.pass_thru)
                os << "]]>";
 
-       // Closing outter tag
+       // Closing outer tag
        sgml::closeTag(os, *pbegin);
 
        return pend;
 }
 
 
-ParagraphList::const_iterator makeCommand(Buffer const & buf,
-                                         odocstream & os,
-                                         OutputParams const & runparams,
-                                         Text const & text,
-                                         ParagraphList::const_iterator const & pbegin,
-                                         ParagraphList::const_iterator const & pend)
+ParagraphList::const_iterator makeCommand(
+       Buffer const & buf,
+       odocstream & os,
+       OutputParams const & runparams,
+       Text const & text,
+       ParagraphList::const_iterator const & pbegin,
+       ParagraphList::const_iterator const & pend)
 {
        ParagraphList const & paragraphs = text.paragraphs();
        ParagraphList::const_iterator par = pbegin;
@@ -309,7 +312,7 @@ ParagraphList::const_iterator makeCommand(Buffer const & buf,
        return pend;
 }
 
-} // end anonym namespace
+} // namespace
 
 
 void docbookParagraphs(Text const & text,
@@ -317,15 +320,17 @@ void docbookParagraphs(Text const & text,
                       odocstream & os,
                       OutputParams const & runparams)
 {
+       LASSERT(runparams.par_begin <= runparams.par_end,
+               { os << "<!-- Docbook Output Error -->\n"; return; });
+
        ParagraphList const & paragraphs = text.paragraphs();
        ParagraphList::const_iterator par = paragraphs.begin();
        ParagraphList::const_iterator pend = paragraphs.end();
 
-       LASSERT(runparams.par_begin <= runparams.par_end, /**/);
        // if only part of the paragraphs will be outputed
        if (runparams.par_begin !=  runparams.par_end) {
-               par = boost::next(paragraphs.begin(), runparams.par_begin);
-               pend = boost::next(paragraphs.begin(), runparams.par_end);
+               par = lyx::next(paragraphs.begin(), runparams.par_begin);
+               pend = lyx::next(paragraphs.begin(), runparams.par_end);
                // runparams will be passed to nested paragraphs, so
                // we have to reset the range parameters.
                const_cast<OutputParams&>(runparams).par_begin = 0;