@@ -400,21 +400,27 @@ impl<'e> ManRenderer<'e> {
400
400
}
401
401
402
402
fn escape ( s : & str ) -> Result < String , Error > {
403
+ // Note: Possible source on output escape sequences: https://man7.org/linux/man-pages/man7/groff_char.7.html.
404
+ // Otherwise, use generic escaping in the form `\[u1EE7]` or `\[u1F994]`.
405
+
403
406
let mut replaced = s
404
407
. replace ( '\\' , "\\ (rs" )
405
408
. replace ( '-' , "\\ -" )
406
409
. replace ( '\u{00A0}' , "\\ " ) // non-breaking space (non-stretchable)
407
410
. replace ( '–' , "\\ [en]" ) // \u{2013} en-dash
408
411
. replace ( '—' , "\\ [em]" ) // \u{2014} em-dash
412
+ . replace ( '‘' , "\\ [oq]" ) // \u{2018} left single quote
413
+ . replace ( '’' , "\\ [cq]" ) // \u{2019} right single quote or apostrophe
414
+ . replace ( '“' , "\\ [lq]" ) // \u{201C} left double quote
415
+ . replace ( '”' , "\\ [rq]" ) // \u{201D} right double quote
416
+ . replace ( '…' , "\\ [u2026]" ) // \u{2026} ellipsis
409
417
. replace ( '│' , "|" ) // \u{2502} box drawing light vertical (could use \[br])
410
418
. replace ( '├' , "|" ) // \u{251C} box drawings light vertical and right
411
419
. replace ( '└' , "`" ) // \u{2514} box drawings light up and right
412
420
. replace ( '─' , "\\ -" ) // \u{2500} box drawing light horizontal
413
421
;
414
422
if replaced. starts_with ( '.' ) {
415
423
replaced = format ! ( "\\ &.{}" , & replaced[ 1 ..] ) ;
416
- } else if replaced. starts_with ( '\'' ) {
417
- replaced = format ! ( "\\ (aq{}" , & replaced[ 1 ..] ) ;
418
424
}
419
425
420
426
if let Some ( ch) = replaced. chars ( ) . find ( |ch| {
0 commit comments