fix: html sintax for modlist export

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-06-26 11:57:21 +03:00
parent 22bb260ae3
commit 515197fba2
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
2 changed files with 9 additions and 9 deletions

View File

@ -37,13 +37,13 @@ QString ExportToModList(QList<Mod*> mods, Formats format, OptionalData extraData
if (ver.isEmpty() && meta != nullptr) if (ver.isEmpty() && meta != nullptr)
ver = meta->version().toString(); ver = meta->version().toString();
if (!ver.isEmpty()) if (!ver.isEmpty())
line += QString("[%1]").arg(ver); line += QString(" [%1]").arg(ver);
} }
if (extraData & Authors && !mod->authors().isEmpty()) if (extraData & Authors && !mod->authors().isEmpty())
line += " by " + mod->authors().join(", "); line += " by " + mod->authors().join(", ");
lines.append(QString("<ul>%1</ul>").arg(line)); lines.append(QString("<li>%1</li>").arg(line));
} }
return QString("<html><body><li>\n\t%1\n</li></body></html>").arg(lines.join("\n\t")); return QString("<html><body><ul>\n\t%1\n</ul></body></html>").arg(lines.join("\n\t"));
} }
case MARKDOWN: { case MARKDOWN: {
QStringList lines; QStringList lines;
@ -61,7 +61,7 @@ QString ExportToModList(QList<Mod*> mods, Formats format, OptionalData extraData
if (ver.isEmpty() && meta != nullptr) if (ver.isEmpty() && meta != nullptr)
ver = meta->version().toString(); ver = meta->version().toString();
if (!ver.isEmpty()) if (!ver.isEmpty())
line += QString("[%1]").arg(ver); line += QString(" [%1]").arg(ver);
} }
if (extraData & Authors && !mod->authors().isEmpty()) if (extraData & Authors && !mod->authors().isEmpty())
line += " by " + mod->authors().join(", "); line += " by " + mod->authors().join(", ");
@ -75,21 +75,21 @@ QString ExportToModList(QList<Mod*> mods, Formats format, OptionalData extraData
auto meta = mod->metadata(); auto meta = mod->metadata();
auto modName = mod->name(); auto modName = mod->name();
auto line = "name: " + modName + ";"; auto line = modName;
if (extraData & Url) { if (extraData & Url) {
auto url = mod->metaurl(); auto url = mod->metaurl();
if (!url.isEmpty()) if (!url.isEmpty())
line += " url: " + url + ";"; line += QString(" (%1)").arg(url);
} }
if (extraData & Version) { if (extraData & Version) {
auto ver = mod->version(); auto ver = mod->version();
if (ver.isEmpty() && meta != nullptr) if (ver.isEmpty() && meta != nullptr)
ver = meta->version().toString(); ver = meta->version().toString();
if (!ver.isEmpty()) if (!ver.isEmpty())
line += " version: " + QString("[%1]").arg(ver) + ";"; line += QString(" [%1]").arg(ver);
} }
if (extraData & Authors && !mod->authors().isEmpty()) if (extraData & Authors && !mod->authors().isEmpty())
line += " authors " + mod->authors().join(", ") + ";"; line += " by " + mod->authors().join(", ");
lines << line; lines << line;
} }
return lines.join("\n"); return lines.join("\n");

View File

@ -118,7 +118,7 @@ void ExportToModListDialog::triggerImp()
QString exampleLine; QString exampleLine;
switch (format) { switch (format) {
case ExportToModList::HTML: { case ExportToModList::HTML: {
exampleLine = "<ul><a href=\"{url}\">{name}</a> [{version}] by {authors}</ul>"; exampleLine = "<li><a href=\"{url}\">{name}</a> [{version}] by {authors}</li>";
ui->resultText->setHtml(txt); ui->resultText->setHtml(txt);
break; break;
} }