]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBibitem.cpp
Pure HTML output for math macros.
[lyx.git] / src / insets / InsetBibitem.cpp
index fc158a02334c3ef7c14263e24cc1aa1fa380becf..434bd4c8b748c7721218ec362a2f7c455d40d6ca 100644 (file)
@@ -62,7 +62,7 @@ InsetBibitem::InsetBibitem(Buffer * buf, InsetCommandParams const & p)
 
 InsetBibitem::~InsetBibitem()
 {
-       if (isBufferValid())
+       if (isBufferLoaded())
                buffer_->invalidateBibinfoCache();
 }
 
@@ -75,7 +75,6 @@ void InsetBibitem::initView()
 
 void InsetBibitem::updateCommand(docstring const & new_key, bool)
 {
-       docstring const old_key = getParam("key");
        docstring key = new_key;
 
        vector<docstring> bibkeys = buffer().masterBibInfo().getKeys();
@@ -95,7 +94,7 @@ void InsetBibitem::updateCommand(docstring const & new_key, bool)
        }
        setParam("key", key);
 
-       buffer().updateLabels();
+       buffer().updateBuffer();
 }
 
 
@@ -103,8 +102,10 @@ ParamInfo const & InsetBibitem::findInfo(string const & /* cmdName */)
 {
        static ParamInfo param_info_;
        if (param_info_.empty()) {
-               param_info_.add("label", ParamInfo::LATEX_OPTIONAL);
-               param_info_.add("key", ParamInfo::LATEX_REQUIRED);
+               param_info_.add("label", ParamInfo::LATEX_OPTIONAL,
+                               ParamInfo::HANDLING_LATEXIFY);
+               param_info_.add("key", ParamInfo::LATEX_REQUIRED,
+                               ParamInfo::HANDLING_ESCAPE);
        }
        return param_info_;
 }
@@ -175,46 +176,6 @@ int InsetBibitem::plaintext(odocstream & os, OutputParams const &) const
 }
 
 
-int InsetBibitem::latex(odocstream & os, OutputParams const & runparams) const
-{
-       docstring cmd = '\\' + from_ascii(defaultCommand());
-       docstring uncodable;
-       if (!getParam("label").empty()) {
-               cmd += '[';
-               docstring orig = getParam("label");
-               for (size_t n = 0; n < orig.size(); ++n) {
-                       try {
-                               cmd += runparams.encoding->latexChar(orig[n]);
-                       } catch (EncodingException & /* e */) {
-                               LYXERR0("Uncodable character in bibitem!");
-                               if (runparams.dryrun) {
-                                       cmd += "<" + _("LyX Warning: ")
-                                           + _("uncodable character") + " '";
-                                       cmd += docstring(1, orig[n]);
-                                       cmd += "'>";
-                               } else
-                                       uncodable += orig[n];
-                       }
-               }
-               cmd += ']';
-       }
-       cmd += '{' + escape(getParam("key")) + '}';
-
-       os << cmd;
-
-       if (!uncodable.empty()) {
-               // issue a warning about omitted characters
-               // FIXME: should be passed to the error dialog
-               frontend::Alert::warning(_("Uncodable characters in bibliography item"),
-                       bformat(_("The following characters in one of the bibliography items are\n"
-                                 "not representable in the current encoding and have been omitted:\n%1$s."),
-                       uncodable));
-       }
-       
-       return 0;
-}
-
-
 // ale070405
 docstring bibitemWidest(Buffer const & buffer, OutputParams const & runparams)
 {
@@ -311,7 +272,7 @@ void InsetBibitem::fillWithBibKeys(BiblioInfo & keys, InsetIterator const & it)
 
 
 // Update the counters of this inset and of its contents
-void InsetBibitem::updateLabels(ParIterator const & it, UpdateType utype)
+void InsetBibitem::updateBuffer(ParIterator const & it, UpdateType utype)
 {
        BufferParams const & bp = buffer().masterBuffer()->params();
        Counters & counters = bp.documentClass().counters();