Merge pull request #220 from arxanas/deck-parser-ampersand
Fix #183: Deck parser doesn't too eagerly replace ampersands.
This commit is contained in:
commit
395658988a
1 changed files with 12 additions and 1 deletions
|
@ -570,9 +570,20 @@ bool DeckList::loadFromStream_Plain(QTextStream &in)
|
||||||
cardName.replace(rx, "AE");
|
cardName.replace(rx, "AE");
|
||||||
rx.setPattern("^Aether");
|
rx.setPattern("^Aether");
|
||||||
cardName.replace(rx, "AEther");
|
cardName.replace(rx, "AEther");
|
||||||
rx.setPattern("\\s*[&|/]{1,2}\\s*");
|
rx.setPattern("\\s*[|/]{1,2}\\s*");
|
||||||
cardName.replace(rx, " // ");
|
cardName.replace(rx, " // ");
|
||||||
|
|
||||||
|
// Replace only if the ampersand is preceded by a non-capital letter,
|
||||||
|
// as would happen with acronyms. So 'Fire & Ice' is replaced but not
|
||||||
|
// 'R&D' or 'R & D'.
|
||||||
|
//
|
||||||
|
// Qt regexes don't support lookbehind so we capture and replace
|
||||||
|
// instead.
|
||||||
|
rx.setPattern("([^A-Z])\\s*&\\s*");
|
||||||
|
if (rx.indexIn(cardName) != -1) {
|
||||||
|
cardName.replace(rx, QString("%1 // ").arg(rx.cap(1)));
|
||||||
|
}
|
||||||
|
|
||||||
++okRows;
|
++okRows;
|
||||||
new DecklistCardNode(cardName, number, zone);
|
new DecklistCardNode(cardName, number, zone);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue