From 591fbbd71b10a5f086fab622f7dfe43f3a8adcb6 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Wed, 1 Jul 2020 00:00:27 +0200 Subject: Fix some behaviours about --- cli/main.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'cli') diff --git a/cli/main.cpp b/cli/main.cpp index 3de1d26..004e187 100644 --- a/cli/main.cpp +++ b/cli/main.cpp @@ -161,7 +161,7 @@ void displayMarkdown(QString scalarText, QString resultStr, QJsonArray array, bo } else if(!resultStr.isEmpty()) { - resultStr.replace("%2", diceList.trimmed()); + // resultStr.replace("%2", diceList.trimmed()); str.append(QStringLiteral("%1\n").arg(resultStr)); } } @@ -374,6 +374,15 @@ int startDiceParsing(QStringList& cmds, QString& treeFile, bool withColor, EXPOR if(sub.contains(ex)) resultWithPlaceHolder.append(sub); }); + + if(resultWithPlaceHolder.isEmpty()) + allStringlist.erase(std::remove_if(allStringlist.begin(), allStringlist.end(), + [](const QString& result) { + bool ok; + result.toInt(&ok); + return ok; + }), + allStringlist.end()); auto stringResult = resultWithPlaceHolder.isEmpty() ? allStringlist.join(" ; ") : resultWithPlaceHolder.join(" ; "); @@ -394,9 +403,10 @@ int startDiceParsing(QStringList& cmds, QString& treeFile, bool withColor, EXPOR stringResult.replace(QStringLiteral("ยต%1").arg(i), (*it)); --i; } + bool isInt= true; stringResult.toInt(&isInt); - if(!isInt) + if(!isInt || !resultWithPlaceHolder.isEmpty()) resultStr= stringResult; } if(format == BOT) -- cgit v1.2.3-70-g09d2