]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBibitem.cpp
step 1
[lyx.git] / src / insets / InsetBibitem.cpp
index 1dedfafe8598bd549534830e9a2f564d98352ab6..3aaaceacbdd8d954fb53fcd1b692b4f3f75e8dd9 100644 (file)
@@ -166,12 +166,12 @@ void InsetBibitem::doDispatch(Cursor & cur, FuncRequest & cmd)
                                                if (label[previous] != '{')
                                                        label.replace(pos, 1, lbrace + brackets_escape[k] + rbrace);
                                }
+               }
 
-                       if (old_label != label) {
-                               p["label"] = label;
-                               cur.forceBufferUpdate();
-                               buffer().invalidateBibinfoCache();
-                       }
+               if (old_label != label) {
+                       p["label"] = label;
+                       cur.forceBufferUpdate();
+                       buffer().invalidateBibinfoCache();
                }
 
                setParam("label", p["label"]);
@@ -314,11 +314,14 @@ docstring bibitemWidest(Buffer const & buffer, OutputParams const & runparams)
 void InsetBibitem::collectBibKeys(InsetIterator const & it) const
 {
        docstring const key = getParam("key");
+       docstring const label = getParam("label");
        BibTeXInfo keyvalmap(false);
-       keyvalmap.label(bibLabel());
+       keyvalmap.key(key);
+       keyvalmap.label(label);
        DocIterator doc_it(it);
        doc_it.forwardPos();
-       keyvalmap[from_ascii("ref")] = doc_it.paragraph().asString();
+       keyvalmap[from_ascii("ref")] = doc_it.paragraph().asString(
+               AS_STR_INSETS | AS_STR_SKIPDELETE);
        buffer().addBibTeXInfo(key, keyvalmap);
 }