X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetCommandParams.cpp;h=931e1bb09376111ee656618b3956beffb678d170;hb=d4550b7a4d64e9ff772cf3a7635cb4ca532fb340;hp=519e93797d48b25bef86c1d0862b1c4b83bc20e9;hpb=8c351e32be92fca91e2dd1f9ec478d5cb1ce6c8c;p=lyx.git diff --git a/src/insets/InsetCommandParams.cpp b/src/insets/InsetCommandParams.cpp index 519e93797d..931e1bb093 100644 --- a/src/insets/InsetCommandParams.cpp +++ b/src/insets/InsetCommandParams.cpp @@ -12,6 +12,8 @@ #include #include +#include + #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, @@ -346,13 +372,15 @@ void InsetCommandParams::Write(ostream & os, Buffer const * buffer) const string newdata; string bib = token(data, ',', i); while (!bib.empty()) { - bib = buffer->includedFilePath(bib); + bib = buffer->includedFilePath(bib, "bib"); if (!newdata.empty()) newdata.append(1, ','); newdata.append(bib); bib = token(data, ',', ++i); } data = newdata; + } else if (buffer && name == "options") { + data = buffer->includedFilePath(data, "bst"); } os << name << ' ' << Lexer::quoteString(data)