mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
use docstring for textclass preambles
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15808 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
02b05759ac
commit
ef2fda7500
@ -481,11 +481,11 @@ string const LaTeXFeatures::getBabelOptions() const
|
||||
}
|
||||
|
||||
|
||||
string const LaTeXFeatures::getTClassPreamble() const
|
||||
docstring const LaTeXFeatures::getTClassPreamble() const
|
||||
{
|
||||
// the text class specific preamble
|
||||
LyXTextClass const & tclass = params_.getLyXTextClass();
|
||||
ostringstream tcpreamble;
|
||||
odocstringstream tcpreamble;
|
||||
|
||||
tcpreamble << tclass.preamble();
|
||||
|
||||
@ -539,7 +539,7 @@ void LaTeXFeatures::showStruct() const {
|
||||
lyxerr << "LyX needs the following commands when LaTeXing:"
|
||||
<< "\n***** Packages:" << getPackages()
|
||||
<< "\n***** Macros:" << getMacros()
|
||||
<< "\n***** Textclass stuff:" << getTClassPreamble()
|
||||
<< "\n***** Textclass stuff:" << to_utf8(getTClassPreamble())
|
||||
<< "\n***** done." << endl;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
///
|
||||
std::string const getBabelOptions() const;
|
||||
/// The definitions needed by the document's textclass
|
||||
std::string const getTClassPreamble() const;
|
||||
docstring const getTClassPreamble() const;
|
||||
/// The sgml definitions needed by the document (docbook)
|
||||
docstring const getLyXSGMLEntities() const;
|
||||
/// The SGML Required to include the files added with includeFile();
|
||||
|
@ -1012,13 +1012,13 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
|
||||
// Now insert the LyX specific LaTeX commands...
|
||||
|
||||
// The optional packages;
|
||||
string lyxpreamble(features.getPackages());
|
||||
docstring lyxpreamble(from_ascii(features.getPackages()));
|
||||
|
||||
// this might be useful...
|
||||
lyxpreamble += "\n\\makeatletter\n";
|
||||
|
||||
// Some macros LyX will need
|
||||
string tmppreamble(features.getMacros());
|
||||
docstring tmppreamble(from_ascii(features.getMacros()));
|
||||
|
||||
if (!tmppreamble.empty()) {
|
||||
lyxpreamble += "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
|
||||
@ -1036,9 +1036,10 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
|
||||
|
||||
/* the user-defined preamble */
|
||||
if (!preamble.empty()) {
|
||||
// FIXME UNICODE
|
||||
lyxpreamble += "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
|
||||
"User specified LaTeX commands.\n"
|
||||
+ preamble + '\n';
|
||||
+ from_utf8(preamble) + '\n';
|
||||
}
|
||||
|
||||
// Itemize bullet settings need to be last in case the user
|
||||
@ -1047,11 +1048,11 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
|
||||
// Actually it has to be done much later than that
|
||||
// since some packages like frenchb make modifications
|
||||
// at \begin{document} time -- JMarc
|
||||
string bullets_def;
|
||||
docstring bullets_def;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (user_defined_bullet(i) != ITEMIZE_DEFAULTS[i]) {
|
||||
if (bullets_def.empty())
|
||||
bullets_def="\\AtBeginDocument{\n";
|
||||
bullets_def += "\\AtBeginDocument{\n";
|
||||
bullets_def += " \\def\\labelitemi";
|
||||
switch (i) {
|
||||
// `i' is one less than the item to modify
|
||||
@ -1067,9 +1068,8 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
|
||||
bullets_def += 'v';
|
||||
break;
|
||||
}
|
||||
// FIXME UNICODE
|
||||
bullets_def += '{' +
|
||||
lyx::to_ascii(user_defined_bullet(i).getText())
|
||||
user_defined_bullet(i).getText()
|
||||
+ "}\n";
|
||||
}
|
||||
}
|
||||
@ -1081,8 +1081,9 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
|
||||
// with other packages.
|
||||
// Jurabib has to be called after babel, though.
|
||||
if (use_babel && !features.isRequired("jurabib")) {
|
||||
lyxpreamble += babelCall(language_options.str()) + '\n';
|
||||
lyxpreamble += features.getBabelOptions();
|
||||
// FIXME UNICODE
|
||||
lyxpreamble += from_utf8(babelCall(language_options.str())) + '\n';
|
||||
lyxpreamble += from_utf8(features.getBabelOptions());
|
||||
}
|
||||
|
||||
lyxpreamble += "\\makeatother\n";
|
||||
@ -1103,8 +1104,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
|
||||
texrow.newline();
|
||||
}
|
||||
|
||||
// FIXME UNICODE
|
||||
os << from_utf8(lyxpreamble);
|
||||
os << lyxpreamble;
|
||||
return use_babel;
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,7 @@ bool LyXLayout::read(LyXLex & lexrc, LyXTextClass const & tclass)
|
||||
break;
|
||||
|
||||
case LT_PREAMBLE:
|
||||
preamble_ = lexrc.getLongString("EndPreamble");
|
||||
preamble_ = from_utf8(lexrc.getLongString("EndPreamble"));
|
||||
break;
|
||||
|
||||
case LT_LABELTYPE:
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
///
|
||||
lyx::docstring const & endlabelstring() const { return endlabelstring_; }
|
||||
///
|
||||
std::string const & preamble() const { return preamble_; }
|
||||
docstring const & preamble() const { return preamble_; }
|
||||
///
|
||||
std::string const & latexparam() const { return latexparam_; }
|
||||
///
|
||||
@ -226,7 +226,7 @@ private:
|
||||
/// Internal tag to surround the item text in a list)
|
||||
std::string itemtag_;
|
||||
/// Macro definitions needed for this layout
|
||||
std::string preamble_;
|
||||
docstring preamble_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -379,7 +379,7 @@ bool LyXTextClass::read(string const & filename, bool merge)
|
||||
break;
|
||||
|
||||
case TC_PREAMBLE:
|
||||
preamble_ = lexrc.getLongString("EndPreamble");
|
||||
preamble_ = from_utf8(lexrc.getLongString("EndPreamble"));
|
||||
break;
|
||||
|
||||
case TC_PROVIDESAMSMATH:
|
||||
@ -681,7 +681,7 @@ void LyXTextClass::readCharStyle(LyXLex & lexrc, string const & name)
|
||||
cs.latexparam = latexparam;
|
||||
cs.font = font;
|
||||
cs.labelfont = labelfont;
|
||||
cs.preamble = preamble;
|
||||
cs.preamble = from_utf8(preamble);
|
||||
charstyles().push_back(cs);
|
||||
}
|
||||
|
||||
@ -1036,7 +1036,7 @@ string const & LyXTextClass::pagestyle() const
|
||||
}
|
||||
|
||||
|
||||
string const & LyXTextClass::preamble() const
|
||||
docstring const & LyXTextClass::preamble() const
|
||||
{
|
||||
return preamble_;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
std::string latexparam;
|
||||
LyXFont font;
|
||||
LyXFont labelfont;
|
||||
std::string preamble;
|
||||
docstring preamble;
|
||||
};
|
||||
|
||||
|
||||
@ -122,7 +122,7 @@ public:
|
||||
///
|
||||
std::string const & pagestyle() const;
|
||||
///
|
||||
std::string const & preamble() const;
|
||||
docstring const & preamble() const;
|
||||
|
||||
/// Packages that are already loaded by the class
|
||||
enum Provides {
|
||||
@ -205,7 +205,7 @@ private:
|
||||
///
|
||||
std::string defaultlayout_;
|
||||
/// preamble text to support layout styles
|
||||
std::string preamble_;
|
||||
docstring preamble_;
|
||||
/// latex packages loaded by document class.
|
||||
Provides provides_;
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user