]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetCommandParams.cpp
Fix mis-nomer
[lyx.git] / src / insets / InsetCommandParams.cpp
index 074bd3adae14b19c38315d103390aa2dab540be7..931e1bb09376111ee656618b3956beffb678d170 100644 (file)
@@ -12,6 +12,8 @@
 
 #include <config.h>
 #include <algorithm>
+#include <functional>
+
 
 #include "InsetCommandParams.h"
 
@@ -276,6 +278,12 @@ void InsetCommandParams::setCmdName(string const & name)
 
 
 void InsetCommandParams::read(Lexer & lex)
+{
+       Read(lex, 0);
+}
+
+
+void InsetCommandParams::Read(Lexer & lex, Buffer const * buffer)
 {
        lex.setContext("InsetCommandParams::read");
        lex >> insetName(insetCode_).c_str();
@@ -302,7 +310,25 @@ void InsetCommandParams::read(Lexer & lex)
                }
                if (info_.hasParam(token)) {
                        lex.next(true);
-                       params_[token] = lex.getDocString();
+                       docstring data = lex.getDocString();
+                       if (buffer && token == "filename") {
+                               data = from_utf8(buffer->includedFilePath(to_utf8(data)));
+                       } else if (buffer && token == "bibfiles") {
+                               int i = 0;
+                               docstring newdata;
+                               docstring bib = support::token(data, ',', i);
+                               while (!bib.empty()) {
+                                       bib = from_utf8(buffer->includedFilePath(to_utf8(bib), "bib"));
+                                       if (!newdata.empty())
+                                               newdata.append(1, ',');
+                                       newdata.append(bib);
+                                       bib = support::token(data, ',', ++i);
+                               }
+                               data = newdata;
+                       } else if (buffer && token == "options") {
+                               data = from_utf8(buffer->includedFilePath(to_utf8(data), "bst"));
+                       }
+                       params_[token] = data;
                } else {
                        lex.printError("Unknown parameter name `$$Token' for command " + cmdName_);
                        throw ExceptionMessage(WarningException,
@@ -353,6 +379,8 @@ void InsetCommandParams::Write(ostream & os, Buffer const * buffer) const
                                        bib = token(data, ',', ++i);
                                }
                                data = newdata;
+                       } else if (buffer && name == "options") {
+                               data = buffer->includedFilePath(data, "bst");
                        }
                        os << name << ' '
                           << Lexer::quoteString(data)