mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
unify API for insets export
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8008 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
43259038fd
commit
15c913fe5a
@ -1,3 +1,17 @@
|
||||
2003-10-31 José Matos <jamatos@lyx.org>
|
||||
|
||||
* paragraph_funcs.C (addDepth, asciiParagraph): move from buffer.C
|
||||
|
||||
* buffer.[Ch] (writeFileAscii, makeLinuxDocFile, makeDocBookFile):
|
||||
* paragraph.[Ch] (simpleLinuxDocOnePar, simpleDocBookOnePar, asString):
|
||||
* paragraph_funcs.[Ch] (linuxdocParagraphs, docbookParagraphs):
|
||||
* paragraph_pimpl.C (simpleTeXSpecialC):
|
||||
* tabular.[Ch] (linuxdoc, docbookRow, docbook, ascii):
|
||||
add LatexRunParams argument.
|
||||
|
||||
* exporter.C (Export): change call accordingly.
|
||||
|
||||
* latexrunparams.h: add new member to take care of the other backends.
|
||||
2003-10-30 José Matos <jamatos@lyx.org>
|
||||
|
||||
* buffer.C (makeLinuxDocFile, makeDocBookFile):
|
||||
|
223
src/buffer.C
223
src/buffer.C
@ -74,14 +74,10 @@
|
||||
using lyx::pos_type;
|
||||
|
||||
using lyx::support::AddName;
|
||||
using lyx::support::ascii_lowercase;
|
||||
using lyx::support::atoi;
|
||||
using lyx::support::bformat;
|
||||
using lyx::support::ChangeExtension;
|
||||
using lyx::support::cmd_ret;
|
||||
using lyx::support::compare_ascii_no_case;
|
||||
using lyx::support::compare_no_case;
|
||||
using lyx::support::contains;
|
||||
using lyx::support::CreateBufferTmpDir;
|
||||
using lyx::support::destroyDir;
|
||||
using lyx::support::FileInfo;
|
||||
@ -887,213 +883,22 @@ bool Buffer::do_writeFile(ostream & ofs) const
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
pair<int, string> const addDepth(int depth, int ldepth)
|
||||
{
|
||||
int d = depth * 2;
|
||||
if (ldepth > depth)
|
||||
d += (ldepth - depth) * 2;
|
||||
return make_pair(d, string(d, ' '));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
string const Buffer::asciiParagraph(Paragraph const & par,
|
||||
unsigned int linelen,
|
||||
bool noparbreak) const
|
||||
{
|
||||
ostringstream buffer;
|
||||
int ltype = 0;
|
||||
Paragraph::depth_type ltype_depth = 0;
|
||||
bool ref_printed = false;
|
||||
Paragraph::depth_type depth = par.params().depth();
|
||||
|
||||
// First write the layout
|
||||
string const & tmp = par.layout()->name();
|
||||
if (compare_no_case(tmp, "itemize") == 0) {
|
||||
ltype = 1;
|
||||
ltype_depth = depth + 1;
|
||||
} else if (compare_ascii_no_case(tmp, "enumerate") == 0) {
|
||||
ltype = 2;
|
||||
ltype_depth = depth + 1;
|
||||
} else if (contains(ascii_lowercase(tmp), "ection")) {
|
||||
ltype = 3;
|
||||
ltype_depth = depth + 1;
|
||||
} else if (contains(ascii_lowercase(tmp), "aragraph")) {
|
||||
ltype = 4;
|
||||
ltype_depth = depth + 1;
|
||||
} else if (compare_ascii_no_case(tmp, "description") == 0) {
|
||||
ltype = 5;
|
||||
ltype_depth = depth + 1;
|
||||
} else if (compare_ascii_no_case(tmp, "abstract") == 0) {
|
||||
ltype = 6;
|
||||
ltype_depth = 0;
|
||||
} else if (compare_ascii_no_case(tmp, "bibliography") == 0) {
|
||||
ltype = 7;
|
||||
ltype_depth = 0;
|
||||
} else {
|
||||
ltype = 0;
|
||||
ltype_depth = 0;
|
||||
}
|
||||
|
||||
/* maybe some vertical spaces */
|
||||
|
||||
/* the labelwidthstring used in lists */
|
||||
|
||||
/* some lines? */
|
||||
|
||||
/* some pagebreaks? */
|
||||
|
||||
/* noindent ? */
|
||||
|
||||
/* what about the alignment */
|
||||
|
||||
// linelen <= 0 is special and means we don't have paragraph breaks
|
||||
|
||||
string::size_type currlinelen = 0;
|
||||
|
||||
if (!noparbreak) {
|
||||
if (linelen > 0)
|
||||
buffer << "\n\n";
|
||||
|
||||
buffer << string(depth * 2, ' ');
|
||||
currlinelen += depth * 2;
|
||||
|
||||
//--
|
||||
// we should probably change to the paragraph language in the
|
||||
// gettext here (if possible) so that strings are outputted in
|
||||
// the correct language! (20012712 Jug)
|
||||
//--
|
||||
switch (ltype) {
|
||||
case 0: // Standard
|
||||
case 4: // (Sub)Paragraph
|
||||
case 5: // Description
|
||||
break;
|
||||
case 6: // Abstract
|
||||
if (linelen > 0) {
|
||||
buffer << _("Abstract") << "\n\n";
|
||||
currlinelen = 0;
|
||||
} else {
|
||||
string const abst = _("Abstract: ");
|
||||
buffer << abst;
|
||||
currlinelen += abst.length();
|
||||
}
|
||||
break;
|
||||
case 7: // Bibliography
|
||||
if (!ref_printed) {
|
||||
if (linelen > 0) {
|
||||
buffer << _("References") << "\n\n";
|
||||
currlinelen = 0;
|
||||
} else {
|
||||
string const refs = _("References: ");
|
||||
buffer << refs;
|
||||
currlinelen += refs.length();
|
||||
}
|
||||
|
||||
ref_printed = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
string const parlab = par.params().labelString();
|
||||
buffer << parlab << ' ';
|
||||
currlinelen += parlab.length() + 1;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!currlinelen) {
|
||||
pair<int, string> p = addDepth(depth, ltype_depth);
|
||||
buffer << p.second;
|
||||
currlinelen += p.first;
|
||||
}
|
||||
|
||||
// this is to change the linebreak to do it by word a bit more
|
||||
// intelligent hopefully! (only in the case where we have a
|
||||
// max linelength!) (Jug)
|
||||
|
||||
string word;
|
||||
|
||||
for (pos_type i = 0; i < par.size(); ++i) {
|
||||
char c = par.getUChar(params(), i);
|
||||
switch (c) {
|
||||
case Paragraph::META_INSET:
|
||||
{
|
||||
InsetOld const * inset = par.getInset(i);
|
||||
if (inset) {
|
||||
if (linelen > 0) {
|
||||
buffer << word;
|
||||
currlinelen += word.length();
|
||||
word.erase();
|
||||
}
|
||||
if (inset->ascii(*this, buffer, linelen)) {
|
||||
// to be sure it breaks paragraph
|
||||
currlinelen += linelen;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (c == ' ') {
|
||||
if (linelen > 0 &&
|
||||
currlinelen + word.length() > linelen - 10) {
|
||||
buffer << "\n";
|
||||
pair<int, string> p = addDepth(depth, ltype_depth);
|
||||
buffer << p.second;
|
||||
currlinelen = p.first;
|
||||
}
|
||||
|
||||
buffer << word << ' ';
|
||||
currlinelen += word.length() + 1;
|
||||
word.erase();
|
||||
|
||||
} else {
|
||||
if (c != '\0') {
|
||||
word += c;
|
||||
} else {
|
||||
lyxerr[Debug::INFO] <<
|
||||
"writeAsciiFile: NULL char in structure." << endl;
|
||||
}
|
||||
if ((linelen > 0) &&
|
||||
(currlinelen + word.length()) > linelen)
|
||||
{
|
||||
buffer << "\n";
|
||||
|
||||
pair<int, string> p =
|
||||
addDepth(depth, ltype_depth);
|
||||
buffer << p.second;
|
||||
currlinelen = p.first;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
buffer << word;
|
||||
return buffer.str();
|
||||
}
|
||||
|
||||
|
||||
void Buffer::writeFileAscii(string const & fname, int linelen)
|
||||
void Buffer::writeFileAscii(string const & fname, LatexRunParams const & runparams)
|
||||
{
|
||||
ofstream ofs;
|
||||
if (!::openFileWrite(ofs, fname))
|
||||
return;
|
||||
writeFileAscii(ofs, linelen);
|
||||
writeFileAscii(ofs, runparams);
|
||||
}
|
||||
|
||||
|
||||
void Buffer::writeFileAscii(ostream & os, int linelen)
|
||||
void Buffer::writeFileAscii(ostream & os, LatexRunParams const & runparams)
|
||||
{
|
||||
ParagraphList::iterator beg = paragraphs().begin();
|
||||
ParagraphList::iterator end = paragraphs().end();
|
||||
ParagraphList::iterator it = beg;
|
||||
for (; it != end; ++it) {
|
||||
os << asciiParagraph(*it, linelen, it == beg);
|
||||
asciiParagraph(*this, *it, os, runparams, it == beg);
|
||||
}
|
||||
os << "\n";
|
||||
}
|
||||
@ -1261,13 +1066,15 @@ bool Buffer::isSGML() const
|
||||
}
|
||||
|
||||
|
||||
void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
||||
void Buffer::makeLinuxDocFile(string const & fname,
|
||||
LatexRunParams const & runparams,
|
||||
bool body_only )
|
||||
{
|
||||
ofstream ofs;
|
||||
if (!::openFileWrite(ofs, fname))
|
||||
return;
|
||||
|
||||
niceFile() = nice; // this will be used by included files.
|
||||
niceFile() = runparams.nice; // this will be used by included files.
|
||||
|
||||
LaTeXFeatures features(*this, params());
|
||||
|
||||
@ -1283,7 +1090,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
||||
ofs << "<!doctype linuxdoc system";
|
||||
|
||||
string preamble = params().preamble;
|
||||
string const name = nice ? ChangeExtension(pimpl_->filename, ".sgml")
|
||||
string const name = runparams.nice ? ChangeExtension(pimpl_->filename, ".sgml")
|
||||
: fname;
|
||||
preamble += features.getIncludedFiles(name);
|
||||
preamble += features.getLyXSGMLEntities();
|
||||
@ -1307,7 +1114,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
||||
<< " created this file. For more info see http://www.lyx.org/"
|
||||
<< " -->\n";
|
||||
|
||||
linuxdocParagraphs(*this, paragraphs(), ofs);
|
||||
linuxdocParagraphs(*this, paragraphs(), ofs, runparams);
|
||||
|
||||
if (!body_only) {
|
||||
ofs << "\n\n";
|
||||
@ -1322,13 +1129,15 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
||||
}
|
||||
|
||||
|
||||
void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
|
||||
void Buffer::makeDocBookFile(string const & fname,
|
||||
LatexRunParams const & runparams,
|
||||
bool only_body)
|
||||
{
|
||||
ofstream ofs;
|
||||
if (!::openFileWrite(ofs, fname))
|
||||
return;
|
||||
|
||||
niceFile() = nice; // this will be used by Insetincludes.
|
||||
niceFile() = runparams.nice; // this will be used by Insetincludes.
|
||||
|
||||
LaTeXFeatures features(*this, params());
|
||||
validate(features);
|
||||
@ -1343,7 +1152,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
|
||||
<< " PUBLIC \"-//OASIS//DTD DocBook V4.1//EN\"";
|
||||
|
||||
string preamble = params().preamble;
|
||||
string const name = nice ? ChangeExtension(pimpl_->filename, ".sgml")
|
||||
string const name = runparams.nice ? ChangeExtension(pimpl_->filename, ".sgml")
|
||||
: fname;
|
||||
preamble += features.getIncludedFiles(name);
|
||||
preamble += features.getLyXSGMLEntities();
|
||||
@ -1368,7 +1177,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
|
||||
ofs << "<!-- DocBook file was created by LyX " << lyx_version
|
||||
<< "\n See http://www.lyx.org/ for more information -->\n";
|
||||
|
||||
docbookParagraphs(*this, paragraphs(), ofs);
|
||||
docbookParagraphs(*this, paragraphs(), ofs, runparams);
|
||||
|
||||
ofs << "\n\n";
|
||||
sgml::closeTag(ofs, 0, false, top_element);
|
||||
|
13
src/buffer.h
13
src/buffer.h
@ -134,12 +134,9 @@ public:
|
||||
bool writeFile(std::string const &) const;
|
||||
|
||||
///
|
||||
void writeFileAscii(std::string const &, int);
|
||||
void writeFileAscii(std::string const &, LatexRunParams const &);
|
||||
///
|
||||
void writeFileAscii(std::ostream &, int);
|
||||
///
|
||||
std::string const asciiParagraph(Paragraph const &, unsigned int linelen,
|
||||
bool noparbreak = false) const;
|
||||
void writeFileAscii(std::ostream &, LatexRunParams const &);
|
||||
/// Just a wrapper for the method below, first creating the ofstream.
|
||||
void makeLaTeXFile(std::string const & filename,
|
||||
std::string const & original_path,
|
||||
@ -154,10 +151,12 @@ public:
|
||||
bool output_body = true);
|
||||
///
|
||||
void makeLinuxDocFile(std::string const & filename,
|
||||
bool nice, bool only_body = false);
|
||||
LatexRunParams const & runparams_in,
|
||||
bool only_body = false);
|
||||
///
|
||||
void makeDocBookFile(std::string const & filename,
|
||||
bool nice, bool only_body = false);
|
||||
LatexRunParams const & runparams_in,
|
||||
bool only_body = false);
|
||||
/// returns the main language for the buffer (document)
|
||||
Language const * getLanguage() const;
|
||||
/// get l10n translated to the buffers language
|
||||
|
@ -62,6 +62,7 @@ bool Exporter::Export(Buffer * buffer, string const & format,
|
||||
string backend_format;
|
||||
LatexRunParams runparams;
|
||||
runparams.flavor = LatexRunParams::LATEX;
|
||||
runparams.linelen = lyxrc.ascii_linelen;
|
||||
vector<string> backends = Backends(*buffer);
|
||||
if (find(backends.begin(), backends.end(), format) == backends.end()) {
|
||||
for (vector<string>::const_iterator it = backends.begin();
|
||||
@ -92,13 +93,17 @@ bool Exporter::Export(Buffer * buffer, string const & format,
|
||||
|
||||
// Ascii backend
|
||||
if (backend_format == "text")
|
||||
buffer->writeFileAscii(filename, lyxrc.ascii_linelen);
|
||||
buffer->writeFileAscii(filename, runparams);
|
||||
// Linuxdoc backend
|
||||
else if (buffer->isLinuxDoc())
|
||||
buffer->makeLinuxDocFile(filename, !put_in_tempdir);
|
||||
else if (buffer->isLinuxDoc()) {
|
||||
runparams.nice = !put_in_tempdir;
|
||||
buffer->makeLinuxDocFile(filename, runparams);
|
||||
}
|
||||
// Docbook backend
|
||||
else if (buffer->isDocBook())
|
||||
buffer->makeDocBookFile(filename, !put_in_tempdir);
|
||||
else if (buffer->isDocBook()) {
|
||||
runparams.nice = !put_in_tempdir;
|
||||
buffer->makeDocBookFile(filename, runparams);
|
||||
}
|
||||
// LaTeX backend
|
||||
else if (backend_format == format) {
|
||||
runparams.nice = true;
|
||||
|
@ -1,3 +1,37 @@
|
||||
2003-10-31 José Matos <jamatos@lyx.org>
|
||||
|
||||
* inset.h (ascii, linuxdoc, docbook):
|
||||
* insetbox.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetbranch.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetcaption.[Ch] (ascii, docbook):
|
||||
* insetcollapsable.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetcommand.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetert.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetexternal.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetfloat.[Ch] (linuxdoc, docbook):
|
||||
* insetfloatlist.[Ch] (ascii):
|
||||
* insetfoot.[Ch] (docbook):
|
||||
* insetgraphics.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insethfill.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetinclude.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetindex.[Ch] (docbook):
|
||||
* insetlabel.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetlatexaccent.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetline.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetnewline.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetnote.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetpagebreak.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetquotes.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetref.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetspace.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetspecialchar.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetspecialchar.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insettext.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insettoc.[Ch] (ascii, linuxdoc, docbook):
|
||||
* inseturl.[Ch] (ascii, linuxdoc, docbook):
|
||||
* insetwrap.[Ch] (docbook):
|
||||
add LatexRunParams argument.
|
||||
|
||||
2003-10-30 José Matos <jamatos@lyx.org>
|
||||
|
||||
* insettext.C (linuxdoc, docbook): use new pagraph generation code.
|
||||
|
@ -184,12 +184,14 @@ public:
|
||||
virtual int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const = 0;
|
||||
///
|
||||
virtual int ascii(Buffer const &,
|
||||
std::ostream &, int linelen = 0) const = 0;
|
||||
virtual int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const = 0;
|
||||
///
|
||||
virtual int linuxdoc(Buffer const &, std::ostream &) const = 0;
|
||||
virtual int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const = 0;
|
||||
///
|
||||
virtual int docbook(Buffer const &, std::ostream &, bool) const = 0;
|
||||
virtual int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const = 0;
|
||||
|
||||
/// returns LyX code associated with the inset. Used for TOC, ...)
|
||||
virtual InsetOld::Code lyxCode() const { return NO_CODE; }
|
||||
|
@ -325,19 +325,22 @@ int InsetBox::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetBox::linuxdoc(Buffer const & buf, std::ostream & os) const
|
||||
int InsetBox::linuxdoc(Buffer const & buf, std::ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
return inset.linuxdoc(buf, os);
|
||||
return inset.linuxdoc(buf, os, runparams);
|
||||
}
|
||||
|
||||
|
||||
int InsetBox::docbook(Buffer const & buf, std::ostream & os, bool mixcont) const
|
||||
int InsetBox::docbook(Buffer const & buf, std::ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
return inset.docbook(buf, os, mixcont);
|
||||
return inset.docbook(buf, os, runparams);
|
||||
}
|
||||
|
||||
|
||||
int InsetBox::ascii(Buffer const & buf, std::ostream & os, int ll) const
|
||||
int InsetBox::ascii(Buffer const & buf, std::ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
int i = 0;
|
||||
string const pt = params_.type;
|
||||
@ -362,7 +365,7 @@ int InsetBox::ascii(Buffer const & buf, std::ostream & os, int ll) const
|
||||
break;
|
||||
}
|
||||
|
||||
i = inset.ascii(buf, os, ll);
|
||||
i = inset.ascii(buf, os, runparams);
|
||||
|
||||
switch (btype) {
|
||||
case Frameless:
|
||||
|
@ -81,11 +81,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const & runparams) const;
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
///
|
||||
|
@ -162,29 +162,32 @@ int InsetBranch::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetBranch::linuxdoc(Buffer const & buf, std::ostream & os) const
|
||||
int InsetBranch::linuxdoc(Buffer const & buf, std::ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
string const branch_sel = buf.params().branchlist().allSelected();
|
||||
if (branch_sel.find(params_.branch, 0) != string::npos)
|
||||
return inset.linuxdoc(buf, os);
|
||||
return inset.linuxdoc(buf, os, runparams);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetBranch::docbook(Buffer const & buf, std::ostream & os, bool mixcont) const
|
||||
int InsetBranch::docbook(Buffer const & buf, std::ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
string const branch_sel = buf.params().branchlist().allSelected();
|
||||
if (branch_sel.find(params_.branch, 0) != string::npos)
|
||||
return inset.docbook(buf, os, mixcont);
|
||||
return inset.docbook(buf, os, runparams);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetBranch::ascii(Buffer const & buf, std::ostream & os, int ll) const
|
||||
int InsetBranch::ascii(Buffer const & buf, std::ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
string const branch_sel = buf.params().branchlist().allSelected();
|
||||
if (branch_sel.find(params_.branch, 0) != string::npos) {
|
||||
return inset.ascii(buf, os, ll);
|
||||
return inset.ascii(buf, os, runparams);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -59,11 +59,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const & runparams) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const & runparams) const;
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
///
|
||||
|
@ -127,19 +127,20 @@ int InsetCaption::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetCaption::ascii(Buffer const & /*buf*/,
|
||||
ostream & /*os*/, int /*linelen*/) const
|
||||
int InsetCaption::ascii(Buffer const & /*buf*/,ostream & /*os*/,
|
||||
LatexRunParams const & /*runparams*/) const
|
||||
{
|
||||
// FIX: Implement me!
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetCaption::docbook(Buffer const & buf, ostream & os, bool mixcont) const
|
||||
int InsetCaption::docbook(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
int ret;
|
||||
os << "<title>";
|
||||
ret = InsetText::docbook(buf, os, mixcont);
|
||||
ret = InsetText::docbook(buf, os, runparams);
|
||||
os << "</title>\n";
|
||||
return ret;
|
||||
}
|
||||
|
@ -37,9 +37,11 @@ public:
|
||||
virtual int latex(Buffer const & buf, std::ostream & os,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const & buf, std::ostream & os, int linelen) const;
|
||||
int ascii(Buffer const & buf, std::ostream & os,
|
||||
LatexRunParams const & runparams) const;
|
||||
///
|
||||
int docbook(Buffer const & buf, std::ostream & os, bool mixcont) const;
|
||||
int docbook(Buffer const & buf, std::ostream & os,
|
||||
LatexRunParams const & runparams) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -248,21 +248,24 @@ int InsetCollapsable::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetCollapsable::ascii(Buffer const & buf, ostream & os, int ll) const
|
||||
int InsetCollapsable::ascii(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
return inset.ascii(buf, os, ll);
|
||||
return inset.ascii(buf, os, runparams);
|
||||
}
|
||||
|
||||
|
||||
int InsetCollapsable::linuxdoc(Buffer const & buf, ostream & os) const
|
||||
int InsetCollapsable::linuxdoc(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
return inset.linuxdoc(buf, os);
|
||||
return inset.linuxdoc(buf, os, runparams);
|
||||
}
|
||||
|
||||
|
||||
int InsetCollapsable::docbook(Buffer const & buf, ostream & os, bool mixcont) const
|
||||
int InsetCollapsable::docbook(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
return inset.docbook(buf, os, mixcont);
|
||||
return inset.docbook(buf, os, runparams);
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,11 +71,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const & runparams) const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
/// FIXME, document
|
||||
|
@ -67,19 +67,22 @@ int InsetCommand::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetCommand::ascii(Buffer const &, ostream &, int) const
|
||||
int InsetCommand::ascii(Buffer const &, ostream &,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetCommand::linuxdoc(Buffer const &, ostream &) const
|
||||
int InsetCommand::linuxdoc(Buffer const &, ostream &,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetCommand::docbook(Buffer const &, ostream &, bool) const
|
||||
int InsetCommand::docbook(Buffer const &, ostream &,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -48,11 +48,14 @@ public:
|
||||
virtual int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
virtual int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
virtual int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
virtual int docbook(Buffer const &, std::ostream &, bool) const;
|
||||
virtual int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const & runparams) const;
|
||||
///
|
||||
InsetOld::Code lyxCode() const { return InsetOld::NO_CODE; }
|
||||
|
||||
|
@ -362,13 +362,15 @@ int InsetERT::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetERT::ascii(Buffer const &, ostream &, int /*linelen*/) const
|
||||
int InsetERT::ascii(Buffer const &, ostream &,
|
||||
LatexRunParams const & /*runparams*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetERT::linuxdoc(Buffer const &, ostream & os) const
|
||||
int InsetERT::linuxdoc(Buffer const &, ostream & os,
|
||||
LatexRunParams const &)const
|
||||
{
|
||||
ParagraphList::iterator par = inset.paragraphs.begin();
|
||||
ParagraphList::iterator end = inset.paragraphs.end();
|
||||
@ -395,7 +397,8 @@ int InsetERT::linuxdoc(Buffer const &, ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
int InsetERT::docbook(Buffer const &, ostream & os, bool) const
|
||||
int InsetERT::docbook(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
ParagraphList::iterator par = inset.paragraphs.begin();
|
||||
ParagraphList::iterator end = inset.paragraphs.end();
|
||||
|
@ -67,12 +67,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &,
|
||||
std::ostream &, int linelen = 0) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const & runparams) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const & runparams) const;
|
||||
///
|
||||
void validate(LaTeXFeatures &) const {}
|
||||
///
|
||||
|
@ -683,19 +683,22 @@ int InsetExternal::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetExternal::ascii(Buffer const & buf, ostream & os, int) const
|
||||
int InsetExternal::ascii(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
return external::writeExternal(params_, "Ascii", buf, os);
|
||||
}
|
||||
|
||||
|
||||
int InsetExternal::linuxdoc(Buffer const & buf, ostream & os) const
|
||||
int InsetExternal::linuxdoc(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
return external::writeExternal(params_, "LinuxDoc", buf, os);
|
||||
}
|
||||
|
||||
|
||||
int InsetExternal::docbook(Buffer const & buf, ostream & os, bool) const
|
||||
int InsetExternal::docbook(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
return external::writeExternal(params_, "DocBook", buf, os);
|
||||
}
|
||||
|
@ -123,12 +123,14 @@ public:
|
||||
virtual int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
virtual int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
virtual int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
virtual int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
virtual int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
virtual int docbook(Buffer const &, std::ostream &,
|
||||
bool mixcont) const;
|
||||
LatexRunParams const &) const;
|
||||
|
||||
/// Update needed features for this inset.
|
||||
virtual void validate(LaTeXFeatures & features) const;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "gettext.h"
|
||||
#include "iterators.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "latexrunparams.h"
|
||||
#include "LColor.h"
|
||||
#include "lyxlex.h"
|
||||
#include "paragraph.h"
|
||||
@ -312,7 +313,8 @@ int InsetFloat::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetFloat::linuxdoc(Buffer const & buf, ostream & os) const
|
||||
int InsetFloat::linuxdoc(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
FloatList const & floats = buf.params().getLyXTextClass().floats();
|
||||
string const tmptype = params_.type;
|
||||
@ -342,17 +344,18 @@ int InsetFloat::linuxdoc(Buffer const & buf, ostream & os) const
|
||||
}
|
||||
os << ">";
|
||||
|
||||
int const i = inset.linuxdoc(buf, os);
|
||||
int const i = inset.linuxdoc(buf, os, runparams);
|
||||
os << "</" << tmptype << ">\n";
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
int InsetFloat::docbook(Buffer const & buf, ostream & os, bool mixcont) const
|
||||
int InsetFloat::docbook(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
os << '<' << params_.type << '>';
|
||||
int const i = inset.docbook(buf, os, mixcont);
|
||||
int const i = inset.docbook(buf, os, runparams);
|
||||
os << "</" << params_.type << '>';
|
||||
|
||||
return i;
|
||||
|
@ -58,9 +58,11 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
std::string const editMessage() const;
|
||||
///
|
||||
|
@ -169,7 +169,7 @@ int InsetFloatList::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetFloatList::ascii(Buffer const & buffer, ostream & os, int) const
|
||||
int InsetFloatList::ascii(Buffer const & buffer, ostream & os, LatexRunParams const &) const
|
||||
{
|
||||
os << getScreenLabel(buffer) << "\n\n";
|
||||
|
||||
|
@ -49,11 +49,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const { return 0; }
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const { return 0; }
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool) const { return 0; }
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const { return 0; }
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const & runparams) const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
protected:
|
||||
|
@ -72,10 +72,11 @@ int InsetFoot::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetFoot::docbook(Buffer const & buf, ostream & os, bool mixcont) const
|
||||
int InsetFoot::docbook(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
os << "<footnote>";
|
||||
int const i = inset.docbook(buf, os, mixcont);
|
||||
int const i = inset.docbook(buf, os, runparams);
|
||||
os << "</footnote>";
|
||||
|
||||
return i;
|
||||
|
@ -32,7 +32,8 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const & runparams) const;
|
||||
///
|
||||
std::string const editMessage() const;
|
||||
};
|
||||
|
@ -611,7 +611,8 @@ int InsetGraphics::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetGraphics::ascii(Buffer const &, ostream & os, int) const
|
||||
int InsetGraphics::ascii(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
// No graphics in ascii output. Possible to use gifscii to convert
|
||||
// images to ascii approximation.
|
||||
@ -624,7 +625,8 @@ int InsetGraphics::ascii(Buffer const &, ostream & os, int) const
|
||||
}
|
||||
|
||||
|
||||
int InsetGraphics::linuxdoc(Buffer const & buf, ostream & os) const
|
||||
int InsetGraphics::linuxdoc(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
string const file_name = buf.niceFile() ?
|
||||
params().filename.relFilename(buf.filePath()):
|
||||
@ -640,7 +642,7 @@ int InsetGraphics::linuxdoc(Buffer const & buf, ostream & os) const
|
||||
// http://en.tldp.org/LDP/LDP-Author-Guide/inserting-pictures.html
|
||||
// See also the docbook guide at http://www.docbook.org/
|
||||
int InsetGraphics::docbook(Buffer const &, ostream & os,
|
||||
bool /*mixcont*/) const
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
// In DocBook v5.0, the graphic tag will be eliminated from DocBook, will
|
||||
// need to switch to MediaObject. However, for now this is sufficient and
|
||||
|
@ -48,11 +48,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
|
||||
/** Tell LyX what the latex features you need i.e. what latex packages
|
||||
you need to be included.
|
||||
|
@ -51,21 +51,24 @@ int InsetHFill::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetHFill::ascii(Buffer const &, ostream & os, int) const
|
||||
int InsetHFill::ascii(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << '\t';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetHFill::linuxdoc(Buffer const &, std::ostream & os) const
|
||||
int InsetHFill::linuxdoc(Buffer const &, std::ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << '\n';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetHFill::docbook(Buffer const &, std::ostream & os, bool) const
|
||||
int InsetHFill::docbook(Buffer const &, std::ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << '\n';
|
||||
return 0;
|
||||
|
@ -31,11 +31,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const & runparams) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const & runparams) const;
|
||||
///
|
||||
void write(Buffer const & buf, std::ostream & os) const;
|
||||
/// We don't need \begin_inset and \end_inset
|
||||
|
@ -364,7 +364,8 @@ int InsetInclude::latex(Buffer const & buffer, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetInclude::ascii(Buffer const & buffer, ostream & os, int) const
|
||||
int InsetInclude::ascii(Buffer const & buffer, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
if (isVerbatim(params_))
|
||||
os << GetFileContents(includedFilename(buffer, params_));
|
||||
@ -372,7 +373,8 @@ int InsetInclude::ascii(Buffer const & buffer, ostream & os, int) const
|
||||
}
|
||||
|
||||
|
||||
int InsetInclude::linuxdoc(Buffer const & buffer, ostream & os) const
|
||||
int InsetInclude::linuxdoc(Buffer const & buffer, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
string incfile(params_.getContents());
|
||||
|
||||
@ -399,7 +401,9 @@ int InsetInclude::linuxdoc(Buffer const & buffer, ostream & os) const
|
||||
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
|
||||
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
||||
|
||||
tmp->makeLinuxDocFile(writefile, buffer.niceFile(), true);
|
||||
LatexRunParams runp = runparams;
|
||||
runp.nice = buffer.niceFile();
|
||||
tmp->makeLinuxDocFile(writefile, runp, true);
|
||||
}
|
||||
|
||||
if (isVerbatim(params_)) {
|
||||
@ -414,7 +418,7 @@ int InsetInclude::linuxdoc(Buffer const & buffer, ostream & os) const
|
||||
|
||||
|
||||
int InsetInclude::docbook(Buffer const & buffer, ostream & os,
|
||||
bool /*mixcont*/) const
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
string incfile(params_.getContents());
|
||||
|
||||
@ -440,7 +444,9 @@ int InsetInclude::docbook(Buffer const & buffer, ostream & os,
|
||||
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
|
||||
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
||||
|
||||
tmp->makeDocBookFile(writefile, buffer.niceFile(), true);
|
||||
LatexRunParams runp = runparams;
|
||||
runp.nice = buffer.niceFile();
|
||||
tmp->makeDocBookFile(writefile, runp, true);
|
||||
}
|
||||
|
||||
if (isVerbatim(params_)) {
|
||||
|
@ -66,13 +66,17 @@ public:
|
||||
///
|
||||
void read(Buffer const &, LyXLex &);
|
||||
///
|
||||
int latex(Buffer const &, std::ostream &, LatexRunParams const &) const;
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
///
|
||||
|
@ -76,7 +76,8 @@ InsetIndex::priv_dispatch(FuncRequest const & cmd,
|
||||
}
|
||||
|
||||
|
||||
int InsetIndex::docbook(Buffer const &, ostream & os, bool) const
|
||||
int InsetIndex::docbook(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << "<indexterm><primary>" << getContents()
|
||||
<< "</primary></indexterm>";
|
||||
|
@ -36,7 +36,8 @@ public:
|
||||
///
|
||||
InsetOld::Code lyxCode() const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
|
@ -102,21 +102,24 @@ int InsetLabel::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetLabel::ascii(Buffer const &, ostream & os, int) const
|
||||
int InsetLabel::ascii(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << '<' << getContents() << '>';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetLabel::linuxdoc(Buffer const &, ostream & os) const
|
||||
int InsetLabel::linuxdoc(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << "<label id=\"" << getContents() << "\" >";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetLabel::docbook(Buffer const &, ostream & os, bool) const
|
||||
int InsetLabel::docbook(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << "<anchor id=\"" << getContents() << "\">";
|
||||
return 0;
|
||||
|
@ -34,11 +34,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
|
@ -608,21 +608,24 @@ int InsetLatexAccent::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetLatexAccent::ascii(Buffer const &, ostream & os, int) const
|
||||
int InsetLatexAccent::ascii(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << contents;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetLatexAccent::linuxdoc(Buffer const &, ostream & os) const
|
||||
int InsetLatexAccent::linuxdoc(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << contents;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetLatexAccent::docbook(Buffer const &, ostream & os, bool) const
|
||||
int InsetLatexAccent::docbook(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << contents;
|
||||
return 0;
|
||||
|
@ -50,11 +50,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
bool directWrite() const;
|
||||
///
|
||||
|
@ -67,21 +67,24 @@ int InsetLine::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetLine::ascii(Buffer const &, ostream & os, int) const
|
||||
int InsetLine::ascii(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << "-------------------------------------------";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetLine::linuxdoc(Buffer const &, std::ostream & os) const
|
||||
int InsetLine::linuxdoc(Buffer const &, std::ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << '\n';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetLine::docbook(Buffer const &, std::ostream & os, bool) const
|
||||
int InsetLine::docbook(Buffer const &, std::ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << '\n';
|
||||
return 0;
|
||||
|
@ -33,11 +33,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
|
||||
int docbook(Buffer const &, std::ostream &, bool) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
|
||||
void read(Buffer const &, LyXLex & lex);
|
||||
|
||||
|
@ -57,21 +57,24 @@ int InsetNewline::latex(Buffer const &, ostream &,
|
||||
}
|
||||
|
||||
|
||||
int InsetNewline::ascii(Buffer const &, ostream & os, int) const
|
||||
int InsetNewline::ascii(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << '\n';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetNewline::linuxdoc(Buffer const &, std::ostream & os) const
|
||||
int InsetNewline::linuxdoc(Buffer const &, std::ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << '\n';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetNewline::docbook(Buffer const &, std::ostream & os, bool) const
|
||||
int InsetNewline::docbook(Buffer const &, std::ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << '\n';
|
||||
return 0;
|
||||
|
@ -33,11 +33,14 @@ public:
|
||||
virtual int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
|
||||
virtual int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
virtual int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
|
||||
virtual int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
virtual int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
|
||||
virtual int docbook(Buffer const &, std::ostream &, bool) const;
|
||||
virtual int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
|
||||
virtual void read(Buffer const &, LyXLex & lex);
|
||||
|
||||
|
@ -168,7 +168,7 @@ InsetNote::priv_dispatch(FuncRequest const & cmd,
|
||||
|
||||
|
||||
int InsetNote::latex(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
string const pt = params_.type;
|
||||
|
||||
@ -194,7 +194,8 @@ int InsetNote::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetNote::linuxdoc(Buffer const & buf, std::ostream & os) const
|
||||
int InsetNote::linuxdoc(Buffer const & buf, std::ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
string const pt = params_.type;
|
||||
|
||||
@ -203,7 +204,7 @@ int InsetNote::linuxdoc(Buffer const & buf, std::ostream & os) const
|
||||
os << "<comment>\n";
|
||||
|
||||
if (pt != "Note")
|
||||
i = inset.linuxdoc(buf, os);
|
||||
i = inset.linuxdoc(buf, os, runparams);
|
||||
|
||||
if (pt == "Comment") {
|
||||
os << "\n</comment>\n";
|
||||
@ -213,7 +214,8 @@ int InsetNote::linuxdoc(Buffer const & buf, std::ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
int InsetNote::docbook(Buffer const & buf, std::ostream & os, bool mixcont) const
|
||||
int InsetNote::docbook(Buffer const & buf, std::ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
string const pt = params_.type;
|
||||
|
||||
@ -222,7 +224,7 @@ int InsetNote::docbook(Buffer const & buf, std::ostream & os, bool mixcont) cons
|
||||
os << "<remark>\n";
|
||||
|
||||
if (pt != "Note")
|
||||
i = inset.docbook(buf, os, mixcont);
|
||||
i = inset.docbook(buf, os, runparams);
|
||||
|
||||
if (pt == "Comment") {
|
||||
os << "\n</remark>\n";
|
||||
@ -232,13 +234,14 @@ int InsetNote::docbook(Buffer const & buf, std::ostream & os, bool mixcont) cons
|
||||
}
|
||||
|
||||
|
||||
int InsetNote::ascii(Buffer const & buf, std::ostream & os, int ll) const
|
||||
int InsetNote::ascii(Buffer const & buf, std::ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
int i = 0;
|
||||
string const pt = params_.type;
|
||||
if (pt != "Note") {
|
||||
os << "[";
|
||||
i = inset.ascii(buf, os, ll);
|
||||
i = inset.ascii(buf, os, runparams);
|
||||
os << "]";
|
||||
}
|
||||
return i;
|
||||
|
@ -57,13 +57,16 @@ public:
|
||||
bool showInsetDialog(BufferView * bv) const;
|
||||
///
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
///
|
||||
|
@ -75,28 +75,31 @@ void InsetPagebreak::draw(PainterInfo & pi, int x, int y) const
|
||||
|
||||
|
||||
int InsetPagebreak::latex(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << "\\newpage{}";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetPagebreak::ascii(Buffer const &, ostream & os, int) const
|
||||
int InsetPagebreak::ascii(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << "-------------------------------------------";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetPagebreak::linuxdoc(Buffer const &, std::ostream & os) const
|
||||
int InsetPagebreak::linuxdoc(Buffer const &, std::ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << '\n';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetPagebreak::docbook(Buffer const &, std::ostream & os, bool) const
|
||||
int InsetPagebreak::docbook(Buffer const &, std::ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << '\n';
|
||||
return 0;
|
||||
|
@ -31,13 +31,16 @@ public:
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
LatexRunParams const &) const;
|
||||
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
|
||||
int docbook(Buffer const &, std::ostream &, bool) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
|
||||
void read(Buffer const &, LyXLex & lex);
|
||||
|
||||
|
@ -305,21 +305,24 @@ int InsetQuotes::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetQuotes::ascii(Buffer const &, ostream & os, int) const
|
||||
int InsetQuotes::ascii(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << '"';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetQuotes::linuxdoc(Buffer const &, ostream & os) const
|
||||
int InsetQuotes::linuxdoc(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << '"';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetQuotes::docbook(Buffer const &, ostream & os, bool) const
|
||||
int InsetQuotes::docbook(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
if (times_ == DoubleQ) {
|
||||
if (side_ == LeftQ)
|
||||
|
@ -85,11 +85,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
///
|
||||
|
@ -98,14 +98,16 @@ int InsetRef::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetRef::ascii(Buffer const &, ostream & os, int) const
|
||||
int InsetRef::ascii(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << '[' << getContents() << ']';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetRef::linuxdoc(Buffer const &, ostream & os) const
|
||||
int InsetRef::linuxdoc(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << "<ref id=\"" << getContents()
|
||||
<< "\" name=\"" << getOptions() << "\" >";
|
||||
@ -113,7 +115,8 @@ int InsetRef::linuxdoc(Buffer const &, ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
int InsetRef::docbook(Buffer const &, ostream & os, bool) const
|
||||
int InsetRef::docbook(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
if (getOptions().empty()) {
|
||||
os << "<xref linkend=\"" << getContents() << "\">";
|
||||
|
@ -57,11 +57,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
protected:
|
||||
|
@ -194,7 +194,8 @@ int InsetSpace::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetSpace::ascii(Buffer const &, ostream & os, int) const
|
||||
int InsetSpace::ascii(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
switch (kind_) {
|
||||
case NORMAL:
|
||||
@ -212,7 +213,8 @@ int InsetSpace::ascii(Buffer const &, ostream & os, int) const
|
||||
}
|
||||
|
||||
|
||||
int InsetSpace::linuxdoc(Buffer const &, ostream & os) const
|
||||
int InsetSpace::linuxdoc(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
switch (kind_) {
|
||||
case NORMAL:
|
||||
@ -232,7 +234,8 @@ int InsetSpace::linuxdoc(Buffer const &, ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
int InsetSpace::docbook(Buffer const &, ostream & os, bool) const
|
||||
int InsetSpace::docbook(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
switch (kind_) {
|
||||
case NORMAL:
|
||||
|
@ -64,11 +64,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
virtual std::auto_ptr<InsetBase> clone() const;
|
||||
///
|
||||
|
@ -180,7 +180,8 @@ int InsetSpecialChar::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetSpecialChar::ascii(Buffer const &, ostream & os, int) const
|
||||
int InsetSpecialChar::ascii(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
switch (kind_) {
|
||||
case HYPHENATION:
|
||||
@ -200,7 +201,8 @@ int InsetSpecialChar::ascii(Buffer const &, ostream & os, int) const
|
||||
}
|
||||
|
||||
|
||||
int InsetSpecialChar::linuxdoc(Buffer const &, ostream & os) const
|
||||
int InsetSpecialChar::linuxdoc(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
switch (kind_) {
|
||||
case HYPHENATION:
|
||||
@ -220,7 +222,8 @@ int InsetSpecialChar::linuxdoc(Buffer const &, ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
int InsetSpecialChar::docbook(Buffer const &, ostream & os, bool) const
|
||||
int InsetSpecialChar::docbook(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
switch (kind_) {
|
||||
case HYPHENATION:
|
||||
|
@ -56,11 +56,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
virtual std::auto_ptr<InsetBase> clone() const;
|
||||
///
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "FuncStatus.h"
|
||||
#include "gettext.h"
|
||||
#include "language.h"
|
||||
#include "latexrunparams.h"
|
||||
#include "LColor.h"
|
||||
#include "lyx_cb.h"
|
||||
#include "lyxlex.h"
|
||||
@ -1127,22 +1128,26 @@ int InsetTabular::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetTabular::ascii(Buffer const & buf, ostream & os, int ll) const
|
||||
int InsetTabular::ascii(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
if (ll > 0)
|
||||
return tabular.ascii(buf, os, ownerPar(buf, this).params().depth(),
|
||||
false, 0);
|
||||
return tabular.ascii(buf, os, 0, false, 0);
|
||||
if (runparams.linelen > 0)
|
||||
return tabular.ascii(buf, os, runparams,
|
||||
ownerPar(buf, this).params().depth(),
|
||||
false, 0);
|
||||
return tabular.ascii(buf, os, runparams, 0, false, 0);
|
||||
}
|
||||
|
||||
|
||||
int InsetTabular::linuxdoc(Buffer const & buf, ostream & os) const
|
||||
int InsetTabular::linuxdoc(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
return tabular.linuxdoc(buf,os);
|
||||
return tabular.linuxdoc(buf,os, runparams);
|
||||
}
|
||||
|
||||
|
||||
int InsetTabular::docbook(Buffer const & buf, ostream & os, bool mixcont) const
|
||||
int InsetTabular::docbook(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
int ret = 0;
|
||||
InsetOld * master;
|
||||
@ -1155,14 +1160,14 @@ int InsetTabular::docbook(Buffer const & buf, ostream & os, bool mixcont) const
|
||||
|
||||
if (!master) {
|
||||
os << "<informaltable>";
|
||||
if (mixcont)
|
||||
if (runparams.mixed_content)
|
||||
os << endl;
|
||||
++ret;
|
||||
}
|
||||
ret += tabular.docbook(buf, os, mixcont);
|
||||
ret += tabular.docbook(buf, os, runparams);
|
||||
if (!master) {
|
||||
os << "</informaltable>";
|
||||
if (mixcont)
|
||||
if (runparams.mixed_content)
|
||||
os << endl;
|
||||
++ret;
|
||||
}
|
||||
@ -2269,7 +2274,8 @@ bool InsetTabular::copySelection(BufferView * bv)
|
||||
true, true);
|
||||
|
||||
ostringstream os;
|
||||
paste_tabular->ascii(*bv->buffer(), os,
|
||||
LatexRunParams const runparams;
|
||||
paste_tabular->ascii(*bv->buffer(), os, runparams,
|
||||
ownerPar(*bv->buffer(), this).params().depth(), true, '\t');
|
||||
bv->stuffClipboard(os.str());
|
||||
return true;
|
||||
|
@ -108,11 +108,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
|
@ -934,32 +934,32 @@ int InsetText::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetText::ascii(Buffer const & buf, ostream & os, int linelen) const
|
||||
int InsetText::ascii(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
unsigned int lines = 0;
|
||||
|
||||
ParagraphList::const_iterator beg = paragraphs.begin();
|
||||
ParagraphList::const_iterator end = paragraphs.end();
|
||||
ParagraphList::const_iterator it = beg;
|
||||
for (; it != end; ++it) {
|
||||
string const tmp = buf.asciiParagraph(*it, linelen, it == beg);
|
||||
lines += lyx::count(tmp.begin(), tmp.end(), '\n');
|
||||
os << tmp;
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
for (; it != end; ++it)
|
||||
asciiParagraph(buf, *it, os, runparams, it == beg);
|
||||
|
||||
|
||||
int InsetText::linuxdoc(Buffer const & buf, ostream & os) const
|
||||
{
|
||||
linuxdocParagraphs(buf, paragraphs, os);
|
||||
//FIXME: Give the total numbers of lines
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetText::docbook(Buffer const & buf, ostream & os, bool mixcont) const
|
||||
int InsetText::linuxdoc(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
docbookParagraphs(buf, paragraphs, os);
|
||||
linuxdocParagraphs(buf, paragraphs, os, runparams);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetText::docbook(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
docbookParagraphs(buf, paragraphs, os, runparams);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -83,11 +83,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const ;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const ;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const ;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const ;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
|
@ -94,7 +94,8 @@ InsetTOC::priv_dispatch(FuncRequest const & cmd,
|
||||
}
|
||||
|
||||
|
||||
int InsetTOC::ascii(Buffer const & buffer, ostream & os, int) const
|
||||
int InsetTOC::ascii(Buffer const & buffer, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << getScreenLabel(buffer) << "\n\n";
|
||||
|
||||
@ -105,7 +106,8 @@ int InsetTOC::ascii(Buffer const & buffer, ostream & os, int) const
|
||||
}
|
||||
|
||||
|
||||
int InsetTOC::linuxdoc(Buffer const &, ostream & os) const
|
||||
int InsetTOC::linuxdoc(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
if (getCmdName() == "tableofcontents")
|
||||
os << "<toc>";
|
||||
@ -113,7 +115,8 @@ int InsetTOC::linuxdoc(Buffer const &, ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
int InsetTOC::docbook(Buffer const &, ostream & os, bool) const
|
||||
int InsetTOC::docbook(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
if (getCmdName() == "tableofcontents")
|
||||
os << "<toc></toc>";
|
||||
|
@ -41,11 +41,14 @@ public:
|
||||
///
|
||||
bool display() const { return true; }
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
|
@ -94,7 +94,8 @@ int InsetUrl::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetUrl::ascii(Buffer const &, ostream & os, int) const
|
||||
int InsetUrl::ascii(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
if (getOptions().empty())
|
||||
os << '[' << getContents() << ']';
|
||||
@ -104,7 +105,8 @@ int InsetUrl::ascii(Buffer const &, ostream & os, int) const
|
||||
}
|
||||
|
||||
|
||||
int InsetUrl::linuxdoc(Buffer const &, ostream & os) const
|
||||
int InsetUrl::linuxdoc(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << '<' << getCmdName()
|
||||
<< " url=\"" << getContents() << "\""
|
||||
@ -114,7 +116,8 @@ int InsetUrl::linuxdoc(Buffer const &, ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
int InsetUrl::docbook(Buffer const &, ostream & os, bool) const
|
||||
int InsetUrl::docbook(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
os << "<ulink url=\"" << subst(getContents(),"&","&")
|
||||
<< "\">" << getOptions() << "</ulink>";
|
||||
|
@ -44,11 +44,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "funcrequest.h"
|
||||
#include "gettext.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "latexrunparams.h"
|
||||
#include "LColor.h"
|
||||
#include "lyxlex.h"
|
||||
#include "paragraph.h"
|
||||
@ -199,10 +200,11 @@ int InsetWrap::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetWrap::docbook(Buffer const & buf, ostream & os, bool mixcont) const
|
||||
int InsetWrap::docbook(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
os << '<' << params_.type << '>';
|
||||
int const i = inset.docbook(buf, os, mixcont);
|
||||
int const i = inset.docbook(buf, os, runparams);
|
||||
os << "</" << params_.type << '>';
|
||||
|
||||
return i;
|
||||
|
@ -55,7 +55,8 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
std::string const editMessage() const;
|
||||
///
|
||||
|
@ -20,7 +20,8 @@ struct LatexRunParams {
|
||||
|
||||
LatexRunParams() : flavor(LATEX), nice(false),
|
||||
moving_arg(false), free_spacing(false),
|
||||
use_babel(false) {}
|
||||
use_babel(false), mixed_content(false),
|
||||
linelen(0) {}
|
||||
|
||||
/** The latex that we export depends occasionally on what is to
|
||||
compile the file.
|
||||
@ -48,6 +49,16 @@ struct LatexRunParams {
|
||||
/** This var is set by the return value from BufferParams::writeLaTeX
|
||||
*/
|
||||
bool use_babel;
|
||||
|
||||
/** Used for docbook to see if inside a region of mixed content.
|
||||
In that case all the white spaces are significant and can not appear
|
||||
at the begin or end.
|
||||
*/
|
||||
bool mixed_content;
|
||||
|
||||
/** Line lenght to use with ascii export.
|
||||
*/
|
||||
int linelen;
|
||||
};
|
||||
|
||||
#endif // LATEXRUNPARAMS_H
|
||||
|
@ -1,3 +1,12 @@
|
||||
2003-10-31 José Matos <jamatos@lyx.org>
|
||||
|
||||
* formula.[Ch] (ascii, linuxdoc, docbook):
|
||||
* formulamacro.[Ch] (ascii, linuxdoc, docbook):
|
||||
* math_inset.[Ch] (ascii, linuxdoc, docbook):
|
||||
* math_inset.[Ch] (ascii, linuxdoc, docbook):
|
||||
* ref_inset.[Ch] (ascii, linuxdoc, docbook):
|
||||
add LatexRunParams argument.
|
||||
|
||||
2003-10-29 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* math_scriptinset.C (priv_dispatch):
|
||||
|
@ -108,7 +108,8 @@ int InsetFormula::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetFormula::ascii(Buffer const &, ostream & os, int) const
|
||||
int InsetFormula::ascii(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
if (0 && display()) {
|
||||
Dimension dim;
|
||||
@ -128,19 +129,21 @@ int InsetFormula::ascii(Buffer const &, ostream & os, int) const
|
||||
}
|
||||
|
||||
|
||||
int InsetFormula::linuxdoc(Buffer const & buf, ostream & os) const
|
||||
int InsetFormula::linuxdoc(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
return docbook(buf, os, false);
|
||||
return docbook(buf, os, runparams);
|
||||
}
|
||||
|
||||
|
||||
int InsetFormula::docbook(Buffer const & buf, ostream & os, bool) const
|
||||
int InsetFormula::docbook(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
MathMLStream ms(os);
|
||||
ms << MTag("equation");
|
||||
ms << MTag("alt");
|
||||
ms << "<[CDATA[";
|
||||
int res = ascii(buf, ms.os(), 0);
|
||||
int res = ascii(buf, ms.os(), runparams);
|
||||
ms << "]]>";
|
||||
ms << ETag("alt");
|
||||
ms << MTag("math");
|
||||
|
@ -47,11 +47,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
|
||||
///
|
||||
virtual std::auto_ptr<InsetBase> clone() const;
|
||||
|
@ -83,7 +83,8 @@ int InsetFormulaMacro::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetFormulaMacro::ascii(Buffer const &, ostream & os, int) const
|
||||
int InsetFormulaMacro::ascii(Buffer const &, ostream & os,
|
||||
LatexRunParams const &) const
|
||||
{
|
||||
WriteStream wi(os, false, true);
|
||||
par()->write(wi);
|
||||
@ -91,15 +92,17 @@ int InsetFormulaMacro::ascii(Buffer const &, ostream & os, int) const
|
||||
}
|
||||
|
||||
|
||||
int InsetFormulaMacro::linuxdoc(Buffer const & buf, ostream & os) const
|
||||
int InsetFormulaMacro::linuxdoc(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
return ascii(buf, os, 0);
|
||||
return ascii(buf, os, runparams);
|
||||
}
|
||||
|
||||
|
||||
int InsetFormulaMacro::docbook(Buffer const & buf, ostream & os, bool) const
|
||||
int InsetFormulaMacro::docbook(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
return ascii(buf, os, 0);
|
||||
return ascii(buf, os, runparams);
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,14 +40,17 @@ public:
|
||||
///
|
||||
void write(Buffer const &, std::ostream & os) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int latex(Buffer const &, std::ostream & os,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream & os) const;
|
||||
int linuxdoc(Buffer const &, std::ostream & os,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
|
||||
///
|
||||
virtual std::auto_ptr<InsetBase> clone() const;
|
||||
|
@ -210,19 +210,19 @@ void MathInset::mathmlize(MathMLStream & os) const
|
||||
}
|
||||
|
||||
|
||||
int MathInset::ascii(std::ostream &, int) const
|
||||
int MathInset::ascii(std::ostream &, LatexRunParams const &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int MathInset::linuxdoc(std::ostream &) const
|
||||
int MathInset::linuxdoc(std::ostream &, LatexRunParams const &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int MathInset::docbook(std::ostream &, bool) const
|
||||
int MathInset::docbook(std::ostream &, LatexRunParams const &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ inclusion in the "real LyX insets" FormulaInset and FormulaMacroInset.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
class LatexRunParams;
|
||||
class MathArrayInset;
|
||||
class MathAMSArrayInset;
|
||||
class MathCharInset;
|
||||
@ -237,11 +237,11 @@ public:
|
||||
/// describe content if cursor behind
|
||||
virtual void infoize2(std::ostream &) const {}
|
||||
/// plain ascii output
|
||||
virtual int ascii(std::ostream & os, int) const;
|
||||
virtual int ascii(std::ostream & os, LatexRunParams const &) const;
|
||||
/// linuxdoc output
|
||||
virtual int linuxdoc(std::ostream & os) const;
|
||||
virtual int linuxdoc(std::ostream & os, LatexRunParams const &) const;
|
||||
/// docbook output
|
||||
virtual int docbook(std::ostream & os, bool) const;
|
||||
virtual int docbook(std::ostream & os, LatexRunParams const &) const;
|
||||
|
||||
/// dump content to stderr for debugging
|
||||
virtual void dump() const;
|
||||
|
@ -123,14 +123,14 @@ void RefInset::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
int RefInset::ascii(std::ostream & os, int) const
|
||||
int RefInset::ascii(std::ostream & os, LatexRunParams const &) const
|
||||
{
|
||||
os << '[' << asString(cell(0)) << ']';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int RefInset::linuxdoc(std::ostream & os) const
|
||||
int RefInset::linuxdoc(std::ostream & os, LatexRunParams const &) const
|
||||
{
|
||||
os << "<ref id=\"" << asString(cell(0))
|
||||
<< "\" name=\"" << asString(cell(1)) << "\" >";
|
||||
@ -138,7 +138,7 @@ int RefInset::linuxdoc(std::ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
int RefInset::docbook(std::ostream & os, bool) const
|
||||
int RefInset::docbook(std::ostream & os, LatexRunParams const &) const
|
||||
{
|
||||
if (cell(1).empty()) {
|
||||
os << "<xref linkend=\"" << asString(cell(0)) << "\">";
|
||||
|
@ -36,11 +36,11 @@ public:
|
||||
virtual RefInset * asRefInset() { return this; }
|
||||
|
||||
/// plain ascii output
|
||||
int ascii(std::ostream & os, int) const;
|
||||
int ascii(std::ostream & os, LatexRunParams const &) const;
|
||||
/// linuxdoc output
|
||||
int linuxdoc(std::ostream & os) const;
|
||||
int linuxdoc(std::ostream & os, LatexRunParams const &) const;
|
||||
/// docbook output
|
||||
int docbook(std::ostream & os, bool) const;
|
||||
int docbook(std::ostream & os, LatexRunParams const &) const;
|
||||
|
||||
/// small wrapper for the time being
|
||||
DispatchResult localDispatch(FuncRequest const & cmd);
|
||||
|
@ -1124,6 +1124,7 @@ void reset(PAR_TAG & p1, PAR_TAG const & p2)
|
||||
void Paragraph::simpleLinuxDocOnePar(Buffer const & buf,
|
||||
ostream & os,
|
||||
LyXFont const & outerfont,
|
||||
LatexRunParams const & runparams,
|
||||
lyx::depth_type /*depth*/) const
|
||||
{
|
||||
LyXLayout_ptr const & style = layout();
|
||||
@ -1266,7 +1267,7 @@ void Paragraph::simpleLinuxDocOnePar(Buffer const & buf,
|
||||
|
||||
if (c == Paragraph::META_INSET) {
|
||||
InsetOld const * inset = getInset(i);
|
||||
inset->linuxdoc(buf, os);
|
||||
inset->linuxdoc(buf, os, runparams);
|
||||
font_old = font;
|
||||
continue;
|
||||
}
|
||||
@ -1319,6 +1320,7 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
|
||||
ostream & os,
|
||||
LyXFont const & outerfont,
|
||||
int & desc_on,
|
||||
LatexRunParams const & runparams,
|
||||
lyx::depth_type depth) const
|
||||
{
|
||||
bool emph_flag = false;
|
||||
@ -1361,7 +1363,7 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
|
||||
if (i || desc_on != 3) {
|
||||
if (style->latexparam() == "CDATA")
|
||||
os << "]]>";
|
||||
inset->docbook(buf, os, false);
|
||||
inset->docbook(buf, os, runparams);
|
||||
if (style->latexparam() == "CDATA")
|
||||
os << "<![CDATA[";
|
||||
}
|
||||
@ -1530,7 +1532,17 @@ bool Paragraph::isMultiLingual(BufferParams const & bparams)
|
||||
|
||||
// Convert the paragraph to a string.
|
||||
// Used for building the table of contents
|
||||
string const Paragraph::asString(Buffer const & buffer, bool label) const
|
||||
string const Paragraph::asString(Buffer const & buffer,
|
||||
bool label) const
|
||||
{
|
||||
LatexRunParams runparams;
|
||||
return asString(buffer, runparams, label);
|
||||
}
|
||||
|
||||
|
||||
string const Paragraph::asString(Buffer const & buffer,
|
||||
LatexRunParams const & runparams,
|
||||
bool label) const
|
||||
{
|
||||
#if 0
|
||||
string s;
|
||||
@ -1544,7 +1556,7 @@ string const Paragraph::asString(Buffer const & buffer, bool label) const
|
||||
else if (c == META_INSET &&
|
||||
getInset(i)->lyxCode() == InsetOld::MATH_CODE) {
|
||||
ostringstream os;
|
||||
getInset(i)->ascii(buffer, os);
|
||||
getInset(i)->ascii(buffer, os, runparams);
|
||||
s += subst(STRCONV(os.str()),'\n',' ');
|
||||
}
|
||||
}
|
||||
@ -1552,7 +1564,7 @@ string const Paragraph::asString(Buffer const & buffer, bool label) const
|
||||
return s;
|
||||
#else
|
||||
// This should really be done by the caller and not here.
|
||||
string ret = asString(buffer, 0, size(), label);
|
||||
string ret = asString(buffer, runparams, 0, size(), label);
|
||||
return subst(ret, '\n', ' ');
|
||||
#endif
|
||||
}
|
||||
@ -1561,6 +1573,16 @@ string const Paragraph::asString(Buffer const & buffer, bool label) const
|
||||
string const Paragraph::asString(Buffer const & buffer,
|
||||
pos_type beg, pos_type end, bool label) const
|
||||
{
|
||||
|
||||
LatexRunParams const runparams;
|
||||
return asString(buffer, runparams, beg, end, label);
|
||||
}
|
||||
|
||||
|
||||
string const Paragraph::asString(Buffer const & buffer,
|
||||
LatexRunParams const & runparams,
|
||||
pos_type beg, pos_type end, bool label) const
|
||||
{
|
||||
ostringstream os;
|
||||
|
||||
if (beg == 0 && label && !params().labelString().empty())
|
||||
@ -1571,7 +1593,7 @@ string const Paragraph::asString(Buffer const & buffer,
|
||||
if (IsPrintable(c))
|
||||
os << c;
|
||||
else if (c == META_INSET)
|
||||
getInset(i)->ascii(buffer, os);
|
||||
getInset(i)->ascii(buffer, os, runparams);
|
||||
}
|
||||
|
||||
return os.str();
|
||||
|
@ -82,11 +82,23 @@ public:
|
||||
///
|
||||
bool isMultiLingual(BufferParams const &);
|
||||
|
||||
///
|
||||
std::string const asString(Buffer const &,
|
||||
LatexRunParams const & runparams,
|
||||
bool label) const;
|
||||
///
|
||||
std::string const asString(Buffer const &, bool label) const;
|
||||
///
|
||||
std::string const asString(Buffer const &, lyx::pos_type beg, lyx::pos_type end,
|
||||
bool label) const;
|
||||
std::string const Paragraph::asString(Buffer const & buffer,
|
||||
lyx::pos_type beg,
|
||||
lyx::pos_type end,
|
||||
bool label) const;
|
||||
///
|
||||
std::string const asString(Buffer const &,
|
||||
LatexRunParams const & runparams,
|
||||
lyx::pos_type beg,
|
||||
lyx::pos_type end,
|
||||
bool label) const;
|
||||
|
||||
///
|
||||
void write(Buffer const &, std::ostream &, BufferParams const &,
|
||||
@ -110,6 +122,7 @@ public:
|
||||
void simpleLinuxDocOnePar(Buffer const & buf,
|
||||
std::ostream & os,
|
||||
LyXFont const & outerfont,
|
||||
LatexRunParams const & runparams,
|
||||
lyx::depth_type depth) const;
|
||||
|
||||
///
|
||||
@ -117,6 +130,7 @@ public:
|
||||
std::ostream &,
|
||||
LyXFont const & outerfont,
|
||||
int & desc_on,
|
||||
LatexRunParams const & runparams,
|
||||
lyx::depth_type depth) const;
|
||||
|
||||
///
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "gettext.h"
|
||||
#include "iterators.h"
|
||||
#include "language.h"
|
||||
#include "latexrunparams.h"
|
||||
#include "lyxlex.h"
|
||||
#include "lyxrc.h"
|
||||
#include "paragraph_pimpl.h"
|
||||
@ -49,8 +50,12 @@
|
||||
|
||||
using lyx::pos_type;
|
||||
|
||||
using lyx::support::ascii_lowercase;
|
||||
using lyx::support::atoi;
|
||||
using lyx::support::bformat;
|
||||
using lyx::support::compare_ascii_no_case;
|
||||
using lyx::support::compare_no_case;
|
||||
using lyx::support::contains;
|
||||
using lyx::support::split;
|
||||
using lyx::support::subst;
|
||||
|
||||
@ -59,6 +64,7 @@ using std::string;
|
||||
using std::vector;
|
||||
using std::istringstream;
|
||||
using std::ostream;
|
||||
using std::pair;
|
||||
|
||||
extern string bibitemWidest(Buffer const &);
|
||||
|
||||
@ -794,9 +800,201 @@ void latexParagraphs(Buffer const & buf,
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
pair<int, string> const addDepth(int depth, int ldepth)
|
||||
{
|
||||
int d = depth * 2;
|
||||
if (ldepth > depth)
|
||||
d += (ldepth - depth) * 2;
|
||||
return make_pair(d, string(d, ' '));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void asciiParagraph(Buffer const & buf,
|
||||
Paragraph const & par,
|
||||
ostream & os,
|
||||
LatexRunParams const & runparams,
|
||||
bool noparbreak)
|
||||
{
|
||||
int ltype = 0;
|
||||
Paragraph::depth_type ltype_depth = 0;
|
||||
bool ref_printed = false;
|
||||
Paragraph::depth_type depth = par.params().depth();
|
||||
|
||||
// First write the layout
|
||||
string const & tmp = par.layout()->name();
|
||||
if (compare_no_case(tmp, "itemize") == 0) {
|
||||
ltype = 1;
|
||||
ltype_depth = depth + 1;
|
||||
} else if (compare_ascii_no_case(tmp, "enumerate") == 0) {
|
||||
ltype = 2;
|
||||
ltype_depth = depth + 1;
|
||||
} else if (contains(ascii_lowercase(tmp), "ection")) {
|
||||
ltype = 3;
|
||||
ltype_depth = depth + 1;
|
||||
} else if (contains(ascii_lowercase(tmp), "aragraph")) {
|
||||
ltype = 4;
|
||||
ltype_depth = depth + 1;
|
||||
} else if (compare_ascii_no_case(tmp, "description") == 0) {
|
||||
ltype = 5;
|
||||
ltype_depth = depth + 1;
|
||||
} else if (compare_ascii_no_case(tmp, "abstract") == 0) {
|
||||
ltype = 6;
|
||||
ltype_depth = 0;
|
||||
} else if (compare_ascii_no_case(tmp, "bibliography") == 0) {
|
||||
ltype = 7;
|
||||
ltype_depth = 0;
|
||||
} else {
|
||||
ltype = 0;
|
||||
ltype_depth = 0;
|
||||
}
|
||||
|
||||
/* maybe some vertical spaces */
|
||||
|
||||
/* the labelwidthstring used in lists */
|
||||
|
||||
/* some lines? */
|
||||
|
||||
/* some pagebreaks? */
|
||||
|
||||
/* noindent ? */
|
||||
|
||||
/* what about the alignment */
|
||||
|
||||
// runparams.linelen <= 0 is special and means we don't have paragraph breaks
|
||||
|
||||
string::size_type currlinelen = 0;
|
||||
|
||||
if (!noparbreak) {
|
||||
if (runparams.linelen > 0)
|
||||
os << "\n\n";
|
||||
|
||||
os << string(depth * 2, ' ');
|
||||
currlinelen += depth * 2;
|
||||
|
||||
//--
|
||||
// we should probably change to the paragraph language in the
|
||||
// gettext here (if possible) so that strings are outputted in
|
||||
// the correct language! (20012712 Jug)
|
||||
//--
|
||||
switch (ltype) {
|
||||
case 0: // Standard
|
||||
case 4: // (Sub)Paragraph
|
||||
case 5: // Description
|
||||
break;
|
||||
case 6: // Abstract
|
||||
if (runparams.linelen > 0) {
|
||||
os << _("Abstract") << "\n\n";
|
||||
currlinelen = 0;
|
||||
} else {
|
||||
string const abst = _("Abstract: ");
|
||||
os << abst;
|
||||
currlinelen += abst.length();
|
||||
}
|
||||
break;
|
||||
case 7: // Bibliography
|
||||
if (!ref_printed) {
|
||||
if (runparams.linelen > 0) {
|
||||
os << _("References") << "\n\n";
|
||||
currlinelen = 0;
|
||||
} else {
|
||||
string const refs = _("References: ");
|
||||
os << refs;
|
||||
currlinelen += refs.length();
|
||||
}
|
||||
|
||||
ref_printed = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
string const parlab = par.params().labelString();
|
||||
os << parlab << ' ';
|
||||
currlinelen += parlab.length() + 1;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!currlinelen) {
|
||||
pair<int, string> p = addDepth(depth, ltype_depth);
|
||||
os << p.second;
|
||||
currlinelen += p.first;
|
||||
}
|
||||
|
||||
// this is to change the linebreak to do it by word a bit more
|
||||
// intelligent hopefully! (only in the case where we have a
|
||||
// max runparams.linelength!) (Jug)
|
||||
|
||||
string word;
|
||||
|
||||
for (pos_type i = 0; i < par.size(); ++i) {
|
||||
char c = par.getUChar(buf.params(), i);
|
||||
switch (c) {
|
||||
case Paragraph::META_INSET:
|
||||
{
|
||||
InsetOld const * inset = par.getInset(i);
|
||||
if (inset) {
|
||||
if (runparams.linelen > 0) {
|
||||
os << word;
|
||||
currlinelen += word.length();
|
||||
word.erase();
|
||||
}
|
||||
if (inset->ascii(buf, os, runparams)) {
|
||||
// to be sure it breaks paragraph
|
||||
currlinelen += runparams.linelen;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (c == ' ') {
|
||||
if (runparams.linelen > 0 &&
|
||||
currlinelen + word.length() > runparams.linelen - 10) {
|
||||
os << "\n";
|
||||
pair<int, string> p = addDepth(depth, ltype_depth);
|
||||
os << p.second;
|
||||
currlinelen = p.first;
|
||||
}
|
||||
|
||||
os << word << ' ';
|
||||
currlinelen += word.length() + 1;
|
||||
word.erase();
|
||||
|
||||
} else {
|
||||
if (c != '\0') {
|
||||
word += c;
|
||||
} else {
|
||||
lyxerr[Debug::INFO] <<
|
||||
"writeAsciiFile: NULL char in structure." << endl;
|
||||
}
|
||||
if ((runparams.linelen > 0) &&
|
||||
(currlinelen + word.length()) > runparams.linelen)
|
||||
{
|
||||
os << "\n";
|
||||
|
||||
pair<int, string> p =
|
||||
addDepth(depth, ltype_depth);
|
||||
os << p.second;
|
||||
currlinelen = p.first;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
os << word;
|
||||
}
|
||||
|
||||
|
||||
void linuxdocParagraphs(Buffer const & buf,
|
||||
ParagraphList const & paragraphs,
|
||||
ostream & os)
|
||||
ostream & os,
|
||||
LatexRunParams const & runparams)
|
||||
{
|
||||
|
||||
Paragraph::depth_type depth = 0; // paragraph depth
|
||||
@ -899,7 +1097,8 @@ void linuxdocParagraphs(Buffer const & buf,
|
||||
break;
|
||||
}
|
||||
|
||||
pit->simpleLinuxDocOnePar(buf, os, outerFont(pit, paragraphs), depth);
|
||||
pit->simpleLinuxDocOnePar(buf, os, outerFont(pit, paragraphs),
|
||||
runparams, depth);
|
||||
|
||||
os << "\n";
|
||||
// write closing SGML tags
|
||||
@ -926,7 +1125,8 @@ void linuxdocParagraphs(Buffer const & buf,
|
||||
|
||||
void docbookParagraphs(Buffer const & buf,
|
||||
ParagraphList const & paragraphs,
|
||||
ostream & os)
|
||||
ostream & os,
|
||||
LatexRunParams const & runparams)
|
||||
{
|
||||
vector<string> environment_stack(10);
|
||||
vector<string> environment_inner(10);
|
||||
@ -1085,7 +1285,7 @@ void docbookParagraphs(Buffer const & buf,
|
||||
}
|
||||
|
||||
par->simpleDocBookOnePar(buf, os, outerFont(par, paragraphs), desc_on,
|
||||
depth + 1 + command_depth);
|
||||
runparams, depth + 1 + command_depth);
|
||||
|
||||
string end_tag;
|
||||
// write closing SGML tags
|
||||
|
@ -73,13 +73,22 @@ void latexParagraphs(Buffer const & buf,
|
||||
LatexRunParams const &,
|
||||
std::string const & everypar = std::string());
|
||||
|
||||
///
|
||||
void asciiParagraph(Buffer const & buf,
|
||||
Paragraph const & paragraphs,
|
||||
std::ostream & ofs,
|
||||
LatexRunParams const &,
|
||||
bool noparbreak = false);
|
||||
|
||||
void linuxdocParagraphs(Buffer const & buf,
|
||||
ParagraphList const & paragraphs,
|
||||
std::ostream & os);
|
||||
ParagraphList const & paragraphs,
|
||||
std::ostream & os,
|
||||
LatexRunParams const & runparams);
|
||||
|
||||
void docbookParagraphs(Buffer const & buf,
|
||||
ParagraphList const & paragraphs,
|
||||
std::ostream & os);
|
||||
std::ostream & os,
|
||||
LatexRunParams const & runparams);
|
||||
|
||||
/// read a paragraph from a .lyx file. Returns number of unrecognised tokens
|
||||
int readParagraph(Buffer & buf, Paragraph & par, LyXLex & lex);
|
||||
|
@ -472,7 +472,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
|
||||
os << c;
|
||||
} else {
|
||||
InsetOld const * inset = owner_->getInset(i);
|
||||
inset->ascii(buf, os, 0);
|
||||
inset->ascii(buf, os, runparams);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "bufferparams.h"
|
||||
#include "debug.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "latexrunparams.h"
|
||||
#include "lyxlex.h"
|
||||
#include "paragraph.h"
|
||||
|
||||
@ -2148,7 +2149,8 @@ int LyXTabular::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int LyXTabular::linuxdoc(Buffer const & buf, ostream & os) const
|
||||
int LyXTabular::linuxdoc(Buffer const & buf, ostream & os,
|
||||
const LatexRunParams & runparams) const
|
||||
{
|
||||
os << "<tabular ca=\"";
|
||||
for (int i = 0; i < columns_; ++i) {
|
||||
@ -2173,7 +2175,7 @@ int LyXTabular::linuxdoc(Buffer const & buf, ostream & os) const
|
||||
continue;
|
||||
InsetText & inset = getCellInset(cell);
|
||||
|
||||
ret += inset.linuxdoc(buf, os);
|
||||
ret += inset.linuxdoc(buf, os, runparams);
|
||||
|
||||
if (isLastCellInRow(cell)) {
|
||||
os << "@\n";
|
||||
@ -2189,7 +2191,8 @@ int LyXTabular::linuxdoc(Buffer const & buf, ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
int LyXTabular::docbookRow(Buffer const & buf, ostream & os, int row) const
|
||||
int LyXTabular::docbookRow(Buffer const & buf, ostream & os, int row,
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
int ret = 0;
|
||||
int cell = getFirstCellInRow(row);
|
||||
@ -2231,7 +2234,9 @@ int LyXTabular::docbookRow(Buffer const & buf, ostream & os, int row) const
|
||||
}
|
||||
|
||||
os << '>';
|
||||
ret += getCellInset(cell).docbook(buf, os, true);
|
||||
LatexRunParams runp = runparams;
|
||||
runp.mixed_content = true;
|
||||
ret += getCellInset(cell).docbook(buf, os, runp);
|
||||
os << "</entry>\n";
|
||||
++cell;
|
||||
}
|
||||
@ -2241,7 +2246,7 @@ int LyXTabular::docbookRow(Buffer const & buf, ostream & os, int row) const
|
||||
|
||||
|
||||
int LyXTabular::docbook(Buffer const & buf, ostream & os,
|
||||
bool /*mixcont*/) const
|
||||
LatexRunParams const & runparams) const
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
@ -2279,7 +2284,7 @@ int LyXTabular::docbook(Buffer const & buf, ostream & os,
|
||||
++ret;
|
||||
for (int i = 0; i < rows_; ++i) {
|
||||
if (row_info[i].endhead || row_info[i].endfirsthead) {
|
||||
ret += docbookRow(buf, os, i);
|
||||
ret += docbookRow(buf, os, i, runparams);
|
||||
}
|
||||
}
|
||||
os << "</thead>\n";
|
||||
@ -2291,7 +2296,7 @@ int LyXTabular::docbook(Buffer const & buf, ostream & os,
|
||||
++ret;
|
||||
for (int i = 0; i < rows_; ++i) {
|
||||
if (row_info[i].endfoot || row_info[i].endlastfoot) {
|
||||
ret += docbookRow(buf, os, i);
|
||||
ret += docbookRow(buf, os, i, runparams);
|
||||
}
|
||||
}
|
||||
os << "</tfoot>\n";
|
||||
@ -2306,7 +2311,7 @@ int LyXTabular::docbook(Buffer const & buf, ostream & os,
|
||||
++ret;
|
||||
for (int i = 0; i < rows_; ++i) {
|
||||
if (isValidRow(i)) {
|
||||
ret += docbookRow(buf, os, i);
|
||||
ret += docbookRow(buf, os, i, runparams);
|
||||
}
|
||||
}
|
||||
os << "</tbody>\n";
|
||||
@ -2417,12 +2422,13 @@ int LyXTabular::asciiBottomHLine(ostream & os, int row,
|
||||
|
||||
|
||||
int LyXTabular::asciiPrintCell(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams,
|
||||
int cell, int row, int column,
|
||||
vector<unsigned int> const & clen,
|
||||
bool onlydata) const
|
||||
{
|
||||
ostringstream sstr;
|
||||
int ret = getCellInset(cell).ascii(buf, sstr, 0);
|
||||
int ret = getCellInset(cell).ascii(buf, sstr, runparams);
|
||||
|
||||
if (onlydata) {
|
||||
os << sstr.str();
|
||||
@ -2466,8 +2472,10 @@ int LyXTabular::asciiPrintCell(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int LyXTabular::ascii(Buffer const & buf, ostream & os, int const depth,
|
||||
bool onlydata, unsigned char delim) const
|
||||
int LyXTabular::ascii(Buffer const & buf, ostream & os,
|
||||
LatexRunParams const & runparams,
|
||||
int const depth,
|
||||
bool onlydata, unsigned char delim) const
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
@ -2483,7 +2491,7 @@ int LyXTabular::ascii(Buffer const & buf, ostream & os, int const depth,
|
||||
if (isMultiColumnReal(cell))
|
||||
continue;
|
||||
ostringstream sstr;
|
||||
getCellInset(cell).ascii(buf, sstr, 0);
|
||||
getCellInset(cell).ascii(buf, sstr, runparams);
|
||||
if (clen[j] < sstr.str().length())
|
||||
clen[j] = sstr.str().length();
|
||||
}
|
||||
@ -2495,7 +2503,7 @@ int LyXTabular::ascii(Buffer const & buf, ostream & os, int const depth,
|
||||
if (!isMultiColumnReal(cell) || isPartOfMultiColumn(i, j))
|
||||
continue;
|
||||
ostringstream sstr;
|
||||
getCellInset(cell).ascii(buf, sstr, 0);
|
||||
getCellInset(cell).ascii(buf, sstr, runparams);
|
||||
int len = int(sstr.str().length());
|
||||
int const n = cells_in_multicolumn(cell);
|
||||
for (int k = j; len > 0 && k < j + n - 1; ++k)
|
||||
@ -2515,7 +2523,8 @@ int LyXTabular::ascii(Buffer const & buf, ostream & os, int const depth,
|
||||
continue;
|
||||
if (onlydata && j > 0)
|
||||
os << delim;
|
||||
ret += asciiPrintCell(buf, os, cell, i, j, clen, onlydata);
|
||||
ret += asciiPrintCell(buf, os, runparams,
|
||||
cell, i, j, clen, onlydata);
|
||||
++cell;
|
||||
}
|
||||
os << endl;
|
||||
|
@ -279,11 +279,15 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
//
|
||||
int linuxdoc(Buffer const & buf, std::ostream & os) const;
|
||||
int linuxdoc(Buffer const & buf, std::ostream & os,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const & buf, std::ostream & os, bool mixcont) const;
|
||||
int docbook(Buffer const & buf, std::ostream & os,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
int ascii(Buffer const &, std::ostream &, int const depth,
|
||||
int ascii(Buffer const &, std::ostream &,
|
||||
LatexRunParams const & runparams,
|
||||
int const depth,
|
||||
bool onlydata, unsigned char delim) const;
|
||||
///
|
||||
bool isMultiColumn(int cell) const;
|
||||
@ -549,11 +553,13 @@ public:
|
||||
std::vector<unsigned int> const &) const;
|
||||
///
|
||||
int asciiPrintCell(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &,
|
||||
int cell, int row, int column,
|
||||
std::vector<unsigned int> const &,
|
||||
bool onlydata) const;
|
||||
/// auxiliary function for docbook
|
||||
int docbookRow(Buffer const & buf, std::ostream & os, int row) const;
|
||||
int docbookRow(Buffer const & buf, std::ostream & os, int,
|
||||
LatexRunParams const &) const;
|
||||
|
||||
private:
|
||||
/// renumber cells after structural changes
|
||||
|
Loading…
Reference in New Issue
Block a user