diff options
author | Loïc Hoguin <[email protected]> | 2018-08-16 16:51:21 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-08-16 16:51:21 +0200 |
commit | f317200563bf3b7547cbca6b825fd6bee50a6528 (patch) | |
tree | 4161598ac5a4912bafa64e5dd443292062632b04 /src/asciideck_to_manpage.erl | |
parent | abe4ff5ca5c6c74c4c1562c38d74ab232607312b (diff) | |
download | asciideck-f317200563bf3b7547cbca6b825fd6bee50a6528.tar.gz asciideck-f317200563bf3b7547cbca6b825fd6bee50a6528.tar.bz2 asciideck-f317200563bf3b7547cbca6b825fd6bee50a6528.zip |
Fix warnings evidenced by the groff tests
Diffstat (limited to 'src/asciideck_to_manpage.erl')
-rw-r--r-- | src/asciideck_to_manpage.erl | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/asciideck_to_manpage.erl b/src/asciideck_to_manpage.erl index 23b110c..7f6cbaf 100644 --- a/src/asciideck_to_manpage.erl +++ b/src/asciideck_to_manpage.erl @@ -118,7 +118,7 @@ listing_block({listing_block, Attrs, Listing, _}) -> ".RS 4\n" ".\\}\n" ".nf\n", - Listing, + escape(Listing), "\n" ".fi\n" ".if n \\{\\\n" @@ -208,7 +208,7 @@ comment_line({comment_line, _, Text, _}) -> %% Inline formatting. inline(Text) when is_binary(Text) -> - Text; + escape(Text); %% When the link is the text we only print it once. inline({link, #{target := Link}, Link, _}) -> Link; @@ -231,3 +231,6 @@ inline({line_break, _, _, _}) -> "\n.br\n"; inline(Text) when is_list(Text) -> [inline(T) || T <- Text]. + +escape(Text) -> + binary:replace(iolist_to_binary(Text), <<$\\>>, <<$\\, $\\>>, [global]). |