return str;
}
-
+
string asValidLatexCommand(string const & input, CiteEngine const engine)
{
string const default_str = defaultCiteCommand(engine);
string output;
switch (engine) {
case ENGINE_BASIC:
- output = input;
+ if (input == "nocite")
+ output = input;
+ else
+ output = default_str;
break;
case ENGINE_NATBIB_AUTHORYEAR:
case ENGINE_NATBIB_NUMERICAL:
- if (input == "cite" || input == "citefield" ||
- input == "citetitle" || input == "cite*")
+ if (input == "cite" || input == "citefield"
+ || input == "citetitle" || input == "cite*")
output = default_str;
else if (prefixIs(input, "foot"))
output = input.substr(4);
if (!buffer.isFullyLoaded())
return docstring();
- // Cache the labels
- typedef map<Buffer const *, BiblioInfo> CachedMap;
- static CachedMap cached_keys;
-
- // and cache the timestamp of the bibliography files.
- static map<FileName, time_t> bibfileStatus;
-
- BiblioInfo biblist;
-
- support::FileNameList const & bibfilesCache = buffer.getBibfilesCache();
- // compare the cached timestamps with the actual ones.
- bool changed = false;
- support::FileNameList::const_iterator ei = bibfilesCache.begin();
- support::FileNameList::const_iterator en = bibfilesCache.end();
- for (; ei != en; ++ ei) {
- time_t lastw = ei->lastModified();
- if (lastw != bibfileStatus[*ei]) {
- changed = true;
- bibfileStatus[*ei] = lastw;
- }
- }
-
- // build the list only if the bibfiles have been changed
- if (cached_keys[&buffer].empty() || bibfileStatus.empty() || changed) {
- biblist.fillWithBibKeys(&buffer);
- cached_keys[&buffer] = biblist;
- } else {
- // use the cached keys
- biblist = cached_keys[&buffer];
- }
-
+ BiblioInfo const & biblist = buffer.masterBibInfo();
if (biblist.empty())
return docstring();
}
-void InsetCitation::addToToc(ParConstIterator const & cpit) const
+void InsetCitation::addToToc(DocIterator const & cpit)
{
Toc & toc = buffer().tocBackend().toc("citation");
toc.push_back(TocItem(cpit, 0, cache.screen_label));
}
+docstring InsetCitation::contextMenu(BufferView const &, int, int) const
+{
+ return from_ascii("context-citation");
+}
+
+
} // namespace lyx