@@ -470,12 +470,38 @@ fn process_backslash_escape(
470470// Pandoc's default abbreviations list
471471// From Text.Pandoc.Parsing in pandoc source
472472fn is_abbreviation ( text : & str ) -> bool {
473- matches ! ( text,
474- "Mr." | "Mrs." | "Ms." | "Capt." | "Dr." | "Prof." |
475- "Gen." | "Gov." | "e.g." | "i.e." | "Sgt." | "St." |
476- "vol." | "vs." | "Sen." | "Rep." | "Pres." | "Hon." |
477- "Rev." | "Ph.D." | "M.D." | "M.A." | "p." | "pp." |
478- "ch." | "chap." | "sec." | "cf." | "cp." )
473+ matches ! (
474+ text,
475+ "Mr."
476+ | "Mrs."
477+ | "Ms."
478+ | "Capt."
479+ | "Dr."
480+ | "Prof."
481+ | "Gen."
482+ | "Gov."
483+ | "e.g."
484+ | "i.e."
485+ | "Sgt."
486+ | "St."
487+ | "vol."
488+ | "vs."
489+ | "Sen."
490+ | "Rep."
491+ | "Pres."
492+ | "Hon."
493+ | "Rev."
494+ | "Ph.D."
495+ | "M.D."
496+ | "M.A."
497+ | "p."
498+ | "pp."
499+ | "ch."
500+ | "chap."
501+ | "sec."
502+ | "cf."
503+ | "cp."
504+ )
479505}
480506
481507// Coalesce Str nodes that end with abbreviations with following words
@@ -497,9 +523,16 @@ fn coalesce_abbreviations(inlines: Vec<Inline>) -> (Vec<Inline>, bool) {
497523 if is_abbreviation ( & current_text) {
498524 // Coalesce with following Space + Str until we hit a capital letter
499525 while j + 1 < inlines. len ( ) {
500- if let ( Inline :: Space ( _) , Inline :: Str ( next_str) ) = ( & inlines[ j] , & inlines[ j + 1 ] ) {
526+ if let ( Inline :: Space ( _) , Inline :: Str ( next_str) ) =
527+ ( & inlines[ j] , & inlines[ j + 1 ] )
528+ {
501529 // Stop before uppercase letters (potential sentence boundaries)
502- if next_str. text . chars ( ) . next ( ) . map_or ( false , |c| c. is_uppercase ( ) ) {
530+ if next_str
531+ . text
532+ . chars ( )
533+ . next ( )
534+ . map_or ( false , |c| c. is_uppercase ( ) )
535+ {
503536 break ;
504537 }
505538
@@ -2529,7 +2562,9 @@ fn merge_strs(pandoc: Pandoc) -> Pandoc {
25292562 if let Some ( current) = current_str. take ( ) {
25302563 result. push ( Inline :: Str ( Str {
25312564 text : current,
2532- source_info : current_source_info. take ( ) . unwrap_or_else ( empty_source_info) ,
2565+ source_info : current_source_info
2566+ . take ( )
2567+ . unwrap_or_else ( empty_source_info) ,
25332568 } ) ) ;
25342569 }
25352570 result. push ( inline) ;
0 commit comments