mirror of
https://github.com/Investigamer/cardconjurer.git
synced 2025-07-26 21:04:58 -05:00
Make ability and flavor words italic when importing cards from scryfall
This commit is contained in:

committed by
Josh birnholz

parent
9873cb0680
commit
7c8a00561a
@@ -2593,7 +2593,12 @@ function changeCardIndex() {
|
||||
if (card.text.mana) {card.text.mana.text = cardToImport.mana_cost || '';}
|
||||
if (card.text.type) {card.text.type.text = langFontCode + cardToImport.type_line || '';}
|
||||
if (card.text.rules) {
|
||||
var rulesText = curlyQuotes((cardToImport.oracle_text || '').replace('(', '{i}(').replace(')', '){/i}')).replace(/{Q}/g, '{untap}').replace(/{\u221E}/g, "{inf}").replace(/• /g, '• {indent}');
|
||||
var italicExemptions = ['Boast', 'Cycling', 'Visit', 'Prize', 'I', 'II', 'III', 'IV', 'I, II', 'II, III', 'III, IV', 'I, II, III', 'II, III, IV', 'I, II, III, IV', '• Khans', '• Dragons', '• Mirran', '• Phyrexian'];
|
||||
var rulesText = (cardToImport.oracle_text || '').replace(/(?:\((?:.*?)\)|[^"\n]+(?= — ))/g, function(a){
|
||||
if (italicExemptions.includes(a)) {return a;}
|
||||
return '{i}' + a + '{/i}';
|
||||
});
|
||||
rulesText = curlyQuotes(rulesText).replace(/{Q}/g, '{untap}').replace(/{\u221E}/g, "{inf}").replace(/• /g, '• {indent}');
|
||||
card.text.rules.text = langFontCode + rulesText;
|
||||
if (cardToImport.flavor_text) {
|
||||
var flavorText = cardToImport.flavor_text;
|
||||
|
Reference in New Issue
Block a user