19
19
from ..languages import Languages
20
20
from ..util import tmp_path
21
21
22
- IMG_RE = re .compile (r"<img (.*?)src=\"(.*?)\"(.*?)>" , re .IGNORECASE )
22
+ # supports both src="" and src=''
23
+ IMG_RE = re .compile (r"<img (.*?)src=(?:\"|')(.*?)(?:\"|')(.*?)>" , re .IGNORECASE )
23
24
SOUND_RE = re .compile (r"\[sound:(.*?)\]" )
24
25
25
26
@@ -458,7 +459,6 @@ async def handle_card(
458
459
# no usable mapping found
459
460
if not dst_id :
460
461
print (f"skipped { card .id } : no mapping for { src_id } " )
461
- print (mappings )
462
462
return None
463
463
464
464
# get the correct card type
@@ -513,6 +513,7 @@ async def handle_card(
513
513
gather_media .add ((src , False ))
514
514
if hashes :
515
515
data [i ] = "|" .join (hashes )
516
+
516
517
elif field ["type" ].startswith ("AUDIO" ):
517
518
hashes = []
518
519
srcs = SOUND_RE .findall (data [i ]) + recovered_audio_src
@@ -531,6 +532,7 @@ async def handle_card(
531
532
gather_media .add ((src , True ))
532
533
if hashes :
533
534
data [i ] = "|" .join (hashes )
535
+
534
536
elif field ["type" ] == "SYNTAX" :
535
537
if data [i ].strip () and not "[" in data [i ]:
536
538
if gather_syntax is None :
@@ -552,6 +554,7 @@ async def handle_card(
552
554
if (not gather_syntax is None ) or (not gather_media is None ):
553
555
return None
554
556
557
+
555
558
card_data = {
556
559
"deckId" : 0 , # set by core
557
560
"typeId" : dst_id ,
0 commit comments