mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
parent
a042d6a9d2
commit
823d290036
@ -915,7 +915,8 @@ docstring BibTeXInfo::expandFormat(docstring const & format,
|
||||
|
||||
|
||||
docstring const & BibTeXInfo::getInfo(BibTeXInfoList const & xrefs,
|
||||
Buffer const & buf, CiteItem const & ci, docstring const & format_in) const
|
||||
Buffer const & buf, CiteItem const & ci, docstring const & format_in,
|
||||
bool const for_xhtml) const
|
||||
{
|
||||
bool const richtext = ci.richtext;
|
||||
|
||||
@ -933,7 +934,7 @@ docstring const & BibTeXInfo::getInfo(BibTeXInfoList const & xrefs,
|
||||
}
|
||||
|
||||
if (!richtext && !info_.empty()) {
|
||||
info_ = Encodings::convertLaTeXCommands(processRichtext(info_, false));
|
||||
info_ = Encodings::convertLaTeXCommands(processRichtext(info_, false), for_xhtml);
|
||||
return info_;
|
||||
}
|
||||
if (richtext && !info_richtext_.empty())
|
||||
@ -955,11 +956,11 @@ docstring const & BibTeXInfo::getInfo(BibTeXInfoList const & xrefs,
|
||||
}
|
||||
|
||||
if (richtext) {
|
||||
info_richtext_ = Encodings::convertLaTeXCommands(processRichtext(info_, true));
|
||||
info_richtext_ = Encodings::convertLaTeXCommands(processRichtext(info_, true), for_xhtml);
|
||||
return info_richtext_;
|
||||
}
|
||||
|
||||
info_ = Encodings::convertLaTeXCommands(processRichtext(info_, false));
|
||||
info_ = Encodings::convertLaTeXCommands(processRichtext(info_, false), for_xhtml);
|
||||
return info_;
|
||||
}
|
||||
|
||||
@ -1376,7 +1377,7 @@ docstring const BiblioInfo::getYear(docstring const & key, Buffer const & buf, b
|
||||
|
||||
|
||||
docstring const BiblioInfo::getInfo(docstring const & key,
|
||||
Buffer const & buf, CiteItem const & ci, docstring const & format) const
|
||||
Buffer const & buf, CiteItem const & ci, docstring const & format, bool const for_xhtml) const
|
||||
{
|
||||
BiblioInfo::const_iterator it = find(key);
|
||||
if (it == end())
|
||||
@ -1388,7 +1389,7 @@ docstring const BiblioInfo::getInfo(docstring const & key,
|
||||
if (xrefit != end())
|
||||
xrefptrs.push_back(&(xrefit->second));
|
||||
}
|
||||
return data.getInfo(xrefptrs, buf, ci, format);
|
||||
return data.getInfo(xrefptrs, buf, ci, format, for_xhtml);
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,7 +81,8 @@ public:
|
||||
/// \param vector of pointers to crossref/xdata information
|
||||
docstring const & getInfo(BibTeXInfoList const & xrefs,
|
||||
Buffer const & buf, CiteItem const & ci,
|
||||
docstring const & format = docstring()) const;
|
||||
docstring const & format = docstring(),
|
||||
bool const for_xhtml = false) const;
|
||||
/// \return formatted BibTeX data for a citation label
|
||||
docstring const getLabel(BibTeXInfoList const & xrefs,
|
||||
Buffer const & buf, docstring const & format,
|
||||
@ -236,7 +237,8 @@ public:
|
||||
/// output any richtext tags marked in the citation format and escape < and >
|
||||
/// elsewhere, and the general output context.
|
||||
docstring const getInfo(docstring const & key, Buffer const & buf,
|
||||
CiteItem const & ci, docstring const & format = docstring()) const;
|
||||
CiteItem const & ci, docstring const & format = docstring(),
|
||||
bool const for_xhtml = false) const;
|
||||
/// \return formatted BibTeX data for citation labels.
|
||||
/// Citation labels can have more than one key.
|
||||
docstring const getLabel(std::vector<docstring> keys, Buffer const & buf,
|
||||
|
@ -614,7 +614,7 @@ docstring Encodings::fromLaTeXCommand(docstring const & cmd, int cmdtype,
|
||||
}
|
||||
|
||||
|
||||
docstring Encodings::convertLaTeXCommands(docstring const & str)
|
||||
docstring Encodings::convertLaTeXCommands(docstring const & str, bool const for_xhtml)
|
||||
{
|
||||
docstring val = str;
|
||||
docstring ret;
|
||||
@ -630,6 +630,20 @@ docstring Encodings::convertLaTeXCommands(docstring const & str)
|
||||
// if we're scanning math, we collect everything until we
|
||||
// find an unescaped $, and then try to convert this piecewise.
|
||||
if (scanning_math) {
|
||||
if (for_xhtml) {
|
||||
// with xhtml, we output everything until we
|
||||
// find an unescaped $, at which point we break out.
|
||||
if (escaped)
|
||||
escaped = false;
|
||||
else if (ch == '\\')
|
||||
escaped = true;
|
||||
else if (ch == '$')
|
||||
scanning_math = false;
|
||||
ret += ch;
|
||||
val = val.substr(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (escaped)
|
||||
escaped = false;
|
||||
else if (ch == '\\')
|
||||
|
@ -351,7 +351,8 @@ public:
|
||||
std::set<std::string> * req = nullptr);
|
||||
/// converts a string containing LaTeX commands into unicode
|
||||
/// for display.
|
||||
static docstring convertLaTeXCommands(docstring const & str);
|
||||
static docstring convertLaTeXCommands(docstring const & str,
|
||||
bool const for_xhtml = false);
|
||||
///
|
||||
enum LatexCmd {
|
||||
///
|
||||
|
@ -1075,7 +1075,7 @@ docstring InsetBibtex::xhtml(XMLStream & xs, OutputParams const &) const
|
||||
// entry, so there's a lot of repetition. This should be fixed.
|
||||
xs << xml::StartTag("span", "class='bibtexinfo'")
|
||||
<< XMLStream::ESCAPE_AND
|
||||
<< bibinfo.getInfo(entry.key(), buffer(), ci)
|
||||
<< bibinfo.getInfo(entry.key(), buffer(), ci, docstring(), true)
|
||||
<< xml::EndTag("span")
|
||||
<< xml::EndTag("div")
|
||||
<< xml::CR();
|
||||
|
Loading…
Reference in New Issue
Block a user