]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetCitation.cpp
Implement display of starred cite commands
[lyx.git] / src / insets / InsetCitation.cpp
index 94a1592ee3c9abb579d9f4a0eed83c06b09668f7..e47f31189feddf44a1d922466ff7a3c663b60553 100644 (file)
@@ -156,14 +156,16 @@ docstring InsetCitation::toolTip(BufferView const & bv, int, int) const
        if (key.empty())
                return _("No citations selected!");
 
+       CiteItem ci;
+       ci.richtext = true;
        vector<docstring> keys = getVectorFromString(key);
        if (keys.size() == 1)
-               return bi.getInfo(keys[0], buffer(), true);
+               return bi.getInfo(keys[0], buffer(), ci);
 
        docstring tip;
        tip += "<ol>";
        for (docstring const & key : keys) {
-               docstring const key_info = bi.getInfo(key, buffer(), true);
+               docstring const key_info = bi.getInfo(key, buffer(), ci);
                if (key_info.empty())
                        continue;
                tip += "<li>" + key_info + "</li>";
@@ -175,7 +177,6 @@ docstring InsetCitation::toolTip(BufferView const & bv, int, int) const
 
 namespace {
 
-
 CitationStyle asValidLatexCommand(BufferParams const & bp, string const & input,
                                  vector<CitationStyle> const & valid_styles)
 {
@@ -252,13 +253,12 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const
        if (key.empty())
                return _("No citations selected!");
 
-       // We don't currently use the full or forceUCase fields.
        string cite_type = getCmdName();
-       if (isUpperCase(cite_type[0]))
-               // If we were going to use them, this would mean ForceUCase
+       bool const uppercase = isUpperCase(cite_type[0]);
+       if (uppercase)
                cite_type[0] = lowercase(cite_type[0]);
-       if (cite_type[cite_type.size() - 1] == '*')
-               // and this would mean FULL
+       bool const starred = (cite_type[cite_type.size() - 1] == '*');
+       if (starred)
                cite_type = cite_type.substr(0, cite_type.size() - 1);
 
        // handle alias
@@ -266,9 +266,6 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const
        if (!alias.empty())
                cite_type = alias;
 
-       docstring const & before = getParam("before");
-       docstring const & after = getParam("after");
-
        // FIXME: allow to add cite macros
        /*
        buffer().params().documentClass().addCiteMacro("!textbefore", to_utf8(before));
@@ -276,7 +273,18 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const
        */
        docstring label;
        vector<docstring> keys = getVectorFromString(key);
-       label = biblist.getLabel(keys, buffer(), cite_type, for_xhtml, UINT_MAX, before, after);
+       CiteItem ci;
+       ci.textBefore = getParam("before");
+       ci.textAfter = getParam("after");
+       ci.forceUpperCase = uppercase;
+       ci.Starred = starred;
+       ci.max_size = UINT_MAX;
+       if (for_xhtml) {
+               ci.max_key_size = UINT_MAX;
+               ci.context = CiteItem::Export;
+       }
+       ci.richtext = for_xhtml;
+       label = biblist.getLabel(keys, buffer(), cite_type, ci);
        return label;
 }