@@ -807,7 +807,8 @@ def _split(self):
807807 else :
808808 image = self .image
809809
810- # Split cards with CONTINUE cards
810+ # Split cards with CONTINUE cards or commentary keywords with long
811+ # values
811812 if len (self ._image ) > self .length :
812813 values = []
813814 comments = []
@@ -817,6 +818,10 @@ def _split(self):
817818 if keyword is None :
818819 keyword = kw
819820
821+ if keyword in self ._commentary_keywords :
822+ values .append (vc )
823+ continue
824+
820825 # Should match a string followed by a comment; if not it
821826 # might be an invalid Card, so we just take it verbatim
822827 m = self ._strg_comment_RE .match (vc )
@@ -832,7 +837,11 @@ def _split(self):
832837 if comment :
833838 comments .append (comment .rstrip ())
834839
835- valuecomment = f"'{ '' .join (values )} ' / { ' ' .join (comments )} "
840+ if keyword in self ._commentary_keywords :
841+ valuecomment = '' .join (values )
842+ else :
843+ # CONTINUE card
844+ valuecomment = f"'{ '' .join (values )} ' / { ' ' .join (comments )} "
836845 return keyword , valuecomment
837846
838847 if self .keyword in self ._special_keywords :
@@ -1162,16 +1171,21 @@ def _itersubcards(self):
11621171 If the card image is greater than 80 characters, it should consist of a
11631172 normal card followed by one or more CONTINUE card. This method returns
11641173 the subcards that make up this logical card.
1174+
1175+ This can also support the case where a HISTORY or COMMENT card has a
1176+ long value that is stored internally as multiple concatenated card
1177+ images.
11651178 """
11661179
11671180 ncards = len (self ._image ) // Card .length
11681181
11691182 for idx in range (0 , Card .length * ncards , Card .length ):
11701183 card = Card .fromstring (self ._image [idx :idx + Card .length ])
1171- if idx > 0 and card .keyword .upper () != 'CONTINUE' :
1184+ if idx > 0 and card .keyword .upper () not in self . _special_keywords :
11721185 raise VerifyError (
11731186 'Long card images must have CONTINUE cards after '
1174- 'the first card.' )
1187+ 'the first card or have commentary keywords like '
1188+ 'HISTORY or COMMENT.' )
11751189
11761190 if not isinstance (card .value , str ):
11771191 raise VerifyError ('CONTINUE cards must have string values.' )
0 commit comments