mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-09 10:47:57 +00:00
Fix bug #8468: Wrong import of UTF8 CJK.
Actually, the test case showed several problems: - ERT insets did use layout "Standard", not "Plain Layout" - The font scale was read correctly, but tex2lyx claimed that it did ignore the option "scaled=0.95" - If a third argument of the CJK environment was given, it caused the whole environment to be put in ERT with a broken encoding. This is now fixed for the bug test case by using the \font_cjk header variable, but the encoding problem still exists for unsupported encodings. I'll file a separate bug for that. - The CJKutf8 package was not handled in the preamble parsing. Therefore the chinese comment in the preamble was read with a wrong encoding, and guessing the document language did not work. The new file CJKutf8.tex was created by copying and modifying CJK.tex, but unfortunately it is impossible to tell git to inherit the history of CJK.tex for the new file (search the web for git svn copy if you want to know details).
This commit is contained in:
parent
6c54a081fa
commit
de5e348727
@ -140,7 +140,7 @@ void InsetMathChar::write(WriteStream & os) const
|
||||
|
||||
void InsetMathChar::validate(LaTeXFeatures & features) const
|
||||
{
|
||||
if (char_ >= 0x80)
|
||||
if (!isASCII(char_))
|
||||
encodings.validate(char_, features, true);
|
||||
}
|
||||
|
||||
|
@ -1343,7 +1343,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
}
|
||||
InsetMathGrid grid(buffer_, 1, 1);
|
||||
if (!topaste.empty())
|
||||
if ((topaste.size() == 1 && topaste.at(0) < 0x80)
|
||||
if ((topaste.size() == 1 && isAscii(topaste))
|
||||
|| !mathed_parse_normal(grid, topaste, parseflg)) {
|
||||
resetGrid(grid);
|
||||
mathed_parse_normal(grid, topaste, parseflg | Parse::VERBATIM);
|
||||
|
@ -120,7 +120,7 @@ void InsetMathString::write(WriteStream & os) const
|
||||
docstring command(1, c);
|
||||
try {
|
||||
bool termination = false;
|
||||
if (c < 0x80 ||
|
||||
if (isASCII(c) ||
|
||||
Encodings::latexMathChar(c, mathmode, os.encoding(), command, termination)) {
|
||||
if (os.textMode()) {
|
||||
if (in_forced_mode) {
|
||||
@ -129,12 +129,12 @@ void InsetMathString::write(WriteStream & os) const
|
||||
os.textMode(false);
|
||||
in_forced_mode = false;
|
||||
}
|
||||
if (c >= 0x80 && os.textMode()) {
|
||||
if (!isASCII(c) && os.textMode()) {
|
||||
os << "\\ensuremath{";
|
||||
os.textMode(false);
|
||||
in_forced_mode = true;
|
||||
}
|
||||
} else if (c < 0x80 && in_forced_mode) {
|
||||
} else if (isASCII(c) && in_forced_mode) {
|
||||
// we were inside \ensuremath
|
||||
os << '}';
|
||||
os.textMode(true);
|
||||
|
@ -62,6 +62,7 @@
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h" // LibFileSearch
|
||||
#include "support/lstrings.h"
|
||||
#include "support/textutils.h"
|
||||
|
||||
#include "frontends/FontLoader.h"
|
||||
|
||||
@ -588,7 +589,7 @@ bool createInsetMath_fromDialogStr(docstring const & str, MathData & ar)
|
||||
|
||||
bool isAsciiOrMathAlpha(char_type c)
|
||||
{
|
||||
return c < 0x80 || Encodings::isMathAlpha(c);
|
||||
return isASCII(c) || Encodings::isMathAlpha(c);
|
||||
}
|
||||
|
||||
|
||||
|
@ -732,7 +732,7 @@ void MathMacro::write(WriteStream & os) const
|
||||
for (; i < cells_.size(); ++i) {
|
||||
if (cell(i).size() == 1
|
||||
&& cell(i)[0].nucleus()->asCharInset()
|
||||
&& cell(i)[0].nucleus()->asCharInset()->getChar() < 0x80) {
|
||||
&& isASCII(cell(i)[0].nucleus()->asCharInset()->getChar())) {
|
||||
if (first)
|
||||
os << " ";
|
||||
os << cell(i);
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "support/convert.h"
|
||||
#include "support/debug.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "support/textutils.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <boost/next_prior.hpp>
|
||||
@ -744,7 +745,7 @@ void TeXOnePar(Buffer const & buf,
|
||||
par.getFontSettings(bparams, i).language()->encoding();
|
||||
if (encoding->package() != Encoding::CJK
|
||||
&& runparams.encoding->package() == Encoding::inputenc
|
||||
&& c < 0x80)
|
||||
&& isASCII(c))
|
||||
continue;
|
||||
if (par.isInset(i))
|
||||
break;
|
||||
|
@ -115,7 +115,7 @@ void Context::begin_layout(ostream & os, Layout const * const & l)
|
||||
// \\Huge par1 \\par par2
|
||||
// FIXME: If the document language is not english this outputs a
|
||||
// superflous language change. Fortunately this is only file format
|
||||
// bloat an does not change the TeX export of LyX.
|
||||
// bloat and does not change the TeX export of LyX.
|
||||
output_font_change(os, normalfont, font);
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ TEST_FILES = \
|
||||
test/runtests.py \
|
||||
test/box-color-size-space-align.tex \
|
||||
test/CJK.tex \
|
||||
test/CJKutf8.tex \
|
||||
test/DummyDocument.tex \
|
||||
test/Dummy~Document.tex \
|
||||
test/Dummy\ Document.tex \
|
||||
|
@ -405,18 +405,18 @@ void Preamble::add_package(string const & name, vector<string> & options)
|
||||
|
||||
namespace {
|
||||
|
||||
// Given is a string like "scaled=0.9", return 0.9 * 100
|
||||
string const scale_as_percentage(string const & scale)
|
||||
// Given is a string like "scaled=0.9" or "Scale=0.9", return 0.9 * 100
|
||||
bool scale_as_percentage(string const & scale, string & percentage)
|
||||
{
|
||||
string::size_type pos = scale.find('=');
|
||||
if (pos != string::npos) {
|
||||
string value = scale.substr(pos + 1);
|
||||
if (isStrDbl(value))
|
||||
return convert<string>(100 * convert<double>(value));
|
||||
if (isStrDbl(value)) {
|
||||
percentage = convert<string>(100 * convert<double>(value));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// If the input string didn't match our expectations.
|
||||
// return the default value "100"
|
||||
return "100";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -432,7 +432,8 @@ string remove_braces(string const & value)
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
Preamble::Preamble() : one_language(true), title_layout_found(false)
|
||||
Preamble::Preamble() : one_language(true), title_layout_found(false),
|
||||
h_font_cjk_set(false)
|
||||
{
|
||||
//h_backgroundcolor;
|
||||
//h_boxbgcolor;
|
||||
@ -455,6 +456,7 @@ Preamble::Preamble() : one_language(true), title_layout_found(false)
|
||||
h_font_osf = "false";
|
||||
h_font_sf_scale = "100";
|
||||
h_font_tt_scale = "100";
|
||||
//h_font_cjk
|
||||
h_graphics = "default";
|
||||
h_default_output_format = "default";
|
||||
h_html_be_strict = "false";
|
||||
@ -642,7 +644,6 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
{
|
||||
vector<string> options = split_options(opts);
|
||||
add_package(name, options);
|
||||
string scale;
|
||||
char const * const * where = 0;
|
||||
|
||||
if (is_known(name, known_xetex_packages)) {
|
||||
@ -673,9 +674,9 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
// sansserif fonts
|
||||
if (is_known(name, known_sans_fonts)) {
|
||||
h_font_sans = name;
|
||||
if (!opts.empty()) {
|
||||
scale = opts;
|
||||
h_font_sf_scale = scale_as_percentage(scale);
|
||||
if (options.size() == 1) {
|
||||
if (scale_as_percentage(opts, h_font_sf_scale))
|
||||
options.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -685,9 +686,9 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
// fourier as typewriter is handled in handling of \ttdefault
|
||||
if (name != "fourier") {
|
||||
h_font_typewriter = name;
|
||||
if (!opts.empty()) {
|
||||
scale = opts;
|
||||
h_font_tt_scale = scale_as_percentage(scale);
|
||||
if (options.size() == 1) {
|
||||
if (scale_as_percentage(opts, h_font_tt_scale))
|
||||
options.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -766,6 +767,12 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
registerAutomaticallyLoadedPackage("CJK");
|
||||
}
|
||||
|
||||
else if (name == "CJKutf8") {
|
||||
h_inputencoding = "UTF8";
|
||||
p.setEncoding(h_inputencoding);
|
||||
registerAutomaticallyLoadedPackage("CJKutf8");
|
||||
}
|
||||
|
||||
else if (name == "fontenc") {
|
||||
h_fontencoding = getStringFromVector(options, ",");
|
||||
/* We could do the following for better round trip support,
|
||||
@ -1000,8 +1007,10 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc)
|
||||
<< "\\font_sc " << h_font_sc << "\n"
|
||||
<< "\\font_osf " << h_font_osf << "\n"
|
||||
<< "\\font_sf_scale " << h_font_sf_scale << "\n"
|
||||
<< "\\font_tt_scale " << h_font_tt_scale << "\n"
|
||||
<< "\\graphics " << h_graphics << "\n"
|
||||
<< "\\font_tt_scale " << h_font_tt_scale << '\n';
|
||||
if (!h_font_cjk.empty())
|
||||
os << "\\font_cjk " << h_font_cjk << '\n';
|
||||
os << "\\graphics " << h_graphics << '\n'
|
||||
<< "\\default_output_format " << h_default_output_format << "\n"
|
||||
<< "\\output_sync " << h_output_sync << "\n";
|
||||
if (h_output_sync == "1")
|
||||
@ -1212,9 +1221,9 @@ void Preamble::parse(Parser & p, string const & forceclass,
|
||||
if (pos != string::npos) {
|
||||
string::size_type i = fontopts.find(',', pos);
|
||||
if (i == string::npos)
|
||||
scale = scale_as_percentage(fontopts.substr(pos + 1));
|
||||
scale_as_percentage(fontopts.substr(pos + 1), scale);
|
||||
else
|
||||
scale = scale_as_percentage(fontopts.substr(pos, i - pos));
|
||||
scale_as_percentage(fontopts.substr(pos, i - pos), scale);
|
||||
}
|
||||
}
|
||||
if (t.cs() == "setsansfont") {
|
||||
@ -1666,7 +1675,9 @@ void Preamble::parse(Parser & p, string const & forceclass,
|
||||
// the babel options. Instead, we guess which language is used most
|
||||
// and set this one.
|
||||
default_language = h_language;
|
||||
if (is_full_document && auto_packages.find("CJK") != auto_packages.end()) {
|
||||
if (is_full_document &&
|
||||
(auto_packages.find("CJK") != auto_packages.end() ||
|
||||
auto_packages.find("CJKutf8") != auto_packages.end())) {
|
||||
p.pushPosition();
|
||||
h_language = guessLanguage(p, default_language);
|
||||
p.popPosition();
|
||||
|
@ -38,6 +38,12 @@ public:
|
||||
std::string inputencoding() const { return h_inputencoding; }
|
||||
///
|
||||
std::string notefontcolor() const { return h_notefontcolor; }
|
||||
///
|
||||
bool fontCJKSet() const { return h_font_cjk_set; }
|
||||
///
|
||||
std::string fontCJK() const { return h_font_cjk; }
|
||||
///
|
||||
void fontCJK(std::string const & f) { h_font_cjk_set = true; h_font_cjk = f; }
|
||||
/// The document language
|
||||
std::string docLanguage() const { return h_language; }
|
||||
/// The language of text which is not explicitly marked
|
||||
@ -123,6 +129,8 @@ private:
|
||||
std::string h_font_osf;
|
||||
std::string h_font_sf_scale;
|
||||
std::string h_font_tt_scale;
|
||||
bool h_font_cjk_set;
|
||||
std::string h_font_cjk;
|
||||
std::string h_graphics;
|
||||
std::string h_default_output_format;
|
||||
std::string h_html_be_strict;
|
||||
|
@ -31,7 +31,6 @@ Format LaTeX feature LyX feature
|
||||
326 PDFLaTeX for external insets InsetExternal
|
||||
329 master documents \master
|
||||
332 ? InsetGraphics groupId
|
||||
336 ? \font_cjk
|
||||
343 ? \use_default_options
|
||||
353 \printsubindex InsetIndex
|
||||
354 \printindex*, \printsubindex* InsetIndex
|
||||
|
@ -112,7 +112,7 @@ Chinese simplified
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
begin{CJK}{EUC-JP}{hei}
|
||||
@ -124,7 +124,7 @@ begin{CJK}{EUC-JP}{hei}
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
end{CJK}
|
||||
@ -146,7 +146,7 @@ Chinese simplified
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
begin{CJK}{Bg5}{}
|
||||
@ -160,7 +160,7 @@ Big5 文鼎楷書
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
end{CJK}
|
||||
@ -182,7 +182,7 @@ English
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
begin{CJK}{SJIS}{}
|
||||
@ -196,7 +196,7 @@ Shift_JIS 日本語の文章
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
end{CJK}
|
||||
@ -216,7 +216,7 @@ hello
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
begin{CJK}{JIS}{}
|
||||
@ -229,7 +229,7 @@ JIS-code
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
$
|
||||
\end_layout
|
||||
|
||||
@ -239,7 +239,7 @@ BF|K
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
|
||||
@ -251,7 +251,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
$
|
||||
\end_layout
|
||||
|
||||
@ -262,7 +262,7 @@ NJ8>O(B
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
end{CJK}
|
||||
|
173
src/tex2lyx/test/CJKutf8.lyx.lyx
Normal file
173
src/tex2lyx/test/CJKutf8.lyx.lyx
Normal file
@ -0,0 +1,173 @@
|
||||
#LyX file created by tex2lyx 2.1.0dev
|
||||
\lyxformat 457
|
||||
\begin_document
|
||||
\begin_header
|
||||
\textclass article
|
||||
\begin_preamble
|
||||
|
||||
\usepackage{babel}
|
||||
|
||||
|
||||
% It is impossible to get the document language because the document could start with a command,
|
||||
% whitespace, and English word or whatever and the rest is in Japanese. Checking for the first CJK
|
||||
% environment is no solution because the document could be English and contain only some Japanese.
|
||||
|
||||
|
||||
\end_preamble
|
||||
\use_default_options false
|
||||
\maintain_unincluded_children false
|
||||
\language chinese-traditional
|
||||
\language_package default
|
||||
\inputencoding UTF8
|
||||
\fontencoding T1
|
||||
\font_roman default
|
||||
\font_sans default
|
||||
\font_typewriter default
|
||||
\font_math auto
|
||||
\font_default_family default
|
||||
\use_non_tex_fonts false
|
||||
\font_sc false
|
||||
\font_osf false
|
||||
\font_sf_scale 100
|
||||
\font_tt_scale 100
|
||||
\graphics default
|
||||
\default_output_format default
|
||||
\output_sync 0
|
||||
\bibtex_command default
|
||||
\index_command default
|
||||
\paperfontsize default
|
||||
\spacing single
|
||||
\use_hyperref false
|
||||
\papersize default
|
||||
\use_geometry false
|
||||
\use_package amsmath 1
|
||||
\use_package amssymb 0
|
||||
\use_package esint 1
|
||||
\use_package mathdots 0
|
||||
\use_package mathtools 0
|
||||
\use_package mhchem 0
|
||||
\use_package stackrel 0
|
||||
\use_package stmaryrd 0
|
||||
\use_package undertilde 0
|
||||
\cite_engine basic
|
||||
\cite_engine_type numerical
|
||||
\biblio_style plain
|
||||
\use_bibtopic false
|
||||
\use_indices false
|
||||
\paperorientation portrait
|
||||
\suppress_date false
|
||||
\justification true
|
||||
\use_refstyle 0
|
||||
\index Index
|
||||
\shortcut idx
|
||||
\color #008000
|
||||
\end_index
|
||||
\secnumdepth 3
|
||||
\tocdepth 3
|
||||
\paragraph_separation indent
|
||||
\paragraph_indentation default
|
||||
\quotes_language english
|
||||
\papercolumns 1
|
||||
\papersides 1
|
||||
\paperpagestyle default
|
||||
\tracking_changes false
|
||||
\output_changes false
|
||||
\html_math_output 0
|
||||
\html_css_as_file 0
|
||||
\html_be_strict false
|
||||
\end_header
|
||||
|
||||
\begin_body
|
||||
|
||||
\begin_layout Standard
|
||||
|
||||
\lang chinese-traditional
|
||||
Japanese
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
|
||||
\lang chinese-traditional
|
||||
Chinese traditional
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
|
||||
\lang chinese-traditional
|
||||
Japanese
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
hello
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
|
||||
\lang chinese-traditional
|
||||
Chinese simplified
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
begin{CJK}{UTF8}{hei}
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
Japanese
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
end{CJK}
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
|
||||
\lang chinese-traditional
|
||||
Chinese simplified
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
|
||||
\lang chinese-traditional
|
||||
Big5 文鼎楷書
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
|
||||
\lang english
|
||||
English
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
|
||||
\lang chinese-traditional
|
||||
日本語の文章
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
hello
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
|
||||
\lang chinese-traditional
|
||||
Korean
|
||||
\end_layout
|
||||
|
||||
\end_body
|
||||
\end_document
|
39
src/tex2lyx/test/CJKutf8.tex
Normal file
39
src/tex2lyx/test/CJKutf8.tex
Normal file
@ -0,0 +1,39 @@
|
||||
\documentclass[english]{article}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage{CJKutf8}
|
||||
\usepackage{babel}
|
||||
|
||||
% It is impossible to get the document language because the document could start with a command,
|
||||
% whitespace, and English word or whatever and the rest is in Japanese. Checking for the first CJK
|
||||
% environment is no solution because the document could be English and contain only some Japanese.
|
||||
|
||||
\begin{document}
|
||||
|
||||
\begin{CJK}{UTF8}{}%
|
||||
Japanese \end{CJK} \begin{CJK}{UTF8}{}Chinese traditional\end{CJK} \begin{CJK}{UTF8}{}
|
||||
Japanese \end{CJK}
|
||||
hello
|
||||
\begin{CJK}{UTF8}{}%
|
||||
Chinese simplified \end{CJK}\begin{CJK}{UTF8}{hei} Japanese \end{CJK} \begin{CJK}{UTF8}{}Chinese simplified
|
||||
\end{CJK}
|
||||
|
||||
\begin{CJK}{UTF8}{}
|
||||
Big5 文鼎楷書
|
||||
\end{CJK}
|
||||
|
||||
\inputencoding{latin9}%
|
||||
\selectlanguage{english}%
|
||||
English
|
||||
|
||||
\begin{CJK}{UTF8}{}
|
||||
日本語の文章
|
||||
\end{CJK}
|
||||
|
||||
hello
|
||||
|
||||
\begin{CJK}{UTF8}{}%
|
||||
Korean
|
||||
\end{CJK}
|
||||
|
||||
\end{document}
|
@ -12,7 +12,7 @@ project(test)
|
||||
|
||||
set(_tex_tests test.ltx test-structure.tex test-insets.tex
|
||||
test-modules.tex box-color-size-space-align.tex
|
||||
CJK.tex XeTeX-polyglossia.tex)
|
||||
CJK.tex CJKutf8.tex XeTeX-polyglossia.tex)
|
||||
|
||||
foreach(_fl ${_tex_tests})
|
||||
set(fl ${_fl})
|
||||
|
@ -96,7 +96,7 @@ ancient Greek
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
textgreek[numerals=arabic, variant=ancient]
|
||||
@ -108,7 +108,7 @@ textgreek[numerals=arabic, variant=ancient]
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
{
|
||||
\end_layout
|
||||
|
||||
@ -122,7 +122,7 @@ reek
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -170,11 +170,11 @@ df
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
%empty language paragraph
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\end_layout
|
||||
|
||||
|
@ -137,7 +137,7 @@ blabla
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
mbox{
|
||||
@ -149,7 +149,7 @@ mbox
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -247,7 +247,7 @@ status open
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
centering
|
||||
@ -259,7 +259,7 @@ centering
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
setlength{
|
||||
@ -277,7 +277,7 @@ unitlength}{.2in}
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
begin{picture}
|
||||
@ -289,7 +289,7 @@ begin{picture}
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
put
|
||||
@ -301,7 +301,7 @@ put
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
{
|
||||
\end_layout
|
||||
|
||||
@ -311,7 +311,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
makebox(0,0)[tr]{
|
||||
@ -323,7 +323,7 @@ AAA
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -333,7 +333,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -343,7 +343,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
put
|
||||
@ -355,7 +355,7 @@ put
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
{
|
||||
\end_layout
|
||||
|
||||
@ -365,7 +365,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
makebox(0,0){
|
||||
@ -377,7 +377,7 @@ BBB
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -387,7 +387,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -397,7 +397,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
put
|
||||
@ -409,7 +409,7 @@ put
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
{
|
||||
\end_layout
|
||||
|
||||
@ -419,7 +419,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
framebox(0,0){
|
||||
@ -431,7 +431,7 @@ x
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -441,7 +441,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -451,7 +451,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
put
|
||||
@ -463,7 +463,7 @@ put
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
{
|
||||
\end_layout
|
||||
|
||||
@ -473,7 +473,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
line
|
||||
@ -485,7 +485,7 @@ line
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
{
|
||||
\end_layout
|
||||
|
||||
@ -495,7 +495,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -505,7 +505,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -515,7 +515,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
end{picture}
|
||||
@ -536,7 +536,7 @@ end{picture}
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
raisebox{8.5mm}{
|
||||
@ -548,7 +548,7 @@ test
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -558,7 +558,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
raisebox{-6.5mm}{
|
||||
@ -570,7 +570,7 @@ tset
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -659,7 +659,7 @@ blabla
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
fbox{
|
||||
@ -671,7 +671,7 @@ fbox
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -685,7 +685,7 @@ blabla
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
framebox{
|
||||
@ -701,7 +701,7 @@ box 1
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -765,7 +765,7 @@ This is an example text.
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
framebox{
|
||||
@ -814,7 +814,7 @@ box height.
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -936,7 +936,7 @@ doublebox
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
LyX
|
||||
\end_layout
|
||||
|
||||
@ -1070,7 +1070,7 @@ test
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
textcolor{darkgreen}
|
||||
@ -1082,7 +1082,7 @@ textcolor{darkgreen}
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
{
|
||||
\end_layout
|
||||
|
||||
@ -1092,7 +1092,7 @@ dark green
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -1106,7 +1106,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
definecolor{violet}{rgb}{0.5, 0, 1}
|
||||
@ -1122,7 +1122,7 @@ test
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
textcolor{violet}
|
||||
@ -1134,7 +1134,7 @@ textcolor{violet}
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
{
|
||||
\end_layout
|
||||
|
||||
@ -1144,7 +1144,7 @@ violet
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -1366,7 +1366,7 @@ Crossed out:
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
xout
|
||||
@ -1378,7 +1378,7 @@ xout
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
{
|
||||
\end_layout
|
||||
|
||||
@ -1388,7 +1388,7 @@ test
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -1565,7 +1565,7 @@ bla
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
centering
|
||||
@ -1589,7 +1589,7 @@ blabla
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
raggedright
|
||||
@ -1613,7 +1613,7 @@ raggedright 2 raggedright 2 raggedright 2 raggedright 2 raggedright 2 raggedrigh
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
raggedleft
|
||||
@ -1637,11 +1637,11 @@ raggedleft 2 raggedleft 2 raggedleft 2 raggedleft 2 raggedleft 2 raggedleft 2 ra
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
%set back to justified
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\end_layout
|
||||
|
||||
@ -1651,7 +1651,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
raggedright
|
||||
@ -1663,7 +1663,7 @@ raggedright
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
{}
|
||||
\end_layout
|
||||
|
||||
|
@ -56,7 +56,7 @@ def main(argv):
|
||||
else:
|
||||
files = ['test.ltx', 'test-structure.tex', 'test-insets.tex', \
|
||||
'test-modules.tex', 'box-color-size-space-align.tex', \
|
||||
'CJK.tex', 'XeTeX-polyglossia.tex']
|
||||
'CJK.tex', 'CJKutf8.tex', 'XeTeX-polyglossia.tex']
|
||||
|
||||
errors = []
|
||||
overwrite = (outputdir == inputdir)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -92,7 +92,7 @@ The lemma is not recognized as a command provided by a module, since the preambl
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
LyX
|
||||
\end_layout
|
||||
|
||||
@ -112,7 +112,7 @@ The proof is recognized as a builtin style provided by the text class.
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
begin{lem}
|
||||
@ -124,7 +124,7 @@ begin{lem}
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
end{lem}
|
||||
|
@ -118,11 +118,11 @@ Title
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
% this should be recognized as empty date:
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\end_layout
|
||||
|
||||
@ -162,7 +162,7 @@ An environment...
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
begin{foo}
|
||||
@ -174,7 +174,7 @@ begin{foo}
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
end{foo}
|
||||
@ -338,7 +338,7 @@ rotated table, spanning all columns
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
centering
|
||||
@ -350,7 +350,7 @@ centering
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
{}
|
||||
\end_layout
|
||||
|
||||
@ -516,7 +516,7 @@ fdg
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
centering
|
||||
@ -528,7 +528,7 @@ centering
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
{}
|
||||
\end_layout
|
||||
|
||||
@ -896,7 +896,7 @@ BCD second one
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
x y z
|
||||
\end_layout
|
||||
|
||||
@ -910,11 +910,11 @@ x y z
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
x y % bla
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
z
|
||||
\end_layout
|
||||
|
||||
@ -951,7 +951,7 @@ label
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
$
|
||||
\backslash
|
||||
left[
|
||||
@ -1004,7 +1004,7 @@ zzz \backslash section{
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
verb~
|
||||
@ -1018,7 +1018,7 @@ verb~
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
verb+
|
||||
@ -1032,7 +1032,7 @@ item[ABC] first item+
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
verb+something
|
||||
@ -1087,11 +1087,11 @@ The Müller Book
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
%dummy comment inserted by tex2lyx to ensure that this paragraph is not empty
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\end_layout
|
||||
|
||||
|
@ -114,11 +114,11 @@ d
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
%Midline comment
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\end_layout
|
||||
|
||||
@ -173,7 +173,7 @@ quoted
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
{
|
||||
\end_layout
|
||||
|
||||
@ -183,7 +183,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
em
|
||||
@ -234,7 +234,7 @@ I keep
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
@ -275,11 +275,11 @@ _ is a neat token.
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
% This line won't print!
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\end_layout
|
||||
|
||||
@ -374,7 +374,7 @@ Here's a
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
{
|
||||
\end_layout
|
||||
|
||||
@ -384,7 +384,7 @@ status collapsed
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
em
|
||||
@ -408,7 +408,7 @@ This
|
||||
\begin_inset ERT
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_layout Plain Layout
|
||||
}
|
||||
\end_layout
|
||||
|
||||
|
@ -519,6 +519,9 @@ void handle_ert(ostream & os, string const & s, Context & context)
|
||||
// We must have a valid layout before outputting the ERT inset.
|
||||
context.check_layout(os);
|
||||
Context newcontext(true, context.textclass);
|
||||
InsetLayout const & layout = context.textclass.insetLayout(from_ascii("ERT"));
|
||||
if (layout.forcePlainLayout())
|
||||
newcontext.layout = &context.textclass.plainLayout();
|
||||
begin_inset(os, "ERT");
|
||||
os << "\nstatus collapsed\n";
|
||||
newcontext.check_layout(os);
|
||||
@ -540,6 +543,9 @@ void handle_comment(ostream & os, string const & s, Context & context)
|
||||
{
|
||||
// TODO: Handle this better
|
||||
Context newcontext(true, context.textclass);
|
||||
InsetLayout const & layout = context.textclass.insetLayout(from_ascii("ERT"));
|
||||
if (layout.forcePlainLayout())
|
||||
newcontext.layout = &context.textclass.plainLayout();
|
||||
begin_inset(os, "ERT");
|
||||
os << "\nstatus collapsed\n";
|
||||
newcontext.check_layout(os);
|
||||
@ -1440,7 +1446,7 @@ void parse_environment(Parser & p, ostream & os, bool outer,
|
||||
}
|
||||
|
||||
else if (name == "CJK") {
|
||||
// the scheme is \begin{CJK}{encoding}{mapping}{text}
|
||||
// the scheme is \begin{CJK}{encoding}{mapping}text\end{CJK}
|
||||
// It is impossible to decide if a CJK environment was in its own paragraph or within
|
||||
// a line. We therefore always assume a paragraph since the latter is a rare case.
|
||||
eat_whitespace(p, os, parent_context, false);
|
||||
@ -1452,19 +1458,27 @@ void parse_environment(Parser & p, ostream & os, bool outer,
|
||||
// JIS does not work with LyX's encoding conversion
|
||||
if (encoding != "Bg5" && encoding != "JIS" && encoding != "SJIS")
|
||||
p.setEncoding(encoding);
|
||||
else
|
||||
else {
|
||||
// FIXME: This will read garbage, since the data is not encoded in utf8.
|
||||
p.setEncoding("utf8");
|
||||
// LyX doesn't support the second argument so if
|
||||
// this is used we need to output everything as ERT
|
||||
string const mapping = p.getArg('{', '}');
|
||||
}
|
||||
// LyX only supports the same mapping for all CJK
|
||||
// environments, so we might need to output everything as ERT
|
||||
string const mapping = trim(p.getArg('{', '}'));
|
||||
char const * const * const where =
|
||||
is_known(encoding, supported_CJK_encodings);
|
||||
if ((!mapping.empty() && mapping != " ") || !where) {
|
||||
if (!preamble.fontCJKSet())
|
||||
preamble.fontCJK(mapping);
|
||||
bool knownMapping = mapping == preamble.fontCJK();
|
||||
if (!knownMapping || !where) {
|
||||
parent_context.check_layout(os);
|
||||
handle_ert(os, "\\begin{" + name + "}{" + encoding + "}{" + mapping + "}",
|
||||
parent_context);
|
||||
// we must parse the content as verbatim because e.g. JIS can contain
|
||||
// normally invalid characters
|
||||
// FIXME: This works only for the most simple cases.
|
||||
// Since TeX control characters are not parsed,
|
||||
// things like comments are completely wrong.
|
||||
string const s = p.plainEnvironment("CJK");
|
||||
for (string::const_iterator it = s.begin(), et = s.end(); it != et; ++it) {
|
||||
if (*it == '\\')
|
||||
|
Loading…
Reference in New Issue
Block a user