Skip to content

Commit

Permalink
Allow spaces and dashes in section titles
Browse files Browse the repository at this point in the history
Fizes #24
  • Loading branch information
NilsEnevoldsen committed Apr 19, 2018
1 parent 2f4d316 commit 07e83ba
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ public static function renderScryfallDeck( $input, array $args, $parser, $frame
// Split at the first whitespace following numerals
$line = preg_split( '/^\s*(?:(\d+)\s+)?/', $string, -1,
PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );

if ( count( $line ) == 1 ) {
$thissection = preg_replace( '/[^A-Za-z]/', '', $line[0] );
// This line is a section title
$thissection = preg_replace( '/[^A-Za-z- ]/', '', $line[0] );
} else {
// This line is a card name with a quantity
$cards[$key]['quantity'] = $line[0];
$cards[$key]['name'] = $line[1];
$cards[$key]['section'] = $thissection;
Expand Down

0 comments on commit 07e83ba

Please sign in to comment.