2003-11-05 12:06:20 +00:00
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
* \file output_docbook.cpp
|
2003-11-05 12:06:20 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
|
|
|
* \author José Matos
|
2003-11-05 12:06:20 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "output_docbook.h"
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "Buffer.h"
|
2005-02-25 11:55:36 +00:00
|
|
|
#include "buffer_funcs.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "BufferParams.h"
|
|
|
|
#include "Counters.h"
|
2010-03-31 19:38:05 +00:00
|
|
|
#include "Font.h"
|
2007-09-29 20:02:32 +00:00
|
|
|
#include "Layout.h"
|
|
|
|
#include "OutputParams.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "Paragraph.h"
|
2006-03-23 20:11:06 +00:00
|
|
|
#include "ParagraphList.h"
|
2003-11-05 12:06:20 +00:00
|
|
|
#include "ParagraphParameters.h"
|
|
|
|
#include "sgml.h"
|
2009-08-09 17:30:41 +00:00
|
|
|
#include "Text.h"
|
2007-11-07 23:25:08 +00:00
|
|
|
#include "TextClass.h"
|
2003-11-05 12:06:20 +00:00
|
|
|
|
2008-04-30 08:26:40 +00:00
|
|
|
#include "support/lassert.h"
|
2008-02-18 07:14:42 +00:00
|
|
|
#include "support/debug.h"
|
|
|
|
#include "support/lstrings.h"
|
2015-05-15 22:05:23 +00:00
|
|
|
#include "support/lyxalgo.h"
|
2007-10-02 18:27:20 +00:00
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2007-12-12 18:57:56 +00:00
|
|
|
using namespace lyx::support;
|
2003-11-05 12:06:20 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2004-10-24 00:02:39 +00:00
|
|
|
namespace {
|
2003-11-05 12:06:20 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
ParagraphList::const_iterator searchParagraph(
|
2007-11-26 23:59:51 +00:00
|
|
|
ParagraphList::const_iterator p,
|
2012-10-27 13:45:27 +00:00
|
|
|
ParagraphList::const_iterator const & pend)
|
2003-11-05 12:06:20 +00:00
|
|
|
{
|
2008-03-06 21:31:27 +00:00
|
|
|
for (++p; p != pend && p->layout().latextype == LATEX_PARAGRAPH; ++p)
|
2006-10-21 00:16:43 +00:00
|
|
|
;
|
2003-11-05 12:06:20 +00:00
|
|
|
|
2004-10-24 00:02:39 +00:00
|
|
|
return p;
|
|
|
|
}
|
2003-11-25 17:23:36 +00:00
|
|
|
|
2003-11-05 12:06:20 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
ParagraphList::const_iterator searchCommand(
|
2012-10-27 13:45:27 +00:00
|
|
|
ParagraphList::const_iterator p,
|
|
|
|
ParagraphList::const_iterator const & pend)
|
2004-10-24 00:02:39 +00:00
|
|
|
{
|
2008-03-06 21:31:27 +00:00
|
|
|
Layout const & bstyle = p->layout();
|
2004-04-03 08:37:12 +00:00
|
|
|
|
2007-11-26 23:59:51 +00:00
|
|
|
for (++p; p != pend; ++p) {
|
2008-03-06 21:31:27 +00:00
|
|
|
Layout const & style = p->layout();
|
|
|
|
if (style.latextype == LATEX_COMMAND
|
|
|
|
&& style.commanddepth <= bstyle.commanddepth)
|
2004-10-24 00:02:39 +00:00
|
|
|
return p;
|
|
|
|
}
|
|
|
|
return pend;
|
|
|
|
}
|
2003-11-05 12:06:20 +00:00
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
ParagraphList::const_iterator searchEnvironment(
|
2012-10-27 13:45:27 +00:00
|
|
|
ParagraphList::const_iterator p,
|
|
|
|
ParagraphList::const_iterator const & pend)
|
2004-10-24 00:02:39 +00:00
|
|
|
{
|
2008-03-06 21:31:27 +00:00
|
|
|
Layout const & bstyle = p->layout();
|
2007-11-26 23:59:51 +00:00
|
|
|
size_t const depth = p->params().depth();
|
|
|
|
for (++p; p != pend; ++p) {
|
2008-03-06 21:31:27 +00:00
|
|
|
Layout const & style = p->layout();
|
|
|
|
if (style.latextype == LATEX_COMMAND)
|
2004-10-24 00:02:39 +00:00
|
|
|
return p;
|
|
|
|
|
2008-03-06 21:31:27 +00:00
|
|
|
if (style.latextype == LATEX_PARAGRAPH) {
|
2007-11-26 23:59:51 +00:00
|
|
|
if (p->params().depth() > depth)
|
2004-10-24 00:02:39 +00:00
|
|
|
continue;
|
|
|
|
return p;
|
2003-11-05 12:06:20 +00:00
|
|
|
}
|
|
|
|
|
2007-11-26 23:59:51 +00:00
|
|
|
if (p->params().depth() < depth)
|
2004-10-24 18:28:18 +00:00
|
|
|
return p;
|
|
|
|
|
2008-03-06 21:31:27 +00:00
|
|
|
if (style.latexname() != bstyle.latexname()
|
2007-11-26 23:59:51 +00:00
|
|
|
&& p->params().depth() == depth)
|
2004-10-24 00:02:39 +00:00
|
|
|
return p;
|
|
|
|
}
|
|
|
|
return pend;
|
|
|
|
}
|
2003-11-05 12:06:20 +00:00
|
|
|
|
2004-04-03 08:37:12 +00:00
|
|
|
|
2012-10-27 13:45:27 +00:00
|
|
|
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)
|
2004-10-28 13:07:45 +00:00
|
|
|
{
|
2009-08-09 18:35:39 +00:00
|
|
|
ParagraphList const & paragraphs = text.paragraphs();
|
2006-10-21 00:16:43 +00:00
|
|
|
for (ParagraphList::const_iterator par = pbegin; par != pend; ++par) {
|
2005-02-28 13:14:48 +00:00
|
|
|
if (par != pbegin)
|
|
|
|
os << '\n';
|
2011-10-30 11:44:22 +00:00
|
|
|
bool const default_or_plain =
|
|
|
|
(buf.params().documentClass().isDefaultLayout(par->layout())
|
|
|
|
|| buf.params().documentClass().isPlainLayout(par->layout()));
|
|
|
|
if (default_or_plain && par->emptyTag()) {
|
2008-02-24 15:44:11 +00:00
|
|
|
par->simpleDocBookOnePar(buf, os, runparams,
|
2009-08-09 18:35:39 +00:00
|
|
|
text.outerFont(distance(paragraphs.begin(), par)));
|
2004-10-30 13:05:31 +00:00
|
|
|
} else {
|
2004-11-02 11:25:20 +00:00
|
|
|
sgml::openTag(buf, os, runparams, *par);
|
2008-02-24 15:44:11 +00:00
|
|
|
par->simpleDocBookOnePar(buf, os, runparams,
|
2009-08-09 18:35:39 +00:00
|
|
|
text.outerFont(distance(paragraphs.begin(), par)));
|
2004-10-30 13:05:31 +00:00
|
|
|
sgml::closeTag(os, *par);
|
|
|
|
}
|
2004-10-24 00:02:39 +00:00
|
|
|
}
|
|
|
|
return pend;
|
|
|
|
}
|
2003-11-05 12:06:20 +00:00
|
|
|
|
|
|
|
|
2012-10-27 13:45:27 +00:00
|
|
|
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)
|
2009-08-09 18:35:39 +00:00
|
|
|
{
|
|
|
|
ParagraphList const & paragraphs = text.paragraphs();
|
2004-10-24 00:02:39 +00:00
|
|
|
ParagraphList::const_iterator par = pbegin;
|
2004-05-14 15:47:35 +00:00
|
|
|
|
2008-03-06 20:01:30 +00:00
|
|
|
Layout const & defaultstyle = buf.params().documentClass().defaultLayout();
|
2008-03-06 21:31:27 +00:00
|
|
|
Layout const & bstyle = par->layout();
|
2004-10-24 00:02:39 +00:00
|
|
|
string item_tag;
|
2004-10-26 21:16:44 +00:00
|
|
|
|
2004-10-24 00:02:39 +00:00
|
|
|
// Opening outter tag
|
2004-11-02 11:25:20 +00:00
|
|
|
sgml::openTag(buf, os, runparams, *pbegin);
|
2004-10-24 00:02:39 +00:00
|
|
|
os << '\n';
|
2008-03-06 21:31:27 +00:00
|
|
|
if (bstyle.latextype == LATEX_ENVIRONMENT && bstyle.pass_thru)
|
2004-10-24 00:02:39 +00:00
|
|
|
os << "<![CDATA[";
|
|
|
|
|
|
|
|
while (par != pend) {
|
2008-03-06 21:31:27 +00:00
|
|
|
Layout const & style = par->layout();
|
2004-10-24 00:02:39 +00:00
|
|
|
ParagraphList::const_iterator send;
|
2004-11-02 11:25:20 +00:00
|
|
|
string id = par->getID(buf, runparams);
|
2004-10-24 00:02:39 +00:00
|
|
|
string wrapper = "";
|
2004-10-24 23:53:42 +00:00
|
|
|
pos_type sep = 0;
|
2003-11-25 17:23:36 +00:00
|
|
|
|
2004-10-24 00:02:39 +00:00
|
|
|
// Opening inner tag
|
2008-03-06 21:31:27 +00:00
|
|
|
switch (bstyle.latextype) {
|
2004-10-24 00:02:39 +00:00
|
|
|
case LATEX_ENVIRONMENT:
|
2008-03-06 21:31:27 +00:00
|
|
|
if (!bstyle.innertag().empty()) {
|
|
|
|
sgml::openTag(os, bstyle.innertag(), id);
|
2003-11-25 17:23:36 +00:00
|
|
|
}
|
2003-11-05 12:06:20 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LATEX_ITEM_ENVIRONMENT:
|
2008-03-06 21:31:27 +00:00
|
|
|
if (!bstyle.labeltag().empty()) {
|
|
|
|
sgml::openTag(os, bstyle.innertag(), id);
|
|
|
|
sgml::openTag(os, bstyle.labeltag());
|
2009-06-05 17:44:35 +00:00
|
|
|
sep = par->firstWordDocBook(os, runparams) + 1;
|
2008-03-06 21:31:27 +00:00
|
|
|
sgml::closeTag(os, bstyle.labeltag());
|
2003-11-05 12:06:20 +00:00
|
|
|
}
|
2008-03-06 20:01:30 +00:00
|
|
|
wrapper = defaultstyle.latexname();
|
2007-01-29 20:28:44 +00:00
|
|
|
// If a sub list (embedded list) appears next with a
|
|
|
|
// different depth, then there is no need to open
|
|
|
|
// another tag at the current depth.
|
|
|
|
if(par->params().depth() == pbegin->params().depth()) {
|
2008-03-06 21:31:27 +00:00
|
|
|
sgml::openTag(os, bstyle.itemtag());
|
2007-01-29 20:28:44 +00:00
|
|
|
}
|
|
|
|
break;
|
2004-10-24 00:02:39 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2003-11-05 12:06:20 +00:00
|
|
|
|
2008-03-06 21:31:27 +00:00
|
|
|
switch (style.latextype) {
|
2004-10-24 00:02:39 +00:00
|
|
|
case LATEX_ENVIRONMENT:
|
|
|
|
case LATEX_ITEM_ENVIRONMENT: {
|
2006-10-21 00:16:43 +00:00
|
|
|
if (par->params().depth() == pbegin->params().depth()) {
|
2004-10-28 15:10:10 +00:00
|
|
|
sgml::openTag(os, wrapper);
|
2009-08-09 18:35:39 +00:00
|
|
|
par->simpleDocBookOnePar(buf, os, runparams,
|
|
|
|
text.outerFont(distance(paragraphs.begin(), par)), sep);
|
2004-10-28 13:07:45 +00:00
|
|
|
sgml::closeTag(os, wrapper);
|
2004-10-24 00:02:39 +00:00
|
|
|
++par;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
send = searchEnvironment(par, pend);
|
2009-08-09 18:35:39 +00:00
|
|
|
par = makeEnvironment(buf, os, runparams, text, par,send);
|
2004-10-24 00:02:39 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case LATEX_PARAGRAPH:
|
|
|
|
send = searchParagraph(par, pend);
|
2009-08-09 18:35:39 +00:00
|
|
|
par = makeParagraph(buf, os, runparams, text, par,send);
|
2004-10-24 00:02:39 +00:00
|
|
|
break;
|
2009-06-06 14:29:24 +00:00
|
|
|
case LATEX_LIST_ENVIRONMENT:
|
|
|
|
case LATEX_BIB_ENVIRONMENT:
|
|
|
|
case LATEX_COMMAND:
|
|
|
|
// FIXME This means that we are just skipping any paragraph that
|
|
|
|
// isn't implemented above, and this includes lists.
|
|
|
|
++par;
|
2004-10-24 00:02:39 +00:00
|
|
|
break;
|
|
|
|
}
|
2003-11-05 12:06:20 +00:00
|
|
|
|
2004-10-24 00:02:39 +00:00
|
|
|
// Closing inner tag
|
2008-03-06 21:31:27 +00:00
|
|
|
switch (bstyle.latextype) {
|
2004-10-24 00:02:39 +00:00
|
|
|
case LATEX_ENVIRONMENT:
|
2008-03-06 21:31:27 +00:00
|
|
|
if (!bstyle.innertag().empty()) {
|
|
|
|
sgml::closeTag(os, bstyle.innertag());
|
2004-10-24 00:02:39 +00:00
|
|
|
os << '\n';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LATEX_ITEM_ENVIRONMENT:
|
2007-01-29 20:28:44 +00:00
|
|
|
// If a sub list (embedded list) appears next, then
|
|
|
|
// there is no need to close the current tag.
|
|
|
|
// par should have already been incremented to the next
|
|
|
|
// element. So we can compare the depth of the next
|
|
|
|
// element with pbegin.
|
|
|
|
// We need to be careful, that we don't dereference par
|
|
|
|
// when par == pend but at the same time that the
|
|
|
|
// current tag is closed.
|
|
|
|
if((par != pend && par->params().depth() == pbegin->params().depth()) || par == pend) {
|
2008-03-06 21:31:27 +00:00
|
|
|
sgml::closeTag(os, bstyle.itemtag());
|
2007-01-29 20:28:44 +00:00
|
|
|
}
|
2008-03-06 21:31:27 +00:00
|
|
|
if (!bstyle.labeltag().empty())
|
|
|
|
sgml::closeTag(os, bstyle.innertag());
|
2003-11-05 12:06:20 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2004-10-24 00:02:39 +00:00
|
|
|
}
|
|
|
|
|
2008-03-06 21:31:27 +00:00
|
|
|
if (bstyle.latextype == LATEX_ENVIRONMENT && bstyle.pass_thru)
|
2004-10-24 00:02:39 +00:00
|
|
|
os << "]]>";
|
|
|
|
|
|
|
|
// Closing outter tag
|
2004-10-28 13:07:45 +00:00
|
|
|
sgml::closeTag(os, *pbegin);
|
2004-10-24 00:02:39 +00:00
|
|
|
|
|
|
|
return pend;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-10-27 13:45:27 +00:00
|
|
|
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)
|
2004-10-24 00:02:39 +00:00
|
|
|
{
|
2009-08-09 18:35:39 +00:00
|
|
|
ParagraphList const & paragraphs = text.paragraphs();
|
2004-10-24 00:02:39 +00:00
|
|
|
ParagraphList::const_iterator par = pbegin;
|
2008-03-06 21:31:27 +00:00
|
|
|
Layout const & bstyle = par->layout();
|
2004-10-26 21:16:44 +00:00
|
|
|
|
2004-10-24 00:02:39 +00:00
|
|
|
//Open outter tag
|
2004-11-02 11:25:20 +00:00
|
|
|
sgml::openTag(buf, os, runparams, *pbegin);
|
2004-10-24 00:02:39 +00:00
|
|
|
os << '\n';
|
|
|
|
|
|
|
|
// Label around sectioning number:
|
2008-03-06 21:31:27 +00:00
|
|
|
if (!bstyle.labeltag().empty()) {
|
|
|
|
sgml::openTag(os, bstyle.labeltag());
|
2007-01-15 16:58:14 +00:00
|
|
|
// We don't care about appendix in DOCBOOK.
|
2010-01-21 18:46:20 +00:00
|
|
|
os << par->expandDocBookLabel(bstyle, buf.params());
|
2008-03-06 21:31:27 +00:00
|
|
|
sgml::closeTag(os, bstyle.labeltag());
|
2004-10-24 00:02:39 +00:00
|
|
|
}
|
2004-10-26 21:16:44 +00:00
|
|
|
|
2005-01-06 15:40:49 +00:00
|
|
|
// Opend inner tag and close inner tags
|
2008-03-06 21:31:27 +00:00
|
|
|
sgml::openTag(os, bstyle.innertag());
|
2009-08-09 18:35:39 +00:00
|
|
|
par->simpleDocBookOnePar(buf, os, runparams,
|
|
|
|
text.outerFont(distance(paragraphs.begin(), par)));
|
2008-03-06 21:31:27 +00:00
|
|
|
sgml::closeTag(os, bstyle.innertag());
|
2004-10-24 00:02:39 +00:00
|
|
|
os << '\n';
|
2004-10-26 21:16:44 +00:00
|
|
|
|
2004-10-24 00:02:39 +00:00
|
|
|
++par;
|
|
|
|
while (par != pend) {
|
2008-03-06 21:31:27 +00:00
|
|
|
Layout const & style = par->layout();
|
2004-10-24 00:02:39 +00:00
|
|
|
ParagraphList::const_iterator send;
|
2003-11-05 12:06:20 +00:00
|
|
|
|
2008-03-06 21:31:27 +00:00
|
|
|
switch (style.latextype) {
|
2004-10-24 00:02:39 +00:00
|
|
|
case LATEX_COMMAND: {
|
|
|
|
send = searchCommand(par, pend);
|
2009-08-09 18:35:39 +00:00
|
|
|
par = makeCommand(buf, os, runparams, text, par,send);
|
2003-11-05 12:06:20 +00:00
|
|
|
break;
|
2004-10-24 00:02:39 +00:00
|
|
|
}
|
2003-11-05 12:06:20 +00:00
|
|
|
case LATEX_ENVIRONMENT:
|
2004-10-24 00:02:39 +00:00
|
|
|
case LATEX_ITEM_ENVIRONMENT: {
|
|
|
|
send = searchEnvironment(par, pend);
|
2009-08-09 18:35:39 +00:00
|
|
|
par = makeEnvironment(buf, os, runparams, text, par,send);
|
2003-11-05 12:06:20 +00:00
|
|
|
break;
|
2004-10-24 00:02:39 +00:00
|
|
|
}
|
2003-11-05 12:06:20 +00:00
|
|
|
case LATEX_PARAGRAPH:
|
2004-10-24 00:02:39 +00:00
|
|
|
send = searchParagraph(par, pend);
|
2009-08-09 18:35:39 +00:00
|
|
|
par = makeParagraph(buf, os, runparams, text, par,send);
|
2003-11-05 12:06:20 +00:00
|
|
|
break;
|
2012-05-02 13:34:56 +00:00
|
|
|
case LATEX_BIB_ENVIRONMENT:
|
|
|
|
case LATEX_LIST_ENVIRONMENT:
|
|
|
|
// FIXME This means that we are just skipping any paragraph that
|
|
|
|
// isn't implemented above.
|
|
|
|
++par;
|
2003-11-05 12:06:20 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-10-24 00:02:39 +00:00
|
|
|
// Close outter tag
|
2004-10-28 13:07:45 +00:00
|
|
|
sgml::closeTag(os, *pbegin);
|
2004-10-24 00:02:39 +00:00
|
|
|
|
|
|
|
return pend;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // end anonym namespace
|
|
|
|
|
|
|
|
|
2009-08-09 18:35:39 +00:00
|
|
|
void docbookParagraphs(Text const & text,
|
2004-10-24 00:02:39 +00:00
|
|
|
Buffer const & buf,
|
2006-10-19 21:00:33 +00:00
|
|
|
odocstream & os,
|
2004-10-24 00:02:39 +00:00
|
|
|
OutputParams const & runparams)
|
|
|
|
{
|
2013-04-25 21:27:10 +00:00
|
|
|
LASSERT(runparams.par_begin <= runparams.par_end,
|
|
|
|
{ os << "<!-- Docbook Output Error -->\n"; return; });
|
|
|
|
|
2009-08-09 18:35:39 +00:00
|
|
|
ParagraphList const & paragraphs = text.paragraphs();
|
2004-10-24 00:02:39 +00:00
|
|
|
ParagraphList::const_iterator par = paragraphs.begin();
|
|
|
|
ParagraphList::const_iterator pend = paragraphs.end();
|
2003-11-05 12:06:20 +00:00
|
|
|
|
view-source feature, from Bo Peng <ben.bob@gmail.com>
* src/buffer.h buffer.C - getSourceCode()
* src/lyxfunc.C - open view-source dialog
* src/text3.C - change LFUN_MOUSE_RELEASE
* src/output_linuxdoc.C, src/output_docbook.C, src/output_latex.C
- intercept output
* src/outputparams.h, outputparams.C - add par_begin, par_end, dryrun
* src/insets/insetgraphics.C - add dryrun mode of file conversion
* lib/ui/stdmenus.ui - add view-source menu item under view
* Add view-source dialog, add
src/frontends/qt2/QViewSourceDialog.h, QViewSource.C, QViewSource.h, QViewSourceDialog.C
src/frontends/qt2/ui/QViewSourceDialogBase.ui
src/frontends/controllers/ControlViewSource.h ControlViewSource.C
modify
src/frontends/qt2/Makefile.dialogs, Makefile.am, Dialogs.C,
src/frontends/controllers/Makefile.am, po.POTFILES.in
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13610 a592a061-630c-0410-9148-cb99ea01b6c8
2006-04-09 02:48:54 +00:00
|
|
|
// if only part of the paragraphs will be outputed
|
|
|
|
if (runparams.par_begin != runparams.par_end) {
|
2015-05-15 22:05:23 +00:00
|
|
|
par = next(paragraphs.begin(), runparams.par_begin);
|
|
|
|
pend = next(paragraphs.begin(), runparams.par_end);
|
view-source feature, from Bo Peng <ben.bob@gmail.com>
* src/buffer.h buffer.C - getSourceCode()
* src/lyxfunc.C - open view-source dialog
* src/text3.C - change LFUN_MOUSE_RELEASE
* src/output_linuxdoc.C, src/output_docbook.C, src/output_latex.C
- intercept output
* src/outputparams.h, outputparams.C - add par_begin, par_end, dryrun
* src/insets/insetgraphics.C - add dryrun mode of file conversion
* lib/ui/stdmenus.ui - add view-source menu item under view
* Add view-source dialog, add
src/frontends/qt2/QViewSourceDialog.h, QViewSource.C, QViewSource.h, QViewSourceDialog.C
src/frontends/qt2/ui/QViewSourceDialogBase.ui
src/frontends/controllers/ControlViewSource.h ControlViewSource.C
modify
src/frontends/qt2/Makefile.dialogs, Makefile.am, Dialogs.C,
src/frontends/controllers/Makefile.am, po.POTFILES.in
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13610 a592a061-630c-0410-9148-cb99ea01b6c8
2006-04-09 02:48:54 +00:00
|
|
|
// runparams will be passed to nested paragraphs, so
|
|
|
|
// we have to reset the range parameters.
|
|
|
|
const_cast<OutputParams&>(runparams).par_begin = 0;
|
|
|
|
const_cast<OutputParams&>(runparams).par_end = 0;
|
|
|
|
}
|
2007-05-28 22:27:45 +00:00
|
|
|
|
2004-10-24 00:02:39 +00:00
|
|
|
while (par != pend) {
|
2008-03-06 21:31:27 +00:00
|
|
|
Layout const & style = par->layout();
|
view-source feature, from Bo Peng <ben.bob@gmail.com>
* src/buffer.h buffer.C - getSourceCode()
* src/lyxfunc.C - open view-source dialog
* src/text3.C - change LFUN_MOUSE_RELEASE
* src/output_linuxdoc.C, src/output_docbook.C, src/output_latex.C
- intercept output
* src/outputparams.h, outputparams.C - add par_begin, par_end, dryrun
* src/insets/insetgraphics.C - add dryrun mode of file conversion
* lib/ui/stdmenus.ui - add view-source menu item under view
* Add view-source dialog, add
src/frontends/qt2/QViewSourceDialog.h, QViewSource.C, QViewSource.h, QViewSourceDialog.C
src/frontends/qt2/ui/QViewSourceDialogBase.ui
src/frontends/controllers/ControlViewSource.h ControlViewSource.C
modify
src/frontends/qt2/Makefile.dialogs, Makefile.am, Dialogs.C,
src/frontends/controllers/Makefile.am, po.POTFILES.in
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13610 a592a061-630c-0410-9148-cb99ea01b6c8
2006-04-09 02:48:54 +00:00
|
|
|
ParagraphList::const_iterator lastpar = par;
|
2004-10-24 00:02:39 +00:00
|
|
|
ParagraphList::const_iterator send;
|
|
|
|
|
2008-03-06 21:31:27 +00:00
|
|
|
switch (style.latextype) {
|
2004-10-24 00:02:39 +00:00
|
|
|
case LATEX_COMMAND: {
|
|
|
|
send = searchCommand(par, pend);
|
2012-03-13 16:07:48 +00:00
|
|
|
par = makeCommand(buf, os, runparams, text, par, send);
|
2004-10-24 00:02:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case LATEX_ENVIRONMENT:
|
|
|
|
case LATEX_ITEM_ENVIRONMENT: {
|
|
|
|
send = searchEnvironment(par, pend);
|
2012-03-13 16:07:48 +00:00
|
|
|
par = makeEnvironment(buf, os, runparams, text, par, send);
|
2004-10-24 00:02:39 +00:00
|
|
|
break;
|
2003-11-05 12:06:20 +00:00
|
|
|
}
|
2004-10-24 00:02:39 +00:00
|
|
|
case LATEX_PARAGRAPH:
|
|
|
|
send = searchParagraph(par, pend);
|
2012-03-13 16:07:48 +00:00
|
|
|
par = makeParagraph(buf, os, runparams, text, par, send);
|
2004-10-24 00:02:39 +00:00
|
|
|
break;
|
2012-05-02 13:34:56 +00:00
|
|
|
case LATEX_BIB_ENVIRONMENT:
|
|
|
|
case LATEX_LIST_ENVIRONMENT:
|
|
|
|
// FIXME This means that we are just skipping any paragraph that
|
|
|
|
// isn't implemented above.
|
|
|
|
++par;
|
2004-10-24 00:02:39 +00:00
|
|
|
break;
|
|
|
|
}
|
view-source feature, from Bo Peng <ben.bob@gmail.com>
* src/buffer.h buffer.C - getSourceCode()
* src/lyxfunc.C - open view-source dialog
* src/text3.C - change LFUN_MOUSE_RELEASE
* src/output_linuxdoc.C, src/output_docbook.C, src/output_latex.C
- intercept output
* src/outputparams.h, outputparams.C - add par_begin, par_end, dryrun
* src/insets/insetgraphics.C - add dryrun mode of file conversion
* lib/ui/stdmenus.ui - add view-source menu item under view
* Add view-source dialog, add
src/frontends/qt2/QViewSourceDialog.h, QViewSource.C, QViewSource.h, QViewSourceDialog.C
src/frontends/qt2/ui/QViewSourceDialogBase.ui
src/frontends/controllers/ControlViewSource.h ControlViewSource.C
modify
src/frontends/qt2/Makefile.dialogs, Makefile.am, Dialogs.C,
src/frontends/controllers/Makefile.am, po.POTFILES.in
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13610 a592a061-630c-0410-9148-cb99ea01b6c8
2006-04-09 02:48:54 +00:00
|
|
|
// makeEnvironment may process more than one paragraphs and bypass pend
|
2007-12-12 19:28:07 +00:00
|
|
|
if (distance(lastpar, par) >= distance(lastpar, pend))
|
view-source feature, from Bo Peng <ben.bob@gmail.com>
* src/buffer.h buffer.C - getSourceCode()
* src/lyxfunc.C - open view-source dialog
* src/text3.C - change LFUN_MOUSE_RELEASE
* src/output_linuxdoc.C, src/output_docbook.C, src/output_latex.C
- intercept output
* src/outputparams.h, outputparams.C - add par_begin, par_end, dryrun
* src/insets/insetgraphics.C - add dryrun mode of file conversion
* lib/ui/stdmenus.ui - add view-source menu item under view
* Add view-source dialog, add
src/frontends/qt2/QViewSourceDialog.h, QViewSource.C, QViewSource.h, QViewSourceDialog.C
src/frontends/qt2/ui/QViewSourceDialogBase.ui
src/frontends/controllers/ControlViewSource.h ControlViewSource.C
modify
src/frontends/qt2/Makefile.dialogs, Makefile.am, Dialogs.C,
src/frontends/controllers/Makefile.am, po.POTFILES.in
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13610 a592a061-630c-0410-9148-cb99ea01b6c8
2006-04-09 02:48:54 +00:00
|
|
|
break;
|
2004-10-24 00:02:39 +00:00
|
|
|
}
|
2003-11-05 12:06:20 +00:00
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|