@@ -254,13 +254,17 @@ def diff_walk(nodes, metas, overrides, values, mapper, native_title=True, stop=N
254254 overrides [id (first )] = {'title' : True } if native_title else {'leaf' : [(plain (first ), 'postTitle' , None )]}
255255 return
256256 # A card list whose headings are its posts' titles but for one (the source
257- # listing named one post differently from its page): the heading is still
258- # the title, and the odd card is reported.
257+ # listing named one post differently from its page): the heading binds the
258+ # post's card headline, which is the title unless the post keeps its own
259+ # (the odd card's words, recorded per post), and the odd card is reported.
259260 matched = [bool (m .get ('title' )) and t == norm (m ['title' ]) for t , m in zip (texts , metas )]
260261 if card and first .tag in HEADINGS and len (nodes ) >= 3 and matched .count (False ) == 1 and all (texts ) and len (set (texts )) == len (texts ):
261262 odd = texts [matched .index (False )]
262- mapper .finding ('query-card-title' , 'A card heading differs from its post title and shows the title instead: ' + odd [:120 ])
263- overrides [id (first )] = {'leaf' : [(plain (first ), 'postTitle' , None )]}
263+ mapper .finding ('query-card-title' , 'Card headline differs from its post title; kept per post as the card title: ' + odd [:120 ])
264+ overrides [id (first )] = {'leaf' : [(plain (first ), 'postCardTitle' , None )]}
265+ for store , text , same in zip (values or [], texts , matched ):
266+ if not same :
267+ store .setdefault ('postCardTitle' , (text , None ))
264268 return
265269
266270 def record (bind , fmt , per_instance ):
@@ -1021,6 +1025,9 @@ def query_block(self, node, targets, cards=None):
10211025 cut = lambda value : value .endswith (('...' , '…' ))
10221026 if not seen or (cut (seen ) and text .startswith (seen .rstrip ('.… ' )) and len (text ) > len (seen )):
10231027 self .posts [key ]['cardExcerpt' ] = text
1028+ # A card that names its post differently keeps those words per post.
1029+ if values .get ('postCardTitle' ) and not self .posts [key ].get ('cardTitle' ):
1030+ self .posts [key ]['cardTitle' ] = values ['postCardTitle' ][0 ]
10241031 # The date a card prints is that post's publication date.
10251032 if values .get ('postDate' ) and not self .posts [key ].get ('cardDate' ):
10261033 parsed = parse_date (values ['postDate' ][0 ])
@@ -3032,6 +3039,8 @@ def convert(href):
30323039 cut = stated .endswith (('...' , '…' )) and norm (meta .get ('cardExcerpt' ) or '' ).startswith (stated .rstrip ('.… ' )) if meta else False
30333040 if entry ['kind' ] == 'post' and meta and meta .get ('cardExcerpt' ) and (not given .get ('excerpt' ) or cut ):
30343041 proposals [entry ['key' ]].setdefault ('post' , {})['excerpt' ] = meta ['cardExcerpt' ]
3042+ if entry ['kind' ] == 'post' and meta and meta .get ('cardTitle' ) and not given .get ('cardTitle' ):
3043+ proposals [entry ['key' ]].setdefault ('post' , {})['cardTitle' ] = meta ['cardTitle' ]
30353044 if entry ['kind' ] == 'post' and meta and meta .get ('cardDate' ) and not given .get ('date' ) and not (proposals [entry ['key' ]].get ('post' ) or {}).get ('date' ):
30363045 proposals [entry ['key' ]].setdefault ('post' , {})['date' ] = meta ['cardDate' ]
30373046 if entry ['kind' ] == 'post' and meta and meta .get ('cardImage' ) and not given .get ('featuredImage' ) and not (proposals [entry ['key' ]].get ('post' ) or {}).get ('featuredImage' ):
0 commit comments