mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 14:15:32 +00:00
Output docbook as utf8. Probably quite a bit more work needed, but then help form a docbook person is needed.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15387 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8d22fdec50
commit
0d449056ef
@ -1113,7 +1113,7 @@ bool BufferView::workAreaDispatch(FuncRequest const & cmd0)
|
||||
}
|
||||
|
||||
|
||||
void BufferView::scroll(int lines)
|
||||
void BufferView::scroll(int /*lines*/)
|
||||
{
|
||||
// if (!buffer_)
|
||||
// return;
|
||||
|
39
src/buffer.C
39
src/buffer.C
@ -67,16 +67,15 @@
|
||||
#include "support/lyxalgo.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/fs_extras.h"
|
||||
#include <boost/iostreams/filtering_stream.hpp>
|
||||
#include <boost/iostreams/filter/gzip.hpp>
|
||||
#include <boost/iostreams/device/file.hpp>
|
||||
namespace io = boost::iostreams;
|
||||
#include "support/lyxlib.h"
|
||||
#include "support/os.h"
|
||||
#include "support/path.h"
|
||||
#include "support/textutils.h"
|
||||
#include "support/convert.h"
|
||||
|
||||
#include <boost/iostreams/filtering_stream.hpp>
|
||||
#include <boost/iostreams/filter/gzip.hpp>
|
||||
#include <boost/iostreams/device/file.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/filesystem/exception.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
@ -94,6 +93,7 @@ namespace io = boost::iostreams;
|
||||
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::odocfstream;
|
||||
using lyx::odocstream;
|
||||
using lyx::pos_type;
|
||||
using lyx::pit_type;
|
||||
@ -126,6 +126,7 @@ using lyx::support::trim;
|
||||
namespace Alert = lyx::frontend::Alert;
|
||||
namespace os = lyx::support::os;
|
||||
namespace fs = boost::filesystem;
|
||||
namespace io = boost::iostreams;
|
||||
|
||||
using std::endl;
|
||||
using std::for_each;
|
||||
@ -991,7 +992,8 @@ void Buffer::makeDocBookFile(string const & fname,
|
||||
{
|
||||
lyxerr[Debug::LATEX] << "makeDocBookFile..." << endl;
|
||||
|
||||
ofstream ofs;
|
||||
//ofstream ofs;
|
||||
odocfstream ofs;
|
||||
if (!openFileWrite(ofs, fname))
|
||||
return;
|
||||
|
||||
@ -1003,7 +1005,7 @@ void Buffer::makeDocBookFile(string const & fname,
|
||||
}
|
||||
|
||||
|
||||
void Buffer::writeDocBookSource(ostream & os, string const & fname,
|
||||
void Buffer::writeDocBookSource(odocstream & os, string const & fname,
|
||||
OutputParams const & runparams,
|
||||
bool const only_body)
|
||||
{
|
||||
@ -1013,16 +1015,18 @@ void Buffer::writeDocBookSource(ostream & os, string const & fname,
|
||||
texrow().reset();
|
||||
|
||||
LyXTextClass const & tclass = params().getLyXTextClass();
|
||||
string const & top_element = tclass.latexname();
|
||||
string const top_element = tclass.latexname();
|
||||
|
||||
if (!only_body) {
|
||||
if (runparams.flavor == OutputParams::XML)
|
||||
os << "<?xml version=\"1.0\" encoding=\""
|
||||
<< params().language->encoding()->name() << "\"?>\n";
|
||||
os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
||||
|
||||
os << "<!DOCTYPE " << top_element << " ";
|
||||
// FIXME UNICODE
|
||||
os << "<!DOCTYPE " << lyx::from_ascii(top_element) << ' ';
|
||||
|
||||
if (! tclass.class_header().empty()) os << tclass.class_header();
|
||||
// FIXME UNICODE
|
||||
if (! tclass.class_header().empty())
|
||||
os << lyx::from_ascii(tclass.class_header());
|
||||
else if (runparams.flavor == OutputParams::XML)
|
||||
os << "PUBLIC \"-//OASIS//DTD DocBook XML//EN\" "
|
||||
<< "\"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\"";
|
||||
@ -1043,7 +1047,7 @@ void Buffer::writeDocBookSource(ostream & os, string const & fname,
|
||||
preamble += features.getLyXSGMLEntities();
|
||||
|
||||
if (!preamble.empty()) {
|
||||
os << "\n [ " << preamble << " ]";
|
||||
os << "\n [ " << lyx::from_ascii(preamble) << " ]";
|
||||
}
|
||||
os << ">\n\n";
|
||||
}
|
||||
@ -1608,15 +1612,13 @@ void Buffer::getSourceCode(odocstream & os, lyx::pit_type par_begin, lyx::pit_ty
|
||||
// No side effect of file copying and image conversion
|
||||
runparams.dryrun = true;
|
||||
|
||||
/* Support for docbook temprarily commented out. */
|
||||
if (full_source) {
|
||||
os << "% Preview source code\n\n";
|
||||
if (isLatex())
|
||||
writeLaTeXSource(os, filePath(), runparams, true, true);
|
||||
else {
|
||||
// FIXME UNICODE
|
||||
ostringstream oss;
|
||||
writeDocBookSource(oss, fileName(), runparams, false);
|
||||
os << lyx::from_utf8(oss.str());
|
||||
writeDocBookSource(os, fileName(), runparams, false);
|
||||
}
|
||||
} else {
|
||||
runparams.par_begin = par_begin;
|
||||
@ -1631,10 +1633,7 @@ void Buffer::getSourceCode(odocstream & os, lyx::pit_type par_begin, lyx::pit_ty
|
||||
latexParagraphs(*this, paragraphs(), os, texrow(), runparams);
|
||||
} else {
|
||||
// DocBook
|
||||
// FIXME UNICODE
|
||||
ostringstream oss;
|
||||
docbookParagraphs(paragraphs(), *this, oss, runparams);
|
||||
os << lyx::from_utf8(oss.str());
|
||||
docbookParagraphs(paragraphs(), *this, os, runparams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "support/limited_stack.h"
|
||||
#include "support/types.h"
|
||||
#include "support/docstring.h"
|
||||
#include "support/docstream.h"
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/signal.hpp>
|
||||
@ -156,7 +157,7 @@ public:
|
||||
OutputParams const & runparams_in,
|
||||
bool only_body = false);
|
||||
///
|
||||
void writeDocBookSource(std::ostream & os, std::string const & filename,
|
||||
void writeDocBookSource(lyx::odocstream & os, std::string const & filename,
|
||||
OutputParams const & runparams_in,
|
||||
bool only_body = false);
|
||||
/// returns the main language for the buffer (document)
|
||||
|
@ -75,7 +75,7 @@ LyXView & Application::createView(unsigned int width,
|
||||
}
|
||||
|
||||
|
||||
int Application::start(std::string const & batch)
|
||||
int Application::start(std::string const & /*batch*/)
|
||||
{
|
||||
return exec();
|
||||
}
|
||||
|
@ -32,10 +32,10 @@ public:
|
||||
virtual void update() {};
|
||||
|
||||
/// Is the given font available ?
|
||||
virtual bool available(LyXFont const & f) { return false; };
|
||||
virtual bool available(LyXFont const &) { return false; };
|
||||
|
||||
/// Get the Font metrics for this LyXFont
|
||||
virtual FontMetrics const & metrics(LyXFont const & f) { return metrics_; }
|
||||
virtual FontMetrics const & metrics(LyXFont const &) { return metrics_; }
|
||||
|
||||
private:
|
||||
///
|
||||
|
@ -31,15 +31,15 @@ public:
|
||||
|
||||
virtual int maxDescent() const { return 1; }
|
||||
|
||||
virtual int ascent(lyx::char_type c) const { return 1; }
|
||||
virtual int ascent(lyx::char_type) const { return 1; }
|
||||
|
||||
int descent(lyx::char_type c) const { return 1; }
|
||||
int descent(lyx::char_type) const { return 1; }
|
||||
|
||||
virtual int lbearing(lyx::char_type c) const { return 1; }
|
||||
virtual int lbearing(lyx::char_type) const { return 1; }
|
||||
|
||||
virtual int rbearing(lyx::char_type c) const { return 1; }
|
||||
virtual int rbearing(lyx::char_type) const { return 1; }
|
||||
|
||||
virtual int width(lyx::char_type const * s, size_t n) const { return n; }
|
||||
virtual int width(lyx::char_type const *, size_t n) const { return n; }
|
||||
|
||||
virtual int signedWidth(lyx::docstring const & s) const
|
||||
{
|
||||
@ -49,12 +49,12 @@ public:
|
||||
return FontMetrics::width(s);
|
||||
}
|
||||
|
||||
virtual void rectText(lyx::docstring const & str,
|
||||
virtual void rectText(lyx::docstring const &,
|
||||
int & width,
|
||||
int & ascent,
|
||||
int & descent) const {};
|
||||
|
||||
virtual void buttonText(lyx::docstring const & str,
|
||||
virtual void buttonText(lyx::docstring const &,
|
||||
int & width,
|
||||
int & ascent,
|
||||
int & descent) const {};
|
||||
|
@ -138,10 +138,10 @@ void GView::init()
|
||||
}
|
||||
|
||||
|
||||
void GView::setGeometry(unsigned int width,
|
||||
unsigned int height,
|
||||
int posx, int posy,
|
||||
bool maximize)
|
||||
void GView::setGeometry(unsigned int /*width*/,
|
||||
unsigned int /*height*/,
|
||||
int /*posx*/, int /*posy*/,
|
||||
bool /*maximize*/)
|
||||
{
|
||||
// FIXME: do something here...
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ int InsetBase::plaintext(Buffer const &,
|
||||
|
||||
|
||||
int InsetBase::docbook(Buffer const &,
|
||||
std::ostream &, OutputParams const &) const
|
||||
lyx::odocstream &, OutputParams const &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -272,7 +272,7 @@ void InsetBase::markErased(bool)
|
||||
{}
|
||||
|
||||
|
||||
void InsetBase::cursorPos(BufferView const & bv, CursorSlice const &,
|
||||
void InsetBase::cursorPos(BufferView const & /*bv*/, CursorSlice const &,
|
||||
bool, int & x, int & y) const
|
||||
{
|
||||
lyxerr << "InsetBase::cursorPos called directly" << std::endl;
|
||||
|
@ -189,7 +189,7 @@ public:
|
||||
virtual int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
/// docbook output
|
||||
virtual int docbook(Buffer const &, std::ostream & os,
|
||||
virtual int docbook(Buffer const &, lyx::odocstream & os,
|
||||
OutputParams const &) const;
|
||||
/// the string that is passed to the TOC
|
||||
virtual int textString(Buffer const &, lyx::odocstream &,
|
||||
|
@ -383,7 +383,7 @@ int InsetBox::latex(Buffer const & buf, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetBox::docbook(Buffer const & buf, std::ostream & os,
|
||||
int InsetBox::docbook(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
return InsetText::docbook(buf, os, runparams);
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
int latex(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
|
@ -229,7 +229,7 @@ int InsetBranch::latex(Buffer const & buf, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetBranch::docbook(Buffer const & buf, std::ostream & os,
|
||||
int InsetBranch::docbook(Buffer const & buf, odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
return isBranchSelected(buf) ?
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
int latex(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const & runparams) const;
|
||||
///
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
|
@ -199,7 +199,7 @@ int InsetCaption::plaintext(Buffer const & /*buf*/, odocstream & /*os*/,
|
||||
}
|
||||
|
||||
|
||||
int InsetCaption::docbook(Buffer const & buf, ostream & os,
|
||||
int InsetCaption::docbook(Buffer const & buf, odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
int ret;
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
int plaintext(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & runparams) const;
|
||||
///
|
||||
int docbook(Buffer const & buf, std::ostream & os,
|
||||
int docbook(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & runparams) const;
|
||||
///
|
||||
void setCount(int c) { counter_ = c; }
|
||||
|
@ -300,7 +300,7 @@ int InsetCharStyle::latex(Buffer const & buf, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetCharStyle::docbook(Buffer const & buf, ostream & os,
|
||||
int InsetCharStyle::docbook(Buffer const & buf, odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
ParagraphList::const_iterator beg = paragraphs().begin();
|
||||
@ -308,8 +308,9 @@ int InsetCharStyle::docbook(Buffer const & buf, ostream & os,
|
||||
ParagraphList::const_iterator end = paragraphs().end();
|
||||
|
||||
if (!undefined())
|
||||
sgml::openTag(os, params_.latexname,
|
||||
par->getID(buf, runparams) + params_.latexparam);
|
||||
// FIXME UNICODE
|
||||
sgml::openTag(os, params_.latexname,
|
||||
par->getID(buf, runparams) + params_.latexparam);
|
||||
|
||||
for (; par != end; ++par) {
|
||||
par->simpleDocBookOnePar(buf, os, runparams,
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
int latex(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
|
@ -392,9 +392,12 @@ string const cleanupWhitespace(string const & citelist)
|
||||
// end anon namyspace
|
||||
}
|
||||
|
||||
int InsetCitation::docbook(Buffer const &, ostream & os, OutputParams const &) const
|
||||
int InsetCitation::docbook(Buffer const &, odocstream & os, OutputParams const &) const
|
||||
{
|
||||
os << "<citation>" << cleanupWhitespace(getContents()) << "</citation>";
|
||||
// FIXME UNICODE
|
||||
os << "<citation>"
|
||||
<< lyx::from_ascii(cleanupWhitespace(getContents()))
|
||||
<< "</citation>";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
int latex(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
/// the string that is passed to the TOC
|
||||
virtual int textString(Buffer const &, lyx::odocstream &,
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using lyx::odocstream;
|
||||
|
||||
using lyx::odocstream;
|
||||
|
||||
@ -87,7 +88,7 @@ int InsetCommand::plaintext(Buffer const &, odocstream &,
|
||||
}
|
||||
|
||||
|
||||
int InsetCommand::docbook(Buffer const &, ostream &,
|
||||
int InsetCommand::docbook(Buffer const &, odocstream &,
|
||||
OutputParams const &) const
|
||||
{
|
||||
return 0;
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
virtual int docbook(Buffer const &, std::ostream &,
|
||||
virtual int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const & runparams) const;
|
||||
///
|
||||
InsetBase::Code lyxCode() const { return InsetBase::NO_CODE; }
|
||||
|
@ -178,7 +178,7 @@ int InsetERT::plaintext(Buffer const &, odocstream &,
|
||||
}
|
||||
|
||||
|
||||
int InsetERT::docbook(Buffer const &, ostream & os,
|
||||
int InsetERT::docbook(Buffer const &, odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
ParagraphList::const_iterator par = paragraphs().begin();
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const & runparams) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const & runparams) const;
|
||||
///
|
||||
void validate(LaTeXFeatures &) const {}
|
||||
|
@ -706,17 +706,21 @@ int InsetExternal::latex(Buffer const & buf, odocstream & os,
|
||||
|
||||
external::Template::Formats::const_iterator cit =
|
||||
et.formats.find("PDFLaTeX");
|
||||
if (cit != et.formats.end())
|
||||
|
||||
if (cit != et.formats.end()) {
|
||||
return external::writeExternal(params_, "PDFLaTeX",
|
||||
buf, os,
|
||||
*(runparams.exportdata),
|
||||
external_in_tmpdir,
|
||||
runparams.inComment);
|
||||
buf, os,
|
||||
*(runparams.exportdata),
|
||||
external_in_tmpdir,
|
||||
runparams.inComment);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return external::writeExternal(params_, "LaTeX", buf, os,
|
||||
*(runparams.exportdata),
|
||||
external_in_tmpdir,
|
||||
runparams.inComment);
|
||||
*(runparams.exportdata),
|
||||
external_in_tmpdir,
|
||||
runparams.inComment);
|
||||
}
|
||||
|
||||
|
||||
@ -729,16 +733,12 @@ int InsetExternal::plaintext(Buffer const & buf, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetExternal::docbook(Buffer const & buf, ostream & os,
|
||||
int InsetExternal::docbook(Buffer const & buf, odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
lyx::odocstringstream oss;
|
||||
int const retval = external::writeExternal(params_, "DocBook", buf, oss,
|
||||
return external::writeExternal(params_, "DocBook", buf, os,
|
||||
*(runparams.exportdata), false,
|
||||
runparams.inComment);
|
||||
// FIXME UNICODE
|
||||
os << lyx::to_utf8(oss.str());
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
@ -129,7 +129,7 @@ public:
|
||||
virtual int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
virtual int docbook(Buffer const &, std::ostream &,
|
||||
virtual int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
/// Update needed features for this inset.
|
||||
|
@ -329,12 +329,13 @@ int InsetFloat::latex(Buffer const & buf, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetFloat::docbook(Buffer const & buf, ostream & os,
|
||||
int InsetFloat::docbook(Buffer const & buf, odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
os << '<' << params_.type << '>';
|
||||
// FIXME UNICODE
|
||||
os << '<' << lyx::from_ascii(params_.type) << '>';
|
||||
int const i = InsetText::docbook(buf, os, runparams);
|
||||
os << "</" << params_.type << '>';
|
||||
os << "</" << lyx::from_ascii(params_.type) << '>';
|
||||
|
||||
return i;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
int latex(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
virtual lyx::docstring const editMessage() const;
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
int latex(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const { return 0; }
|
||||
///
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
|
@ -80,7 +80,7 @@ int InsetFoot::latex(Buffer const & buf, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetFoot::docbook(Buffer const & buf, ostream & os,
|
||||
int InsetFoot::docbook(Buffer const & buf, odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
os << "<footnote>";
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
int latex(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const & runparams) const;
|
||||
///
|
||||
virtual lyx::docstring const editMessage() const;
|
||||
|
@ -91,6 +91,8 @@ using lyx::odocstream;
|
||||
|
||||
namespace support = lyx::support;
|
||||
|
||||
using lyx::odocstream;
|
||||
|
||||
using lyx::support::absolutePath;
|
||||
using lyx::support::bformat;
|
||||
using lyx::support::changeExtension;
|
||||
@ -826,14 +828,22 @@ int InsetGraphics::plaintext(Buffer const &, odocstream & os,
|
||||
|
||||
namespace {
|
||||
|
||||
int writeImageObject(char * format, ostream& os, OutputParams const & runparams,
|
||||
string const graphic_label, string const attributes)
|
||||
int writeImageObject(char * format, odocstream & os, OutputParams const & runparams,
|
||||
string const graphic_label, string const attributes)
|
||||
{
|
||||
if (runparams.flavor != OutputParams::XML) {
|
||||
os << "<![ %output.print." << format << "; [" << std::endl;
|
||||
os << "<![ %output.print."
|
||||
<< format
|
||||
<< "; ["
|
||||
<< std::endl;
|
||||
}
|
||||
// FIXME UNICODE
|
||||
os <<"<imageobject><imagedata fileref=\"&"
|
||||
<< graphic_label << ";." << format << "\" " << attributes ;
|
||||
<< lyx::from_ascii(graphic_label)
|
||||
<< ";."
|
||||
<< format
|
||||
<< "\" "
|
||||
<< lyx::from_ascii(attributes);
|
||||
if (runparams.flavor == OutputParams::XML) {
|
||||
os << " role=\"" << format << "\"/>" ;
|
||||
}
|
||||
@ -853,7 +863,7 @@ int writeImageObject(char * format, ostream& os, OutputParams const & runparams,
|
||||
// For explanation on inserting graphics into DocBook checkout:
|
||||
// http://en.tldp.org/LDP/LDP-Author-Guide/html/inserting-pictures.html
|
||||
// See also the docbook guide at http://www.docbook.org/
|
||||
int InsetGraphics::docbook(Buffer const &, ostream & os,
|
||||
int InsetGraphics::docbook(Buffer const &, odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
// In DocBook v5.0, the graphic tag will be eliminated from DocBook, will
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
/** Tell LyX what the latex features you need i.e. what latex packages
|
||||
|
@ -62,7 +62,7 @@ int InsetHFill::plaintext(Buffer const &, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetHFill::docbook(Buffer const &, std::ostream & os,
|
||||
int InsetHFill::docbook(Buffer const &, odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << '\n';
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const & runparams) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const & runparams) const;
|
||||
///
|
||||
void write(Buffer const & buf, std::ostream & os) const;
|
||||
|
@ -488,7 +488,7 @@ int InsetInclude::plaintext(Buffer const & buffer, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetInclude::docbook(Buffer const & buffer, ostream & os,
|
||||
int InsetInclude::docbook(Buffer const & buffer, odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
string incfile(params_.getContents());
|
||||
@ -524,12 +524,13 @@ int InsetInclude::docbook(Buffer const & buffer, ostream & os,
|
||||
runparams.exportdata->addExternalFile("docbook-xml", writefile,
|
||||
exportfile);
|
||||
|
||||
// FIXME UNICODE
|
||||
if (isVerbatim(params_)) {
|
||||
os << "<inlinegraphic fileref=\""
|
||||
<< '&' << include_label << ';'
|
||||
<< '&' << lyx::from_ascii(include_label) << ';'
|
||||
<< "\" format=\"linespecific\">";
|
||||
} else
|
||||
os << '&' << include_label << ';';
|
||||
os << '&' << lyx::from_ascii(include_label) << ';';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "support/std_ostream.h"
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::odocstream;
|
||||
|
||||
using std::string;
|
||||
using std::ostream;
|
||||
@ -42,10 +43,12 @@ docstring const InsetIndex::getScreenLabel(Buffer const &) const
|
||||
}
|
||||
|
||||
|
||||
int InsetIndex::docbook(Buffer const &, ostream & os,
|
||||
int InsetIndex::docbook(Buffer const &, odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << "<indexterm><primary>" << sgml::escapeString(getContents())
|
||||
// FIXME UNICODE
|
||||
os << "<indexterm><primary>"
|
||||
<< lyx::from_ascii(sgml::escapeString(getContents()))
|
||||
<< "</primary></indexterm>";
|
||||
return 0;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
///
|
||||
InsetBase::Code lyxCode() const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
private:
|
||||
virtual std::auto_ptr<InsetBase> doClone() const {
|
||||
|
@ -102,9 +102,12 @@ int InsetLabel::plaintext(Buffer const &, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetLabel::docbook(Buffer const & buf, ostream & os,
|
||||
int InsetLabel::docbook(Buffer const & buf, odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
os << "<!-- anchor id=\"" << sgml::cleanID(buf, runparams, getContents()) << "\" -->";
|
||||
// FIXME UNICODE
|
||||
os << "<!-- anchor id=\""
|
||||
<< lyx::from_ascii(sgml::cleanID(buf, runparams, getContents()))
|
||||
<< "\" -->";
|
||||
return 0;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
protected:
|
||||
virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
|
||||
|
@ -588,10 +588,11 @@ int InsetLatexAccent::plaintext(Buffer const &, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetLatexAccent::docbook(Buffer const &, ostream & os,
|
||||
int InsetLatexAccent::docbook(Buffer const &, odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << contents;
|
||||
// FIXME UNICODE
|
||||
os << lyx::from_ascii(contents);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
/// the string that is passed to the TOC
|
||||
virtual int textString(Buffer const &, lyx::odocstream &,
|
||||
|
@ -73,7 +73,7 @@ int InsetLine::plaintext(Buffer const &, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetLine::docbook(Buffer const &, std::ostream & os,
|
||||
int InsetLine::docbook(Buffer const &, odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << '\n';
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
void read(Buffer const &, LyXLex & lex);
|
||||
|
@ -63,7 +63,7 @@ int InsetMarginal::latex(Buffer const & buf, odocstream & os,
|
||||
return i + 2;
|
||||
}
|
||||
|
||||
int InsetMarginal::docbook(Buffer const & buf, ostream & os,
|
||||
int InsetMarginal::docbook(Buffer const & buf, odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
os << "<note role=\"margin\">";
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
int latex(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const & runparams) const;
|
||||
///
|
||||
virtual lyx::docstring const editMessage() const;
|
||||
|
@ -67,7 +67,7 @@ int InsetNewline::plaintext(Buffer const &, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetNewline::docbook(Buffer const &, std::ostream & os,
|
||||
int InsetNewline::docbook(Buffer const &, odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << '\n';
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
virtual int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
virtual int docbook(Buffer const &, std::ostream &,
|
||||
virtual int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
virtual void read(Buffer const &, LyXLex & lex);
|
||||
|
@ -296,30 +296,28 @@ int InsetNote::latex(Buffer const & buf, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetNote::docbook(Buffer const & buf, std::ostream & os,
|
||||
int InsetNote::docbook(Buffer const & buf, odocstream & os,
|
||||
OutputParams const & runparams_in) const
|
||||
{
|
||||
if (params_.type == InsetNoteParams::Note)
|
||||
return 0;
|
||||
|
||||
OutputParams runparams(runparams_in);
|
||||
ostringstream ss;
|
||||
if (params_.type == InsetNoteParams::Comment) {
|
||||
ss << "<remark>\n";
|
||||
os << "<remark>\n";
|
||||
runparams.inComment = true;
|
||||
// Ignore files that are exported inside a comment
|
||||
runparams.exportdata.reset(new ExportData);
|
||||
}
|
||||
|
||||
InsetText::docbook(buf, ss, runparams);
|
||||
int const n = InsetText::docbook(buf, os, runparams);
|
||||
|
||||
if (params_.type == InsetNoteParams::Comment)
|
||||
ss << "\n</remark>\n";
|
||||
os << "\n</remark>\n";
|
||||
|
||||
string const str = ss.str();
|
||||
os << str;
|
||||
// Return how many newlines we issued.
|
||||
return int(lyx::count(str.begin(), str.end(),'\n'));
|
||||
//return int(lyx::count(str.begin(), str.end(), '\n'));
|
||||
return n + 1 + 2;
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
int latex(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
|
@ -73,7 +73,7 @@ int InsetOptArg::latex(Buffer const &, odocstream &,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int InsetOptArg::docbook(Buffer const &, ostream &,
|
||||
int InsetOptArg::docbook(Buffer const &, odocstream &,
|
||||
OutputParams const &) const
|
||||
{
|
||||
return 0;
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
int latex(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
/// Standard DocBook output -- short-circuited
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
/// Standard plain text output -- short-circuited
|
||||
|
@ -92,7 +92,7 @@ int InsetPagebreak::plaintext(Buffer const &, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetPagebreak::docbook(Buffer const &, std::ostream & os,
|
||||
int InsetPagebreak::docbook(Buffer const &, odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << '\n';
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
void read(Buffer const &, LyXLex & lex);
|
||||
|
@ -310,7 +310,7 @@ int InsetQuotes::plaintext(Buffer const &, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetQuotes::docbook(Buffer const &, ostream & os,
|
||||
int InsetQuotes::docbook(Buffer const &, odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
if (times_ == DoubleQ) {
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
/// the string that is passed to the TOC
|
||||
|
@ -105,16 +105,24 @@ int InsetRef::plaintext(Buffer const &, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetRef::docbook(Buffer const & buf, ostream & os,
|
||||
int InsetRef::docbook(Buffer const & buf, odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
// FIXME UNICODE
|
||||
if (getOptions().empty() && runparams.flavor == OutputParams::XML) {
|
||||
os << "<xref linkend=\"" << sgml::cleanID(buf, runparams, getContents()) << "\" />";
|
||||
os << "<xref linkend=\""
|
||||
<< lyx::from_ascii(sgml::cleanID(buf, runparams, getContents()))
|
||||
<< "\" />";
|
||||
} else if (getOptions().empty()) {
|
||||
os << "<xref linkend=\"" << sgml::cleanID(buf, runparams, getContents()) << "\">";
|
||||
os << "<xref linkend=\""
|
||||
<< lyx::from_ascii(sgml::cleanID(buf, runparams, getContents()))
|
||||
<< "\">";
|
||||
} else {
|
||||
os << "<link linkend=\"" << sgml::cleanID(buf, runparams, getContents())
|
||||
<< "\">" << getOptions() << "</link>";
|
||||
os << "<link linkend=\""
|
||||
<< lyx::from_ascii(sgml::cleanID(buf, runparams, getContents()))
|
||||
<< "\">"
|
||||
<< lyx::from_ascii(getOptions())
|
||||
<< "</link>";
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
/// the string that is passed to the TOC
|
||||
virtual int textString(Buffer const &, lyx::odocstream &,
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "frontends/FontMetrics.h"
|
||||
#include "frontends/Painter.h"
|
||||
|
||||
using lyx::odocstream;
|
||||
|
||||
using lyx::odocstream;
|
||||
|
||||
@ -216,7 +217,7 @@ int InsetSpace::plaintext(Buffer const &, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetSpace::docbook(Buffer const &, ostream & os,
|
||||
int InsetSpace::docbook(Buffer const &, odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
switch (kind_) {
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
/// the string that is passed to the TOC
|
||||
virtual int textString(Buffer const &, lyx::odocstream &,
|
||||
|
@ -210,7 +210,7 @@ int InsetSpecialChar::plaintext(Buffer const &, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetSpecialChar::docbook(Buffer const &, ostream & os,
|
||||
int InsetSpecialChar::docbook(Buffer const &, odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
switch (kind_) {
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
/// the string that is passed to the TOC
|
||||
virtual int textString(Buffer const &, lyx::odocstream &,
|
||||
|
@ -1070,7 +1070,7 @@ int InsetTabular::plaintext(Buffer const & buf, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetTabular::docbook(Buffer const & buf, ostream & os,
|
||||
int InsetTabular::docbook(Buffer const & buf, odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
int ret = 0;
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
|
@ -299,7 +299,7 @@ int InsetText::plaintext(Buffer const & buf, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetText::docbook(Buffer const & buf, ostream & os,
|
||||
int InsetText::docbook(Buffer const & buf, odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
docbookParagraphs(paragraphs(), buf, os, runparams);
|
||||
@ -314,7 +314,7 @@ void InsetText::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
void InsetText::cursorPos(BufferView const & bv,
|
||||
void InsetText::cursorPos(BufferView const & /*bv*/,
|
||||
CursorSlice const & sl, bool boundary, int & x, int & y) const
|
||||
{
|
||||
x = text_.cursorX(sl, boundary) + border_;
|
||||
@ -328,7 +328,7 @@ bool InsetText::showInsetDialog(BufferView *) const
|
||||
}
|
||||
|
||||
|
||||
void InsetText::markNew(bool track_changes)
|
||||
void InsetText::markNew(bool /*track_changes*/)
|
||||
{
|
||||
ParagraphList::iterator pit = paragraphs().begin();
|
||||
ParagraphList::iterator end = paragraphs().end();
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
|
@ -67,7 +67,7 @@ int InsetTOC::plaintext(Buffer const & buffer, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetTOC::docbook(Buffer const &, ostream & os,
|
||||
int InsetTOC::docbook(Buffer const &, odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
if (getCmdName() == "tableofcontents")
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
private:
|
||||
virtual std::auto_ptr<InsetBase> doClone() const;
|
||||
|
@ -84,11 +84,15 @@ int InsetUrl::plaintext(Buffer const &, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetUrl::docbook(Buffer const &, ostream & os,
|
||||
int InsetUrl::docbook(Buffer const &, odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << "<ulink url=\"" << subst(getContents(),"&","&")
|
||||
<< "\">" << getOptions() << "</ulink>";
|
||||
// FIXME UNICODE
|
||||
os << "<ulink url=\""
|
||||
<< lyx::from_ascii(subst(getContents(), "&", "&"))
|
||||
<< "\">"
|
||||
<< lyx::from_ascii(getOptions())
|
||||
<< "</ulink>";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
/// the string that is passed to the TOC
|
||||
virtual int textString(Buffer const &, lyx::odocstream &,
|
||||
|
@ -219,7 +219,7 @@ int InsetVSpace::plaintext(Buffer const &, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetVSpace::docbook(Buffer const &, std::ostream & os,
|
||||
int InsetVSpace::docbook(Buffer const &, odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << '\n';
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
void read(Buffer const &, LyXLex & lex);
|
||||
|
@ -192,12 +192,13 @@ int InsetWrap::latex(Buffer const & buf, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetWrap::docbook(Buffer const & buf, ostream & os,
|
||||
int InsetWrap::docbook(Buffer const & buf, odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
os << '<' << params_.type << '>';
|
||||
// FIXME UNICODE
|
||||
os << '<' << lyx::from_ascii(params_.type) << '>';
|
||||
int const i = InsetText::docbook(buf, os, runparams);
|
||||
os << "</" << params_.type << '>';
|
||||
os << "</" << lyx::from_ascii(params_.type) << '>';
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
int latex(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
virtual lyx::docstring const editMessage() const;
|
||||
|
@ -256,8 +256,7 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym, key_modifier::state state)
|
||||
return;
|
||||
}
|
||||
|
||||
Encoding const * encoding = view()->cursor().getEncoding();
|
||||
|
||||
//Encoding const * encoding = view()->cursor().getEncoding();
|
||||
//encoded_last_key = keysym->getISOEncoded(encoding ? encoding->name() : "");
|
||||
size_t encoded_last_key = keysym->getUCSEncoded();
|
||||
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
int latex(Buffer const &, lyx::odocstream & os,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
///
|
||||
|
@ -117,8 +117,8 @@ void InsetMath::mathematica(MathematicaStream & os) const
|
||||
|
||||
void InsetMath::mathmlize(MathMLStream & os) const
|
||||
{
|
||||
NormalStream ns(os.os());
|
||||
normalize(ns);
|
||||
NormalStream ns(os.os());
|
||||
normalize(ns);
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,6 +63,7 @@
|
||||
using lyx::docstring;
|
||||
using lyx::odocstream;
|
||||
using lyx::odocstringstream;
|
||||
|
||||
using lyx::cap::grabAndEraseSelection;
|
||||
using lyx::support::bformat;
|
||||
using lyx::support::subst;
|
||||
@ -1452,11 +1453,10 @@ int InsetMathHull::plaintext(Buffer const &, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetMathHull::docbook(Buffer const & buf, ostream & os,
|
||||
int InsetMathHull::docbook(Buffer const & buf, odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
odocstringstream oss;
|
||||
MathMLStream ms(oss);
|
||||
MathMLStream ms(os);
|
||||
int res = 0;
|
||||
string name;
|
||||
if (getType() == hullSimple)
|
||||
@ -1501,7 +1501,6 @@ int InsetMathHull::docbook(Buffer const & buf, ostream & os,
|
||||
ms << "\">";
|
||||
|
||||
ms << ETag(name.c_str());
|
||||
os << lyx::to_utf8(oss.str());
|
||||
return ms.line() + res;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
int docbook(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
/// the string that is passed to the TOC
|
||||
virtual int textString(Buffer const &, lyx::odocstream &,
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "sgml.h"
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::odocstream;
|
||||
|
||||
using std::string;
|
||||
using std::auto_ptr;
|
||||
@ -156,17 +157,23 @@ int RefInset::plaintext(lyx::odocstream & os, OutputParams const &) const
|
||||
}
|
||||
|
||||
|
||||
int RefInset::docbook(Buffer const & buf, std::ostream & os, OutputParams const & runparams) const
|
||||
int RefInset::docbook(Buffer const & buf, odocstream & os, OutputParams const & runparams) const
|
||||
{
|
||||
if (cell(1).empty()) {
|
||||
os << "<xref linkend=\"" << sgml::cleanID(buf, runparams, asString(cell(0)));
|
||||
// FIXME UNICODE
|
||||
os << "<xref linkend=\""
|
||||
<< lyx::from_ascii(sgml::cleanID(buf, runparams, asString(cell(0))));
|
||||
if (runparams.flavor == OutputParams::XML)
|
||||
os << "\"/>";
|
||||
else
|
||||
os << "\">";
|
||||
} else {
|
||||
os << "<link linkend=\"" << sgml::cleanID(buf, runparams, asString(cell(0)))
|
||||
<< "\">" << asString(cell(1)) << "</link>";
|
||||
// FIXME UNICODE
|
||||
os << "<link linkend=\""
|
||||
<< lyx::from_ascii(sgml::cleanID(buf, runparams, asString(cell(0))))
|
||||
<< "\">"
|
||||
<< lyx::from_ascii(asString(cell(1)))
|
||||
<< "</link>";
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
/// plain text output in ucs4 encoding
|
||||
int plaintext(lyx::odocstream &, OutputParams const &) const;
|
||||
/// docbook output
|
||||
int docbook(Buffer const & buf, std::ostream & os, OutputParams const &) const;
|
||||
int docbook(Buffer const & buf, lyx::odocstream & os, OutputParams const &) const;
|
||||
|
||||
struct ref_type_info {
|
||||
///
|
||||
|
@ -16,8 +16,9 @@
|
||||
#include "MathExtern.h"
|
||||
#include "support/lyxalgo.h"
|
||||
|
||||
using std::strlen;
|
||||
using lyx::odocstream;
|
||||
|
||||
using std::strlen;
|
||||
using lyx::odocstream;
|
||||
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
|
||||
#include "metricsinfo.h"
|
||||
#include "support/docstream.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#endif
|
||||
|
||||
using lyx::pos_type;
|
||||
using lyx::odocstream;
|
||||
using lyx::support::subst;
|
||||
|
||||
using std::endl;
|
||||
@ -98,7 +99,7 @@ ParagraphList::const_iterator searchEnvironment(ParagraphList::const_iterator co
|
||||
|
||||
|
||||
ParagraphList::const_iterator makeParagraph(Buffer const & buf,
|
||||
ostream & os,
|
||||
odocstream & os,
|
||||
OutputParams const & runparams,
|
||||
ParagraphList const & paragraphs,
|
||||
ParagraphList::const_iterator const & pbegin,
|
||||
@ -121,7 +122,7 @@ ParagraphList::const_iterator makeParagraph(Buffer const & buf,
|
||||
|
||||
|
||||
ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
|
||||
ostream & os,
|
||||
odocstream & os,
|
||||
OutputParams const & runparams,
|
||||
ParagraphList const & paragraphs,
|
||||
ParagraphList::const_iterator const & pbegin,
|
||||
@ -218,7 +219,7 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
|
||||
|
||||
|
||||
ParagraphList::const_iterator makeCommand(Buffer const & buf,
|
||||
ostream & os,
|
||||
odocstream & os,
|
||||
OutputParams const & runparams,
|
||||
ParagraphList const & paragraphs,
|
||||
ParagraphList::const_iterator const & pbegin,
|
||||
@ -234,7 +235,8 @@ ParagraphList::const_iterator makeCommand(Buffer const & buf,
|
||||
// Label around sectioning number:
|
||||
if (!bstyle->labeltag().empty()) {
|
||||
sgml::openTag(os, bstyle->labeltag());
|
||||
os << expandLabel(buf, bstyle, false);
|
||||
// FIXME UNICODE
|
||||
os << lyx::from_ascii(expandLabel(buf, bstyle, false));
|
||||
sgml::closeTag(os, bstyle->labeltag());
|
||||
}
|
||||
|
||||
@ -280,7 +282,7 @@ ParagraphList::const_iterator makeCommand(Buffer const & buf,
|
||||
|
||||
void docbookParagraphs(ParagraphList const & paragraphs,
|
||||
Buffer const & buf,
|
||||
ostream & os,
|
||||
odocstream & os,
|
||||
OutputParams const & runparams)
|
||||
{
|
||||
ParagraphList::const_iterator par = paragraphs.begin();
|
||||
|
@ -14,6 +14,7 @@
|
||||
#define OUTPUT_DOCBOOK_H
|
||||
|
||||
#include "ParagraphList_fwd.h"
|
||||
#include "support/docstream.h"
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
@ -23,6 +24,6 @@ class OutputParams;
|
||||
///
|
||||
void docbookParagraphs(ParagraphList const & subset,
|
||||
Buffer const & buf,
|
||||
std::ostream & os,
|
||||
lyx::odocstream & os,
|
||||
OutputParams const & runparams);
|
||||
#endif
|
||||
|
@ -1160,7 +1160,7 @@ string Paragraph::getID(Buffer const & buf, OutputParams const & runparams) cons
|
||||
}
|
||||
|
||||
|
||||
pos_type Paragraph::getFirstWord(Buffer const & buf, ostream & os, OutputParams const & runparams) const
|
||||
pos_type Paragraph::getFirstWord(Buffer const & buf, odocstream & os, OutputParams const & runparams) const
|
||||
{
|
||||
pos_type i;
|
||||
for (i = 0; i < size(); ++i) {
|
||||
@ -1176,8 +1176,8 @@ pos_type Paragraph::getFirstWord(Buffer const & buf, ostream & os, OutputParams
|
||||
// FIXME UNICODE
|
||||
// sgml::escapeChar takes a char, not lyx::char_type
|
||||
boost::tie(ws, str) = sgml::escapeChar(c);
|
||||
|
||||
os << str;
|
||||
// FIXME UNICODE
|
||||
os << lyx::from_ascii(str);
|
||||
}
|
||||
}
|
||||
return i;
|
||||
@ -1202,7 +1202,7 @@ bool Paragraph::onlyText(Buffer const & buf, LyXFont const & outerfont, pos_type
|
||||
|
||||
|
||||
void Paragraph::simpleDocBookOnePar(Buffer const & buf,
|
||||
ostream & os,
|
||||
odocstream & os,
|
||||
OutputParams const & runparams,
|
||||
LyXFont const & outerfont,
|
||||
pos_type initial) const
|
||||
@ -1243,9 +1243,10 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
|
||||
boost::tie(ws, str) = sgml::escapeChar(c);
|
||||
|
||||
if (style->pass_thru)
|
||||
os << c;
|
||||
os.put(c);
|
||||
else
|
||||
os << str;
|
||||
// FIXME UNICODE
|
||||
os << lyx::from_ascii(str);
|
||||
}
|
||||
font_old = font;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ public:
|
||||
|
||||
// Get the first word of a paragraph, return the position where it left
|
||||
lyx::pos_type getFirstWord(Buffer const & buf,
|
||||
std::ostream & os,
|
||||
lyx::odocstream & os,
|
||||
OutputParams const & runparams) const;
|
||||
|
||||
/// Checks if the paragraph contains only text and no inset or font change.
|
||||
@ -152,7 +152,7 @@ public:
|
||||
|
||||
/// Writes to stream the docbook representation
|
||||
void simpleDocBookOnePar(Buffer const & buf,
|
||||
std::ostream &,
|
||||
lyx::odocstream &,
|
||||
OutputParams const & runparams,
|
||||
LyXFont const & outerfont,
|
||||
lyx::pos_type initial = 0) const;
|
||||
|
29
src/sgml.C
29
src/sgml.C
@ -29,6 +29,7 @@
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
|
||||
using lyx::odocstream;
|
||||
using lyx::support::subst;
|
||||
|
||||
using std::make_pair;
|
||||
@ -38,9 +39,7 @@ using std::ostringstream;
|
||||
using std::pair;
|
||||
using std::string;
|
||||
|
||||
namespace sgml {
|
||||
|
||||
pair<bool, string> escapeChar(char c)
|
||||
pair<bool, string> sgml::escapeChar(char c)
|
||||
{
|
||||
string str;
|
||||
|
||||
@ -100,7 +99,7 @@ pair<bool, string> escapeChar(char c)
|
||||
}
|
||||
|
||||
|
||||
string escapeString(string const & raw)
|
||||
string sgml::escapeString(string const & raw)
|
||||
{
|
||||
ostringstream bin;
|
||||
|
||||
@ -114,14 +113,14 @@ string escapeString(string const & raw)
|
||||
}
|
||||
|
||||
|
||||
string const uniqueID(string const label)
|
||||
string const sgml::uniqueID(string const label)
|
||||
{
|
||||
static unsigned int seed = 1000;
|
||||
return label + convert<string>(++seed);
|
||||
}
|
||||
|
||||
|
||||
string cleanID(Buffer const & buf, OutputParams const & runparams, std::string const & orig)
|
||||
string sgml::cleanID(Buffer const & buf, OutputParams const & runparams, std::string const & orig)
|
||||
{
|
||||
// The standard DocBook SGML declaration only allows letters,
|
||||
// digits, '-' and '.' in a name.
|
||||
@ -184,29 +183,31 @@ string cleanID(Buffer const & buf, OutputParams const & runparams, std::string c
|
||||
}
|
||||
|
||||
|
||||
void openTag(ostream & os, string const & name, string const & attribute)
|
||||
void sgml::openTag(odocstream & os, string const & name, string const & attribute)
|
||||
{
|
||||
// FIXME UNICODE
|
||||
// This should be fixed in layout files later.
|
||||
string param = subst(attribute, "<", "\"");
|
||||
param = subst(param, ">", "\"");
|
||||
|
||||
if (!name.empty() && name != "!-- --") {
|
||||
os << '<' << name;
|
||||
os << '<' << lyx::from_ascii(name);
|
||||
if (!param.empty())
|
||||
os << " " << param;
|
||||
os << ' ' << lyx::from_ascii(param);
|
||||
os << '>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void closeTag(ostream & os, string const & name)
|
||||
void sgml::closeTag(odocstream & os, string const & name)
|
||||
{
|
||||
// FIXME UNICODE
|
||||
if (!name.empty() && name != "!-- --")
|
||||
os << "</" << name << '>';
|
||||
os << "</" << lyx::from_ascii(name) << '>';
|
||||
}
|
||||
|
||||
|
||||
void openTag(Buffer const & buf, ostream & os, OutputParams const & runparams, Paragraph const & par)
|
||||
void sgml::openTag(Buffer const & buf, odocstream & os, OutputParams const & runparams, Paragraph const & par)
|
||||
{
|
||||
LyXLayout_ptr const & style = par.layout();
|
||||
string const & name = style->latexname();
|
||||
@ -240,10 +241,8 @@ void openTag(Buffer const & buf, ostream & os, OutputParams const & runparams, P
|
||||
}
|
||||
|
||||
|
||||
void closeTag(ostream & os, Paragraph const & par)
|
||||
void sgml::closeTag(odocstream & os, Paragraph const & par)
|
||||
{
|
||||
LyXLayout_ptr const & style = par.layout();
|
||||
closeTag(os, style->latexname());
|
||||
}
|
||||
|
||||
} // namespace sgml
|
||||
|
@ -14,6 +14,7 @@
|
||||
#define SGML_H
|
||||
|
||||
#include "support/types.h"
|
||||
#include "support/docstream.h"
|
||||
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
@ -43,17 +44,17 @@ std::string cleanID(Buffer const & buf, OutputParams const & runparams,
|
||||
std::string const uniqueID(std::string const label);
|
||||
|
||||
/// Opens tag
|
||||
void openTag(std::ostream & os, std::string const & name,
|
||||
void openTag(lyx::odocstream & os, std::string const & name,
|
||||
std::string const & attribute = std::string());
|
||||
|
||||
/// Open tag
|
||||
void openTag(Buffer const & buf, std::ostream & os,
|
||||
void openTag(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & runparams, Paragraph const & par);
|
||||
|
||||
/// Close tag
|
||||
void closeTag(std::ostream & os, std::string const & name);
|
||||
void closeTag(lyx::odocstream & os, std::string const & name);
|
||||
|
||||
/// Close tag
|
||||
void closeTag(std::ostream & os, Paragraph const & par);
|
||||
void closeTag(lyx::odocstream & os, Paragraph const & par);
|
||||
}
|
||||
#endif // SGML_H
|
||||
|
@ -62,5 +62,13 @@ typedef std::basic_istringstream<char_type> idocstringstream;
|
||||
/// UCS4 output stringstream
|
||||
typedef std::basic_ostringstream<char_type> odocstringstream;
|
||||
|
||||
inline
|
||||
odocstream & operator<<(odocstream & os, char c)
|
||||
{
|
||||
os.put(c);
|
||||
return os;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -2306,7 +2306,7 @@ int LyXTabular::latex(Buffer const & buf, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int LyXTabular::docbookRow(Buffer const & buf, ostream & os, row_type row,
|
||||
int LyXTabular::docbookRow(Buffer const & buf, odocstream & os, row_type row,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
int ret = 0;
|
||||
@ -2358,7 +2358,7 @@ int LyXTabular::docbookRow(Buffer const & buf, ostream & os, row_type row,
|
||||
}
|
||||
|
||||
|
||||
int LyXTabular::docbook(Buffer const & buf, ostream & os,
|
||||
int LyXTabular::docbook(Buffer const & buf, odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
int ret = 0;
|
||||
|
@ -313,7 +313,7 @@ public:
|
||||
int latex(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
//
|
||||
int docbook(Buffer const & buf, std::ostream & os,
|
||||
int docbook(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
@ -617,7 +617,7 @@ public:
|
||||
std::vector<unsigned int> const &,
|
||||
bool onlydata) const;
|
||||
/// auxiliary function for docbook
|
||||
int docbookRow(Buffer const & buf, std::ostream & os, row_type,
|
||||
int docbookRow(Buffer const & buf, lyx::odocstream & os, row_type,
|
||||
OutputParams const &) const;
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user