mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Replace hardcoded hack with InsetLayout tag
This commit is contained in:
parent
6e519e7727
commit
eb121f9993
@ -1,5 +1,5 @@
|
||||
#LyX 2.2 created this file. For more info see http://www.lyx.org/
|
||||
\lyxformat 479
|
||||
\lyxformat 480
|
||||
\begin_document
|
||||
\begin_header
|
||||
\textclass scrbook
|
||||
@ -151,6 +151,7 @@ End
|
||||
\html_css_as_file 0
|
||||
\html_be_strict true
|
||||
\author -712698321 "Jürgen Spitzmüller"
|
||||
\author -195340706 "Georg Baum"
|
||||
\author 274215730 "scott"
|
||||
\end_header
|
||||
|
||||
@ -16901,6 +16902,86 @@ LabelFont
|
||||
\end_inset
|
||||
|
||||
later if you want them to be different.
|
||||
\change_inserted -195340706 1421002157
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
||||
\change_inserted -195340706 1421002157
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -195340706 1421002157
|
||||
FixedWidthPreambleEncoding
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
[
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -195340706 1421002157
|
||||
|
||||
\emph on
|
||||
0
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
,
|
||||
\begin_inset space \thinspace{}
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -195340706 1421002157
|
||||
1
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
] Force a fixed width encoding for the translated contents of
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -195340706 1421002157
|
||||
BabelPreamble
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
and
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -195340706 1421002157
|
||||
LangPreamble
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
code generated by this layout.
|
||||
This is needed for special packages like the listings package that do not
|
||||
work with variable width encodings such as utf8.
|
||||
Default is false.
|
||||
This setting is ignored if fully unicode aware LaTeX backends such as XeLaTeX
|
||||
are used.
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Detailed format description is available in the customization manual
|
||||
|
||||
Format 53
|
||||
Format 54
|
||||
|
||||
Provides stdinsets 1
|
||||
|
||||
@ -267,6 +267,7 @@ InsetLayout TOC:Listings
|
||||
LangPreamble
|
||||
\renewcommand{\lstlistlistingname}{_(Listings[[List of Listings]])}
|
||||
EndLangPreamble
|
||||
FixedWidthPreambleEncoding true
|
||||
HTMLTag h2
|
||||
HTMLStyle
|
||||
div.lyxtoc-flat {
|
||||
@ -287,6 +288,7 @@ InsetLayout Include:Listings
|
||||
LangPreamble
|
||||
\renewcommand{\lstlistingname}{_(Listing)}
|
||||
EndLangPreamble
|
||||
FixedWidthPreambleEncoding true
|
||||
End
|
||||
|
||||
InsetLayout Listings
|
||||
|
@ -177,6 +177,9 @@ import os, re, string, sys
|
||||
# Incremented to format 53, 7 December 2014 by spitz
|
||||
# New InsetLayout tag "ObsoletedBy"
|
||||
|
||||
# Incremented to format 54, 11 Jan 2014 by gb
|
||||
# New InsetLayout tag "FixedWidthPreambleEncoding"
|
||||
|
||||
# Do not forget to document format change in Customization
|
||||
# Manual (section "Declaring a new text class").
|
||||
|
||||
@ -184,7 +187,7 @@ import os, re, string, sys
|
||||
# development/tools/updatelayouts.py script to update all
|
||||
# layout files to the new format.
|
||||
|
||||
currentFormat = 53
|
||||
currentFormat = 54
|
||||
|
||||
|
||||
def usage(prog_name):
|
||||
@ -408,7 +411,7 @@ def convert(lines):
|
||||
i += 1
|
||||
continue
|
||||
|
||||
if format >= 50 and format <= 52:
|
||||
if format >= 50 and format <= 53:
|
||||
# nothing to do.
|
||||
i += 1
|
||||
continue
|
||||
|
@ -1569,11 +1569,7 @@ docstring const LaTeXFeatures::getTClassI18nPreamble(bool use_babel, bool use_po
|
||||
// need to force a fixed width encoding for
|
||||
// \lstlistlistingname and \lstlistingname (bug 9382).
|
||||
// This needs to be consistent with InsetListings::latex().
|
||||
docstring const ilname = it->second.name();
|
||||
bool const need_fixedwidth = !runparams_.isFullUnicode() &&
|
||||
(ilname == "Listings" ||
|
||||
ilname == "Include:Listings" ||
|
||||
ilname == "TOC:Listings");
|
||||
bool const need_fixedwidth = it->second.fixedwidthpreambleencoding();
|
||||
// language dependent commands (once per document)
|
||||
snippets.insert(i18npreamble(it->second.langpreamble(),
|
||||
buffer().language(),
|
||||
|
@ -61,7 +61,7 @@ namespace lyx {
|
||||
// You should also run the development/tools/updatelayouts.py script,
|
||||
// to update the format of all of our layout files.
|
||||
//
|
||||
int const LAYOUT_FORMAT = 53; //spitz: add ObsoletedBy tag for InsetLayouts
|
||||
int const LAYOUT_FORMAT = 54; //gb: add FixedWidthPreambleEncoding tag for InsetLayouts
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -36,12 +36,13 @@ InsetLayout::InsetLayout() :
|
||||
labelstring_(from_ascii("UNDEFINED")), contentaslabel_(false),
|
||||
decoration_(DEFAULT), latextype_(NOLATEXTYPE), font_(inherit_font),
|
||||
labelfont_(sane_font), bgcolor_(Color_error),
|
||||
htmlforcecss_ (false), htmlisblock_(true),
|
||||
multipar_(true), custompars_(true), forceplain_(false),
|
||||
passthru_(false), parbreakisnewline_(false), freespacing_(false),
|
||||
keepempty_(false), forceltr_(false), forceownlines_(false),
|
||||
needprotect_(false), intoc_(false), spellcheck_(true),
|
||||
resetsfont_(false), display_(true), forcelocalfontswitch_(false)
|
||||
fixedwidthpreambleencoding_(false), htmlforcecss_ (false),
|
||||
htmlisblock_(true), multipar_(true), custompars_(true),
|
||||
forceplain_(false), passthru_(false), parbreakisnewline_(false),
|
||||
freespacing_(false), keepempty_(false), forceltr_(false),
|
||||
forceownlines_(false), needprotect_(false), intoc_(false),
|
||||
spellcheck_(true), resetsfont_(false), display_(true),
|
||||
forcelocalfontswitch_(false)
|
||||
{
|
||||
labelfont_.setColor(Color_error);
|
||||
}
|
||||
@ -86,6 +87,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
|
||||
IL_CUSTOMPARS,
|
||||
IL_DECORATION,
|
||||
IL_DISPLAY,
|
||||
IL_FIXEDWIDTH_PREAMBLE_ENCODING,
|
||||
IL_FONT,
|
||||
IL_FORCE_LOCAL_FONT_SWITCH,
|
||||
IL_FORCELTR,
|
||||
@ -138,6 +140,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
|
||||
{ "decoration", IL_DECORATION },
|
||||
{ "display", IL_DISPLAY },
|
||||
{ "end", IL_END },
|
||||
{ "fixedwidthpreambleencoding", IL_FIXEDWIDTH_PREAMBLE_ENCODING },
|
||||
{ "font", IL_FONT },
|
||||
{ "forcelocalfontswitch", IL_FORCE_LOCAL_FONT_SWITCH },
|
||||
{ "forceltr", IL_FORCELTR },
|
||||
@ -246,6 +249,9 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
|
||||
leftdelim_ = support::subst(leftdelim_, from_ascii("<br/>"),
|
||||
from_ascii("\n"));
|
||||
break;
|
||||
case IL_FIXEDWIDTH_PREAMBLE_ENCODING:
|
||||
lex >> fixedwidthpreambleencoding_;
|
||||
break;
|
||||
case IL_FORCE_LOCAL_FONT_SWITCH:
|
||||
lex >> forcelocalfontswitch_;
|
||||
break;
|
||||
@ -462,7 +468,6 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
|
||||
|
||||
InsetLayout::InsetLyXType translateLyXType(std::string const & str)
|
||||
{
|
||||
|
||||
if (support::compare_ascii_no_case(str, "charstyle") == 0)
|
||||
return InsetLayout::CHARSTYLE;
|
||||
if (support::compare_ascii_no_case(str, "custom") == 0)
|
||||
|
@ -108,6 +108,8 @@ public:
|
||||
/// this inset
|
||||
docstring const babelpreamble() const { return babelpreamble_; }
|
||||
///
|
||||
bool fixedwidthpreambleencoding() const { return fixedwidthpreambleencoding_; }
|
||||
///
|
||||
docstring counter() const { return counter_; }
|
||||
///
|
||||
docstring refprefix() const { return refprefix_; }
|
||||
@ -223,6 +225,8 @@ private:
|
||||
/// Language and babel dependent macro definitions needed for this inset
|
||||
docstring babelpreamble_;
|
||||
///
|
||||
bool fixedwidthpreambleencoding_;
|
||||
///
|
||||
docstring refprefix_;
|
||||
///
|
||||
mutable std::string htmltag_;
|
||||
|
Loading…
Reference in New Issue
Block a user