#include "Buffer.h"
#include "Author.h"
+#include "Biblio.h"
#include "BranchList.h"
#include "buffer_funcs.h"
#include "BufferList.h"
#include "ParIterator.h"
#include "sgml.h"
#include "TexRow.h"
+#include "TexStream.h"
#include "TocBackend.h"
#include "Undo.h"
#include "version.h"
namespace {
-int const LYX_FORMAT = 277;
+int const LYX_FORMAT = 278;
} // namespace anon
if (!openFileWrite(ofs, fname))
return false;
+ //TexStream ts(ofs.rdbuf(), &texrow());
+
bool failed_export = false;
try {
+ texrow().reset();
writeLaTeXSource(ofs, original_path,
runparams, output_preamble, output_body);
}
lyxerr << "Caught iconv exception: " << e.what() << endl;
failed_export = true;
}
- catch (std::exception const & e) {
+ catch (std::exception const & e) {
lyxerr << "Caught \"normal\" exception: " << e.what() << endl;
failed_export = true;
}
validate(features);
LYXERR(Debug::LATEX) << " Buffer validation done." << endl;
- texrow().reset();
-
// The starting paragraph of the coming rows is the
// first paragraph of the document. (Asger)
- texrow().start(paragraphs().begin()->id(), 0);
-
if (output_preamble && runparams.nice) {
os << "%% LyX " << lyx_version << " created this file. "
"For more info, see http://www.lyx.org/.\n"
os << "\\begin{document}\n";
texrow().newline();
} // output_preamble
+
+ texrow().start(paragraphs().begin()->id(), 0);
+
LYXERR(Debug::INFO) << "preamble finished, now the body." << endl;
if (!lyxrc.language_auto_begin &&
params().parentname.erase();
}
+ loadChildDocuments(*this);
+
// the real stuff
latexParagraphs(*this, paragraphs(), os, texrow(), runparams);
params().getTextClass().counters().reset();
+ loadChildDocuments(*this);
+
sgml::openTag(os, top);
os << '\n';
docbookParagraphs(paragraphs(), *this, os, runparams);
if (params().use_esint == BufferParams::package_on)
features.require("esint");
+ loadChildDocuments(*this);
+
for_each(paragraphs().begin(), paragraphs().end(),
boost::bind(&Paragraph::validate, _1, boost::ref(features)));
return;
}
+ loadChildDocuments(*this);
+
for (InsetIterator it = inset_iterator_begin(inset()); it; ++it)
it.nextInset()->getLabelList(*this, list);
}
// This is also a buffer property (ale)
-void Buffer::fillWithBibKeys(vector<pair<string, docstring> > & keys)
+void Buffer::fillWithBibKeys(biblio::BibKeyList & keys)
const
{
- /// if this is a child document and the parent is already loaded
- /// use the parent's list instead [ale990412]
- Buffer const * tmp = getMasterBuffer();
- BOOST_ASSERT(tmp);
- if (tmp != this) {
- tmp->fillWithBibKeys(keys);
- return;
- }
-
- for (InsetIterator it = inset_iterator_begin(inset()); it; ++it) {
- if (it->lyxCode() == Inset::BIBTEX_CODE) {
- InsetBibtex const & inset =
- static_cast<InsetBibtex const &>(*it);
- inset.fillWithBibKeys(*this, keys);
- } else if (it->lyxCode() == Inset::INCLUDE_CODE) {
- InsetInclude const & inset =
- static_cast<InsetInclude const &>(*it);
- inset.fillWithBibKeys(*this, keys);
- } else if (it->lyxCode() == Inset::BIBITEM_CODE) {
- InsetBibitem const & inset =
- static_cast<InsetBibitem const &>(*it);
- // FIXME UNICODE
- string const key = to_utf8(inset.getParam("key"));
- docstring const label = inset.getParam("label");
- DocIterator doc_it(it); doc_it.forwardPos();
- docstring const ref = doc_it.paragraph().asString(*this, false);
- docstring const info = label + "TheBibliographyRef" + ref;
- keys.push_back(pair<string, docstring>(key, info));
- }
- }
+ biblio::fillWithBibKeys(this, keys);
}
vector<docstring> labels;
if (code == Inset::CITE_CODE) {
- vector<pair<string, docstring> > keys;
+ biblio::BibKeyList keys;
fillWithBibKeys(keys);
- vector<pair<string, docstring> >::const_iterator bit = keys.begin();
- vector<pair<string, docstring> >::const_iterator bend = keys.end();
+ biblio::BibKeyList::const_iterator bit = keys.begin();
+ biblio::BibKeyList::const_iterator bend = keys.end();
for (; bit != bend; ++bit)
// FIXME UNICODE
// No side effect of file copying and image conversion
runparams.dryrun = true;
+ texrow().reset();
if (full_source) {
os << "% " << _("Preview source code") << "\n\n";
+ texrow().newline();
+ texrow().newline();
if (isLatex())
writeLaTeXSource(os, filePath(), runparams, true, true);
else {
runparams.par_end = par_end;
if (par_begin + 1 == par_end)
os << "% "
- << bformat(_("Preview source code for paragraph %1$s"), par_begin)
+ << bformat(_("Preview source code for paragraph %1$d"), par_begin)
<< "\n\n";
else
os << "% "
convert<docstring>(par_begin),
convert<docstring>(par_end - 1))
<< "\n\n";
+ texrow().newline();
+ texrow().newline();
// output paragraphs
if (isLatex()) {
- texrow().reset();
latexParagraphs(*this, paragraphs(), os, texrow(), runparams);
} else {
// DocBook