]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBibtex.cpp
InsetTabular.cpp: fix #6585 also for wrapped floats - thanks Vincent
[lyx.git] / src / insets / InsetBibtex.cpp
index 4f1e53c2a037adaf1fecb28458fe57eec617578d..ff9c6733602ea75fcb6077d3361a2f25d571835e 100644 (file)
@@ -24,6 +24,7 @@
 #include "LaTeXFeatures.h"
 #include "output_xhtml.h"
 #include "OutputParams.h"
+#include "PDFOptions.h"
 #include "TextClass.h"
 
 #include "frontends/alert.h"
@@ -51,7 +52,7 @@ namespace os = support::os;
 
 
 InsetBibtex::InsetBibtex(Buffer * buf, InsetCommandParams const & p)
-       : InsetCommand(buf, p, "bibtex")
+       : InsetCommand(buf, p)
 {
        buffer().invalidateBibinfoCache();
 }
@@ -87,8 +88,7 @@ void InsetBibtex::doDispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_INSET_MODIFY: {
                InsetCommandParams p(BIBTEX_CODE);
                try {
-                       if (!InsetCommand::string2params("bibtex", 
-                                       to_utf8(cmd.argument()), p)) {
+                       if (!InsetCommand::string2params(to_utf8(cmd.argument()), p)) {
                                cur.noScreenUpdate();
                                break;
                        }
@@ -281,12 +281,20 @@ int InsetBibtex::latex(odocstream & os, OutputParams const & runparams) const
                                       << "' to '" << out_file << "'"
                                       << endl;
                        }
-               } else if (!runparams.inComment && runparams.nice && not_from_texmf &&
-                          !isValidLaTeXFileName(database)) {
+               } else if (!runparams.inComment && runparams.nice && not_from_texmf) {
+                       if (!isValidLaTeXFileName(database)) {
                                frontend::Alert::warning(_("Invalid filename"),
-                                                        _("The following filename is likely to cause trouble "
-                                                          "when running the exported file through LaTeX: ") +
-                                                           from_utf8(database));
+                                        _("The following filename will cause troubles "
+                                              "when running the exported file through LaTeX: ") +
+                                            from_utf8(database));
+                       }
+                       if (!isValidDVIFileName(database)) {
+                               frontend::Alert::warning(_("Problematic filename for DVI"),
+                                        _("The following filename can cause troubles "
+                                              "when running the exported file through LaTeX "
+                                                  "and opening the resulting DVI: ") +
+                                            from_utf8(database), true);
+                       }
                }
 
                if (didone)
@@ -371,16 +379,12 @@ int InsetBibtex::latex(odocstream & os, OutputParams const & runparams) const
 
        // bibtotoc-Option
        if (!bibtotoc.empty() && !buffer().params().use_bibtopic) {
-               if (buffer().params().documentClass().hasLaTeXLayout("chapter")) {
-                       if (buffer().params().sides == OneSide) {
-                               // oneside
-                               os << "\\clearpage";
-                       } else {
-                               // twoside
-                               os << "\\cleardoublepage";
-                       }
+               // set label for hyperref, see http://www.lyx.org/trac/ticket/6470
+               if (buffer().params().pdfoptions().use_hyperref)
+                               os << "\\phantomsection";
+               if (buffer().params().documentClass().hasLaTeXLayout("chapter"))
                        os << "\\addcontentsline{toc}{chapter}{\\bibname}";
-               else if (buffer().params().documentClass().hasLaTeXLayout("section"))
+               else if (buffer().params().documentClass().hasLaTeXLayout("section"))
                        os << "\\addcontentsline{toc}{section}{\\refname}";
        }
 
@@ -969,6 +973,7 @@ docstring InsetBibtex::xhtml(XHTMLStream & xs, OutputParams const &) const
                // which will give us all the cross-referenced info. But for every
                // entry, so there's a lot of repitition. This should be fixed.
                xs << html::StartTag("span", "class='bibtexinfo'") 
+                       << XHTMLStream::NextRaw()
                        << bibinfo.getInfo(entry.key(), buffer(), true)
                        << html::EndTag("span")
                        << html::EndTag("div");