mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Fix display of BibTeX entries in the info field of the citation
dialog by only converting text mode latex macros to unicode points. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30070 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ebda762af9
commit
411b7a1dec
@ -170,7 +170,8 @@ docstring convertLaTeXCommands(docstring const & str)
|
||||
val.insert(2, from_ascii("{"));
|
||||
}
|
||||
docstring rem;
|
||||
docstring const cnvtd = Encodings::fromLaTeXCommand(val, rem);
|
||||
docstring const cnvtd = Encodings::fromLaTeXCommand(val, rem,
|
||||
Encodings::TEXT_CMD);
|
||||
if (!cnvtd.empty()) {
|
||||
// it did, so we'll take that bit and proceed with what's left
|
||||
ret += cnvtd;
|
||||
|
@ -436,8 +436,11 @@ char_type Encodings::fromLaTeXCommand(docstring const & cmd, bool & combining)
|
||||
}
|
||||
|
||||
|
||||
docstring Encodings::fromLaTeXCommand(docstring const & cmd, docstring & rem)
|
||||
docstring Encodings::fromLaTeXCommand(docstring const & cmd, docstring & rem,
|
||||
int cmdtype)
|
||||
{
|
||||
bool const mathmode = cmdtype & MATH_CMD;
|
||||
bool const textmode = cmdtype & TEXT_CMD;
|
||||
docstring symbols;
|
||||
size_t i = 0;
|
||||
size_t const cmdend = cmd.size();
|
||||
@ -468,8 +471,10 @@ docstring Encodings::fromLaTeXCommand(docstring const & cmd, docstring & rem)
|
||||
size_t unicmd_size = 0;
|
||||
char_type c = 0;
|
||||
for (; it != uniend; ++it) {
|
||||
docstring const math = it->second.mathcommand;
|
||||
docstring const text = it->second.textcommand;
|
||||
docstring const math = mathmode ? it->second.mathcommand
|
||||
: docstring();
|
||||
docstring const text = textmode ? it->second.textcommand
|
||||
: docstring();
|
||||
size_t cur_size = max(math.size(), text.size());
|
||||
// The current math or text unicode command cannot
|
||||
// match, or we already matched a longer one
|
||||
|
@ -233,13 +233,23 @@ public:
|
||||
* point and set \p combining to true if it is a combining symbol
|
||||
*/
|
||||
static char_type fromLaTeXCommand(docstring const & cmd, bool & combining);
|
||||
///
|
||||
enum LatexCmd {
|
||||
///
|
||||
MATH_CMD = 1,
|
||||
///
|
||||
TEXT_CMD = 2
|
||||
};
|
||||
/**
|
||||
* Convert the LaTeX commands in \p cmd and \return a docstring
|
||||
* of corresponding unicode points. The conversion stops at the
|
||||
* first command which could not be converted, and the remaining
|
||||
* unconverted commands are returned in \p rem
|
||||
* unconverted commands are returned in \p rem.
|
||||
* The \p cmdtype parameter can be used to limit recognized
|
||||
* commands to math or text mode commands only.
|
||||
*/
|
||||
static docstring fromLaTeXCommand(docstring const & cmd, docstring & rem);
|
||||
static docstring fromLaTeXCommand(docstring const & cmd,
|
||||
docstring & rem, int cmdtype = MATH_CMD | TEXT_CMD);
|
||||
/**
|
||||
* Add the preamble snippet needed for the output of \p c to
|
||||
* \p features.
|
||||
|
Loading…
Reference in New Issue
Block a user