drop linuxdoc support (part 3)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14818 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Michael Schmitt 2006-08-23 10:57:45 +00:00
parent 609889cb35
commit b124158c34
20 changed files with 7 additions and 340 deletions

View File

@ -41,7 +41,6 @@
#include "output.h"
#include "output_docbook.h"
#include "output_latex.h"
#include "output_linuxdoc.h"
#include "paragraph.h"
#include "paragraph_funcs.h"
#include "ParagraphParameters.h"
@ -957,12 +956,6 @@ bool Buffer::isLatex() const
}
bool Buffer::isLinuxDoc() const
{
return params().getLyXTextClass().outputType() == LINUXDOC;
}
bool Buffer::isLiterate() const
{
return params().getLyXTextClass().outputType() == LITERATE;
@ -979,76 +972,7 @@ bool Buffer::isSGML() const
{
LyXTextClass const & tclass = params().getLyXTextClass();
return tclass.outputType() == LINUXDOC ||
tclass.outputType() == DOCBOOK;
}
void Buffer::makeLinuxDocFile(string const & fname,
OutputParams const & runparams,
bool const body_only)
{
lyxerr[Debug::LATEX] << "makeLinuxDocFile..." << endl;
ofstream ofs;
if (!openFileWrite(ofs, fname))
return;
writeLinuxDocSource(ofs, fname, runparams, body_only);
ofs.close();
if (ofs.fail())
lyxerr << "File '" << fname << "' was not closed properly." << endl;
}
void Buffer::writeLinuxDocSource(ostream &os, string const & fname,
OutputParams const & runparams,
bool const body_only)
{
LaTeXFeatures features(*this, params(), runparams);
validate(features);
texrow().reset();
LyXTextClass const & tclass = params().getLyXTextClass();
string const & top_element = tclass.latexname();
if (!body_only) {
os << tclass.class_header();
string preamble = params().preamble;
string const name = runparams.nice ? changeExtension(pimpl_->filename, ".sgml")
: fname;
preamble += features.getIncludedFiles(name);
preamble += features.getLyXSGMLEntities();
if (!preamble.empty()) {
os << " [ " << preamble << " ]";
}
os << ">\n\n";
if (params().options.empty())
sgml::openTag(os, top_element);
else {
string top = top_element;
top += ' ';
top += params().options;
sgml::openTag(os, top);
}
}
os << "<!-- LyX " << lyx_version
<< " created this file. For more info see http://www.lyx.org/"
<< " -->\n";
linuxdocParagraphs(*this, paragraphs(), os, runparams);
if (!body_only) {
os << "\n\n";
sgml::closeTag(os, top_element);
}
return tclass.outputType() == DOCBOOK;
}
@ -1678,8 +1602,6 @@ void Buffer::getSourceCode(ostream & os, lyx::pit_type par_begin, lyx::pit_type
os << "% Preview source code\n\n";
if (isLatex())
writeLaTeXSource(os, filePath(), runparams, true, true);
else if (isLinuxDoc())
writeLinuxDocSource(os, fileName(), runparams, false);
else
writeDocBookSource(os, fileName(), runparams, false);
} else {
@ -1693,9 +1615,7 @@ void Buffer::getSourceCode(ostream & os, lyx::pit_type par_begin, lyx::pit_type
if (isLatex()) {
texrow().reset();
latexParagraphs(*this, paragraphs(), os, texrow(), runparams);
} else if (isLinuxDoc())
linuxdocParagraphs(*this, paragraphs(), os, runparams);
else // DocBook
} else // DocBook
docbookParagraphs(paragraphs(), *this, os, runparams);
}
}

View File

@ -240,9 +240,7 @@ void bufferErrors(Buffer const & buf, TeXErrors const & terr,
string const bufferFormat(Buffer const & buffer)
{
if (buffer.isLinuxDoc())
return "linuxdoc";
else if (buffer.isDocBook())
if (buffer.isDocBook())
return "docbook";
else if (buffer.isLiterate())
return "literate";

View File

@ -191,11 +191,6 @@ bool Exporter::Export(Buffer * buffer, string const & format,
// no backend
else if (backend_format == "lyx")
buffer->writeFile(filename);
// Linuxdoc backend
else if (buffer->isLinuxDoc()) {
runparams.nice = !put_in_tempdir;
buffer->makeLinuxDocFile(filename, runparams);
}
// Docbook backend
else if (buffer->isDocBook()) {
runparams.nice = !put_in_tempdir;

View File

@ -65,8 +65,6 @@ vector<Format const *> const ControlSendto::allFormats() const
if (buffer.isLatex())
exports.push_back("latex");
else if (buffer.isLinuxDoc())
exports.push_back("linuxdoc");
else if (buffer.isDocBook())
exports.push_back("docbook");
else if (buffer.isLiterate())

View File

@ -73,9 +73,6 @@ string const ControlViewSource::title() const
case Kernel::LATEX:
source_type = "LaTeX";
break;
case Kernel::LINUXDOC:
source_type = "LinuxDoc";
break;
case Kernel::DOCBOOK:
source_type = "DocBook";
break;

View File

@ -75,8 +75,6 @@ Kernel::DocType Kernel::docType() const
return LATEX;
if (buffer().isLiterate())
return LITERATE;
if (buffer().isLinuxDoc())
return LINUXDOC;
return DOCBOOK;
}

View File

@ -71,7 +71,6 @@ public:
enum DocType {
LATEX,
LITERATE,
LINUXDOC,
DOCBOOK
};
/// The type of the current buffer.

View File

@ -177,8 +177,8 @@ void GRef::update()
nameentry_->set_sensitive(true);
}
// Format is irrelevant to LinuxDoc/DocBook.
if (doctype == Kernel::LINUXDOC || doctype == Kernel::DOCBOOK) {
// Format is irrelevant to DocBook.
if (doctype == Kernel::DOCBOOK) {
formatcombo_->set_active(0);
formatcombo_->set_sensitive(false);

View File

@ -127,8 +127,7 @@ bool QRef::nameAllowed()
bool QRef::typeAllowed()
{
Kernel::DocType const doc_type = kernel().docType();
return doc_type != Kernel::LINUXDOC &&
doc_type != Kernel::DOCBOOK;
return doc_type != Kernel::DOCBOOK;
}

View File

@ -128,8 +128,7 @@ bool QRef::nameAllowed()
bool QRef::typeAllowed()
{
Kernel::DocType const doc_type = kernel().docType();
return doc_type != Kernel::LINUXDOC &&
doc_type != Kernel::DOCBOOK;
return doc_type != Kernel::DOCBOOK;
}

View File

@ -18,8 +18,6 @@ enum OutputType {
///
LATEX = 1,
///
LINUXDOC,
///
DOCBOOK,
///
LITERATE

View File

@ -516,7 +516,6 @@ void LyXTextClass::readOutputType(LyXLex & lexrc)
keyword_item outputTypeTags[] = {
{ "docbook", DOCBOOK },
{ "latex", LATEX },
{ "linuxdoc", LINUXDOC },
{ "literate", LITERATE }
};
@ -528,7 +527,6 @@ void LyXTextClass::readOutputType(LyXLex & lexrc)
lexrc.printError("Unknown output type `$$Token'");
return;
case LATEX:
case LINUXDOC:
case DOCBOOK:
case LITERATE:
outputType_ = static_cast<OutputType>(le);

View File

@ -94,13 +94,6 @@ int InsetFormulaMacro::plaintext(Buffer const &, ostream & os,
}
int InsetFormulaMacro::linuxdoc(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
return plaintext(buf, os, runparams);
}
int InsetFormulaMacro::docbook(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{

View File

@ -47,9 +47,6 @@ public:
int latex(Buffer const &, std::ostream & os,
OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream & os,
OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
OutputParams const &) const;

View File

@ -1427,13 +1427,6 @@ int MathHullInset::plaintext(Buffer const &, ostream & os,
}
int MathHullInset::linuxdoc(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
return docbook(buf, os, runparams);
}
int MathHullInset::docbook(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{

View File

@ -103,9 +103,6 @@ public:
int plaintext(Buffer const &, std::ostream &,
OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
OutputParams const &) const;
/// the string that is passed to the TOC

View File

@ -157,14 +157,6 @@ int RefInset::plaintext(std::ostream & os, OutputParams const &) const
}
int RefInset::linuxdoc(std::ostream & os, OutputParams const &) const
{
os << "<ref id=\"" << asString(cell(0))
<< "\" name=\"" << asString(cell(1)) << "\">";
return 0;
}
int RefInset::docbook(Buffer const & buf, std::ostream & os, OutputParams const & runparams) const
{
if (cell(1).empty()) {

View File

@ -36,8 +36,6 @@ public:
/// plain ascii output
int plaintext(std::ostream & os, OutputParams const &) const;
/// linuxdoc output
int linuxdoc(std::ostream & os, OutputParams const &) const;
/// docbook output
int docbook(Buffer const & buf, std::ostream & os, OutputParams const &) const;

View File

@ -1,172 +0,0 @@
/**
* \file output_linuxdoc.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Lars Gullik Bjønnes
* \author José Matos
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "output_linuxdoc.h"
#include "buffer.h"
#include "bufferparams.h"
#include "outputparams.h"
#include "paragraph.h"
#include "paragraph_funcs.h"
#include "ParagraphList.h"
#include "ParagraphParameters.h"
#include "sgml.h"
#include <stack>
using std::ostream;
using std::stack;
using std::vector;
using std::string;
void linuxdocParagraphs(Buffer const & buf,
ParagraphList const & paragraphs,
ostream & os,
OutputParams const & runparams)
{
Paragraph::depth_type depth = 0; // paragraph depth
string item_name;
vector<string> environment_stack(5);
ParagraphList::const_iterator pit = paragraphs.begin();
ParagraphList::const_iterator pend = paragraphs.end();
BOOST_ASSERT(runparams.par_begin <= runparams.par_end);
// if only part of the paragraphs will be outputed
if (runparams.par_begin != runparams.par_end) {
pit = boost::next(paragraphs.begin(), runparams.par_begin);
pend = boost::next(paragraphs.begin(), runparams.par_end);
// runparams will be passed to nested paragraphs, so
// we have to reset the range parameters.
const_cast<OutputParams&>(runparams).par_begin = 0;
const_cast<OutputParams&>(runparams).par_end = 0;
}
for (; pit != pend; ++pit) {
LyXLayout_ptr const & style = pit->layout();
// treat <toc> as a special case for compatibility with old code
if (!pit->empty() && pit->isInset(0)) {
InsetBase const * inset = pit->getInset(0);
if (inset->lyxCode() == InsetBase::TOC_CODE) {
string const temp = "toc";
sgml::openTag(os, temp);
continue;
}
}
// environment tag closing
for (; depth > pit->params().depth(); --depth) {
sgml::closeTag(os, environment_stack[depth]);
environment_stack[depth].erase();
}
// write opening SGML tags
switch (style->latextype) {
case LATEX_PARAGRAPH:
if (depth == pit->params().depth()
&& !environment_stack[depth].empty()) {
sgml::closeTag(os, environment_stack[depth]);
environment_stack[depth].erase();
if (depth)
--depth;
else
os << "</p>";
}
sgml::openTag(os, style->latexname());
break;
case LATEX_COMMAND:
#if 0
if (depth != 0)
error(ErrorItem(_("Error:"), _("Wrong depth for LatexType Command.\n"), pit->id(), 0, pit->size()));
#endif
if (!environment_stack[depth].empty()) {
sgml::closeTag(os, environment_stack[depth]);
os << "</p>";
}
environment_stack[depth].erase();
sgml::openTag(os, style->latexname());
break;
case LATEX_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT:
case LATEX_BIB_ENVIRONMENT: {
string const & latexname = style->latexname();
if (depth == pit->params().depth()
&& environment_stack[depth] != latexname) {
sgml::closeTag(os, environment_stack[depth]);
environment_stack[depth].erase();
}
if (depth < pit->params().depth()) {
depth = pit->params().depth();
environment_stack[depth].erase();
}
if (environment_stack[depth] != latexname) {
if (depth == 0) {
sgml::openTag(os, "p");
}
sgml::openTag(os, latexname);
if (environment_stack.size() == depth + 1)
environment_stack.push_back("!-- --");
environment_stack[depth] = latexname;
}
if (style->latexparam() == "CDATA")
os << "<![CDATA[";
if (style->latextype == LATEX_ENVIRONMENT) break;
if (style->labeltype == LABEL_MANUAL)
item_name = "tag";
else
item_name = "item";
sgml::openTag(os, item_name);
}
break;
default:
sgml::openTag(os, style->latexname());
break;
}
pit->simpleLinuxDocOnePar(buf, os,
outerFont(std::distance(paragraphs.begin(), pit), paragraphs),
runparams, depth);
os << "\n";
// write closing SGML tags
switch (style->latextype) {
case LATEX_COMMAND:
break;
case LATEX_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT:
case LATEX_BIB_ENVIRONMENT:
if (style->latexparam() == "CDATA")
os << "]]>";
break;
default:
sgml::closeTag(os, style->latexname());
break;
}
}
// Close open tags
for (int i = depth; i >= 0; --i)
sgml::closeTag(os, environment_stack[i]);
}

View File

@ -1,30 +0,0 @@
// -*- C++ -*-
/**
* \file output_linuxdoc.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Lars Gullik Bjønnes
* \author José Matos
*
* Full author contact details are available in file CREDITS.
*/
#ifndef OUTPUT_LINUXDOC_H
#define OUTPUT_LINUXDOC_H
#include "ParagraphList_fwd.h"
#include <iosfwd>
class Buffer;
class OutputParams;
///
void linuxdocParagraphs(Buffer const & buf,
ParagraphList const & paragraphs,
std::ostream & os,
OutputParams const & runparams);
#endif