@@ -806,7 +806,8 @@ def _split(self):
806806 else :
807807 image = self .image
808808
809- # Split cards with CONTINUE cards
809+ # Split cards with CONTINUE cards or commentary keywords with long
810+ # values
810811 if len (self ._image ) > self .length :
811812 values = []
812813 comments = []
@@ -816,6 +817,10 @@ def _split(self):
816817 if keyword is None :
817818 keyword = kw
818819
820+ if keyword in self ._commentary_keywords :
821+ values .append (vc )
822+ continue
823+
819824 # Should match a string followed by a comment; if not it
820825 # might be an invalid Card, so we just take it verbatim
821826 m = self ._strg_comment_RE .match (vc )
@@ -831,7 +836,11 @@ def _split(self):
831836 if comment :
832837 comments .append (comment .rstrip ())
833838
834- valuecomment = f"'{ '' .join (values )} ' / { ' ' .join (comments )} "
839+ if keyword in self ._commentary_keywords :
840+ valuecomment = '' .join (values )
841+ else :
842+ # CONTINUE card
843+ valuecomment = f"'{ '' .join (values )} ' / { ' ' .join (comments )} "
835844 return keyword , valuecomment
836845
837846 if self .keyword in self ._special_keywords :
@@ -1159,16 +1168,21 @@ def _itersubcards(self):
11591168 If the card image is greater than 80 characters, it should consist of a
11601169 normal card followed by one or more CONTINUE card. This method returns
11611170 the subcards that make up this logical card.
1171+
1172+ This can also support the case where a HISTORY or COMMENT card has a
1173+ long value that is stored internally as multiple concatenated card
1174+ images.
11621175 """
11631176
11641177 ncards = len (self ._image ) // Card .length
11651178
11661179 for idx in range (0 , Card .length * ncards , Card .length ):
11671180 card = Card .fromstring (self ._image [idx :idx + Card .length ])
1168- if idx > 0 and card .keyword .upper () != 'CONTINUE' :
1181+ if idx > 0 and card .keyword .upper () not in self . _special_keywords :
11691182 raise VerifyError (
11701183 'Long card images must have CONTINUE cards after '
1171- 'the first card.' )
1184+ 'the first card or have commentary keywords like '
1185+ 'HISTORY or COMMENT.' )
11721186
11731187 if not isinstance (card .value , str ):
11741188 raise VerifyError ('CONTINUE cards must have string values.' )
0 commit comments