Add special chain for Modules with OutputFormat for pLaTeX (Japanese)

Fixes: #8823
This commit is contained in:
Juergen Spitzmueller 2017-09-01 10:27:12 +02:00
parent 762c24940a
commit a3eab36364
5 changed files with 30 additions and 7 deletions

View File

@ -638,10 +638,13 @@ def checkFormatEntries(dtl_tools):
\Format platex tex "LaTeX (pLaTeX)" "" "" "%%" "document,menu=export" ""
\Format literate nw NoWeb N "" "%%" "document,menu=export" ""
\Format sweave Rnw "Sweave" S "" "%%" "document,menu=export" ""
\Format sweave-ja Rnw "Sweave (Japanese)" S "" "%%" "document,menu=export" ""
\Format r R "R/S code" "" "" "%%" "document,menu=export" ""
\Format knitr Rnw "Rnw (knitr)" "" "" "%%" "document,menu=export" ""
\Format knitr-ja Rnw "Rnw (knitr, Japanese)" "" "" "%%" "document,menu=export" ""
\Format lilypond ly "LilyPond music" "" "" "%%" "vector" "text/x-lilypond"
\Format lilypond-book lytex "LilyPond book (LaTeX)" "" "" "%%" "document,menu=export" ""
\Format lilypond-book-ja lytex "LilyPond book (pLaTeX)" "" "" "%%" "document,menu=export" ""
\Format latex tex "LaTeX (plain)" L "" "%%" "document,menu=export" "text/x-tex"
\Format luatex tex "LaTeX (LuaTeX)" "" "" "%%" "document,menu=export" ""
\Format pdflatex tex "LaTeX (pdflatex)" "" "" "%%" "document,menu=export" ""
@ -793,6 +796,7 @@ def checkConverterEntries():
checkProg('a Sweave -> LaTeX converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxsweave.R $$p$$i $$p$$o $$e $$r'],
rc_entry = [r'''\converter sweave latex "%%" "needauth"
\converter sweave pdflatex "%%" "needauth"
\converter sweave-ja platex "%%" "needauth"
\converter sweave xetex "%%" "needauth"
\converter sweave luatex "%%" "needauth"
\converter sweave dviluatex "%%" "needauth"'''])
@ -800,15 +804,18 @@ def checkConverterEntries():
checkProg('a knitr -> LaTeX converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxknitr.R $$p$$i $$p$$o $$e $$r'],
rc_entry = [r'''\converter knitr latex "%%" "needauth"
\converter knitr pdflatex "%%" "needauth"
\converter knitr-ja platex "%%" "needauth"
\converter knitr xetex "%%" "needauth"
\converter knitr luatex "%%" "needauth"
\converter knitr dviluatex "%%" "needauth"'''])
#
checkProg('a Sweave -> R/S code converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxstangle.R $$i $$e $$r'],
rc_entry = [ r'\converter sweave r "%%" "needauth"' ])
rc_entry = [ r'\converter sweave r "%%" "needauth"',
r'\converter sweave-ja r "%%" "needauth"' ])
#
checkProg('a knitr -> R/S code converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxknitr.R $$p$$i $$p$$o $$e $$r tangle'],
rc_entry = [ r'\converter knitr r "%%" "needauth"' ])
rc_entry = [ r'\converter knitr r "%%" "needauth"',
r'\converter knitr-ja r "%%" "needauth"' ])
#
checkProg('an HTML -> LaTeX converter', ['html2latex $$i', 'gnuhtml2latex',
'htmltolatex -input $$i -output $$o', 'htmltolatex.jar -input $$i -output $$o'],
@ -1116,6 +1123,7 @@ def checkConverterEntries():
# this, use different output folders for eps and pdf outputs.
addToRC(r'\converter lilypond-book latex "lilypond-book --safe --lily-output-dir=ly-eps $$i" ""')
addToRC(r'\converter lilypond-book pdflatex "lilypond-book --safe --pdf --latex-program=pdflatex --lily-output-dir=ly-pdf $$i" ""')
addToRC(r'\converter lilypond-book-ja platex "lilypond-book --safe --pdf --latex-program=platex --lily-output-dir=ly-pdf $$i" ""')
addToRC(r'\converter lilypond-book xetex "lilypond-book --safe --pdf --latex-program=xelatex --lily-output-dir=ly-pdf $$i" ""')
addToRC(r'\converter lilypond-book luatex "lilypond-book --safe --pdf --latex-program=lualatex --lily-output-dir=ly-pdf $$i" ""')
addToRC(r'\converter lilypond-book dviluatex "lilypond-book --safe --latex-program=dvilualatex --lily-output-dir=ly-eps $$i" ""')

View File

@ -2621,8 +2621,16 @@ vector<string> BufferParams::backends() const
v.push_back("luatex");
v.push_back("dviluatex");
}
} else
v.push_back(buffmt);
} else {
string rbuffmt = buffmt;
// If we use an OutputFormat in Japanese docs,
// we need special format in order to get the path
// via pLaTeX (#8823)
if (documentClass().hasOutputFormat()
&& encoding().package() == Encoding::japanese)
rbuffmt += "-ja";
v.push_back(rbuffmt);
}
v.push_back("xhtml");
v.push_back("text");

View File

@ -449,7 +449,8 @@ bool Converters::convert(Buffer const * buffer,
if (buffer) {
runparams.use_japanese =
buffer->params().bufferFormat() == "latex"
(buffer->params().bufferFormat() == "latex"
|| suffixIs(buffer->params().bufferFormat(), "-ja"))
&& buffer->params().encoding().package() == Encoding::japanese;
runparams.use_indices = buffer->params().use_indices;
runparams.bibtex_command = buffer->params().bibtexCommand();

View File

@ -152,7 +152,7 @@ TextClass::TextClass()
opt_enginetype_("authoryear|numerical"), opt_fontsize_("10|11|12"),
opt_pagestyle_("empty|plain|headings|fancy"), pagestyle_("default"),
columns_(1), sides_(OneSide), secnumdepth_(3), tocdepth_(3),
outputType_(LATEX), outputFormat_("latex"),
outputType_(LATEX), outputFormat_("latex"), has_output_format_(false),
defaultfont_(sane_font),
titletype_(TITLE_COMMAND_AFTER), titlename_("maketitle"),
min_toclevel_(0), max_toclevel_(0), maxcitenames_(2),
@ -445,8 +445,10 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
break;
case TC_OUTPUTFORMAT:
if (lexrc.next())
if (lexrc.next()) {
outputFormat_ = lexrc.getString();
has_output_format_ = true;
}
break;
case TC_OUTPUTTYPE:

View File

@ -207,6 +207,8 @@ public:
OutputType outputType() const { return outputType_; }
/// Can be latex, docbook ... (the name of a format)
std::string outputFormat() const { return outputFormat_; }
/// Does this class redefine the output format?
bool hasOutputFormat() const { return has_output_format_; }
/// Return the non-localised names for the toc types.
std::map<std::string, docstring> const &
outlinerNames() const { return outliner_names_; }
@ -313,6 +315,8 @@ protected:
OutputType outputType_;
/// Can be latex, docbook ... (the name of a format)
std::string outputFormat_;
/// Does this class redefine the output format?
bool has_output_format_;
/** 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