]> git.lyx.org Git - lyx.git/blobdiff - src/output_docbook.cpp
Account for old versions of Pygments
[lyx.git] / src / output_docbook.cpp
index 9dfa256eb81bbe2fbbe589ae750ae61ea50c4d81..6ab9c9d9f076bd08641567efa20c0530af32d16c 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,12 +96,13 @@ 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) {
@@ -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;
@@ -295,7 +298,11 @@ ParagraphList::const_iterator makeCommand(Buffer const & buf,
                        send = searchParagraph(par, pend);
                        par = makeParagraph(buf, os, runparams, text, par,send);
                        break;
-               default:
+               case LATEX_BIB_ENVIRONMENT:
+               case LATEX_LIST_ENVIRONMENT:
+                       // FIXME This means that we are just skipping any paragraph that
+                       // isn't implemented above.
+                       ++par;
                        break;
                }
        }
@@ -313,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;
@@ -349,7 +358,11 @@ void docbookParagraphs(Text const & text,
                        send = searchParagraph(par, pend);
                        par = makeParagraph(buf, os, runparams, text, par, send);
                        break;
-               default:
+               case LATEX_BIB_ENVIRONMENT:
+               case LATEX_LIST_ENVIRONMENT:
+                       // FIXME This means that we are just skipping any paragraph that
+                       // isn't implemented above.
+                       ++par;
                        break;
                }
                // makeEnvironment may process more than one paragraphs and bypass pend