mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
Allow literate documents other than noweb to work out of the box. Currently
only sweave is supported (for building documentation, not programs). Layout files allow a new OutputFormat tag Modules can be conditionned on a feature of the type from->to, indicating that it should be possible to convert from format 'from' to format 'to'. Layout format incremented to 15. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29874 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
863b102f87
commit
864773d7d9
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
#\DeclareLyXModule[noweb.sty]{Noweb literate programming}
|
||||
#\DeclareLyXModule[literate->latex,noweb.sty]{Noweb literate programming}
|
||||
#DescriptionBegin
|
||||
#Allows to use Noweb as a literate programming tool.
|
||||
#DescriptionEnd
|
||||
|
@ -1,4 +1,4 @@
|
||||
#\DeclareLyXModule[Sweave.sty]{Sweave - S/R literate programming}
|
||||
#\DeclareLyXModule[sweave->latex]{Sweave - S/R literate programming}
|
||||
#DescriptionBegin
|
||||
#Allows to use the statistical language S/R as a literate programming tool - Sweave.
|
||||
#DescriptionEnd
|
||||
@ -11,7 +11,7 @@
|
||||
|
||||
Format 11
|
||||
OutputType literate
|
||||
#OutputFormat sweave
|
||||
OutputFormat sweave
|
||||
|
||||
Style Chunk
|
||||
Category Sweave
|
||||
|
@ -48,10 +48,14 @@ import os, re, string, sys
|
||||
# Incremented to format 14, 14 February 2009 by gb
|
||||
# Rename I18NPreamble to BabelPreamble and add LangPreamble
|
||||
|
||||
# Incremented to format 15, 28 May 2009 by lasgouttes
|
||||
# Add new tag OutputFormat; modules can be conditionned on feature
|
||||
# "from->to".
|
||||
|
||||
# Do not forget to document format change in Customization
|
||||
# Manual (section "Declaring a new text class").
|
||||
|
||||
currentFormat = 14
|
||||
currentFormat = 15
|
||||
|
||||
|
||||
def usage(prog_name):
|
||||
@ -227,6 +231,11 @@ def convert(lines):
|
||||
i += 1
|
||||
continue
|
||||
|
||||
# This just involved new features, not any changes to old ones
|
||||
if format == 14:
|
||||
i += 1
|
||||
continue
|
||||
|
||||
# Rename I18NPreamble to BabelPreamble
|
||||
if format == 13:
|
||||
match = re_I18nPreamble.match(lines[i])
|
||||
|
@ -459,10 +459,12 @@ string Buffer::logName(LogType * type) const
|
||||
FileName const fname(addName(temppath(),
|
||||
onlyFilename(changeExtension(filename,
|
||||
".log"))));
|
||||
|
||||
// FIXME: how do we know this is the name of the build log?
|
||||
FileName const bname(
|
||||
addName(path, onlyFilename(
|
||||
changeExtension(filename,
|
||||
formats.extension("literate") + ".out"))));
|
||||
formats.extension(bufferFormat()) + ".out"))));
|
||||
|
||||
// If no Latex log or Build log is newer, show Build log
|
||||
|
||||
@ -2662,15 +2664,14 @@ void Buffer::autoSave() const
|
||||
|
||||
string Buffer::bufferFormat() const
|
||||
{
|
||||
if (isDocBook())
|
||||
return "docbook";
|
||||
if (isLiterate())
|
||||
return "literate";
|
||||
if (params().useXetex)
|
||||
return "xetex";
|
||||
if (params().encoding().package() == Encoding::japanese)
|
||||
return "platex";
|
||||
return "latex";
|
||||
string format = params().documentClass().outputFormat();
|
||||
if (format == "latex") {
|
||||
if (params().useXetex)
|
||||
return "xetex";
|
||||
if (params().encoding().package() == Encoding::japanese)
|
||||
return "platex";
|
||||
}
|
||||
return format;
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "Buffer.h"
|
||||
#include "BufferParams.h"
|
||||
#include "ColorSet.h"
|
||||
#include "Converter.h"
|
||||
#include "Encoding.h"
|
||||
#include "Floating.h"
|
||||
#include "FloatList.h"
|
||||
@ -370,6 +371,14 @@ bool LaTeXFeatures::mustProvide(string const & name) const
|
||||
|
||||
bool LaTeXFeatures::isAvailable(string const & name)
|
||||
{
|
||||
string::size_type const i = name.find("->");
|
||||
if (i != string::npos) {
|
||||
string const from = name.substr(0,i);
|
||||
string const to = name.substr(i+2);
|
||||
LYXERR0("from=[" << from << "] to=[" << to << "]");
|
||||
return theConverters().isReachable(from, to);
|
||||
}
|
||||
|
||||
if (packages_.empty())
|
||||
getAvailable();
|
||||
string n = name;
|
||||
|
@ -62,7 +62,7 @@ private:
|
||||
};
|
||||
|
||||
// Keep the changes documented in the Customization manual.
|
||||
int const FORMAT = 14;
|
||||
int const FORMAT = 15;
|
||||
|
||||
|
||||
bool layout2layout(FileName const & filename, FileName const & tempfile)
|
||||
@ -127,6 +127,7 @@ InsetLayout DocumentClass::plain_insetlayout_;
|
||||
TextClass::TextClass()
|
||||
{
|
||||
outputType_ = LATEX;
|
||||
outputFormat_ = "latex";
|
||||
columns_ = 1;
|
||||
sides_ = OneSide;
|
||||
secnumdepth_ = 3;
|
||||
@ -160,6 +161,7 @@ bool TextClass::readStyle(Lexer & lexrc, Layout & lay) const
|
||||
|
||||
enum TextClassTags {
|
||||
TC_OUTPUTTYPE = 1,
|
||||
TC_OUTPUTFORMAT,
|
||||
TC_INPUT,
|
||||
TC_STYLE,
|
||||
TC_DEFAULTSTYLE,
|
||||
@ -208,6 +210,7 @@ namespace {
|
||||
{ "leftmargin", TC_LEFTMARGIN },
|
||||
{ "nofloat", TC_NOFLOAT },
|
||||
{ "nostyle", TC_NOSTYLE },
|
||||
{ "outputformat", TC_OUTPUTFORMAT },
|
||||
{ "outputtype", TC_OUTPUTTYPE },
|
||||
{ "pagestyle", TC_PAGESTYLE },
|
||||
{ "preamble", TC_PREAMBLE },
|
||||
@ -352,8 +355,24 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
|
||||
format = lexrc.getInteger();
|
||||
break;
|
||||
|
||||
case TC_OUTPUTTYPE: // output type definition
|
||||
case TC_OUTPUTFORMAT:
|
||||
if (lexrc.next())
|
||||
outputFormat_ = lexrc.getString();
|
||||
break;
|
||||
|
||||
case TC_OUTPUTTYPE:
|
||||
readOutputType(lexrc);
|
||||
switch(outputType_) {
|
||||
case LATEX:
|
||||
outputFormat_ = "latex";
|
||||
break;
|
||||
case DOCBOOK:
|
||||
outputFormat_ = "docbook";
|
||||
break;
|
||||
case LITERATE:
|
||||
outputFormat_ = "literate";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case TC_INPUT: // Include file
|
||||
|
@ -191,6 +191,8 @@ public:
|
||||
std::string const & latexname() const { return latexname_; }
|
||||
/// Can be LaTeX, DocBook, etc.
|
||||
OutputType outputType() const { return outputType_; }
|
||||
/// Can be latex, docbook ... (the name of a format)
|
||||
std::string outputFormat() const { return outputFormat_; }
|
||||
protected:
|
||||
/// Protect construction
|
||||
TextClass();
|
||||
@ -272,6 +274,8 @@ protected:
|
||||
int tocdepth_;
|
||||
/// Can be LaTeX, DocBook, etc.
|
||||
OutputType outputType_;
|
||||
/// Can be latex, docbook ... (the name of a format)
|
||||
std::string outputFormat_;
|
||||
/** Base font. The paragraph and layout fonts are resolved against
|
||||
this font. This has to be fully instantiated. Attributes
|
||||
FONT_INHERIT, FONT_IGNORE, and FONT_TOGGLE are
|
||||
@ -406,8 +410,6 @@ public:
|
||||
int max_toclevel() const { return max_toclevel_; }
|
||||
/// returns true if the class has a ToC structure
|
||||
bool hasTocLevels() const;
|
||||
/// Can be LaTeX, DocBook, etc.
|
||||
OutputType outputType() const { return outputType_; }
|
||||
protected:
|
||||
/// Constructs a DocumentClass based upon a LayoutFile.
|
||||
DocumentClass(LayoutFile const & tc);
|
||||
|
@ -150,6 +150,7 @@ bool GuiLog::initialiseParams(string const & data)
|
||||
|
||||
if (logtype == "latex")
|
||||
type_ = LatexLog;
|
||||
// FIXME: not sure "literate" still works.
|
||||
else if (logtype == "literate")
|
||||
type_ = LiterateLog;
|
||||
else if (logtype == "lyx2lyx")
|
||||
|
Loading…
Reference in New Issue
Block a user