diff options
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | src/asciideck_to_manpage.erl | 7 |
2 files changed, 9 insertions, 5 deletions
@@ -45,11 +45,12 @@ $(ERLANG_MK_TMP)/groff/$1: | $(ERLANG_MK_TMP)/groff $(verbose) git clone -q --depth 1 -- $(call dep_repo,$1) $$@ $(verbose) mkdir $$@/deps $(verbose) ln -s $(CURDIR) $$@/deps/asciideck + $(verbose) touch $$@/deps/ci.erlang.mk $(verbose) cp $(CURDIR)/erlang.mk $$@/ -groff-$1: $(ERLANG_MK_TMP)/groff/$1 - $(gen_verbose) $(MAKE) -C $$^ asciidoc-manual - $(verbose) for f in $$^/doc/man*/*.gz; do \ +groff-$1: $(ERLANG_MK_TMP)/groff/$1 app + $(gen_verbose) $(MAKE) -C $$< asciidoc-manual MAKEFLAGS= DEPS_DIR=$$</deps ERL_LIBS=$$</deps + $(verbose) for f in $$</doc/man*/*.gz; do \ echo " GROFF " `basename "$$$$f"`; \ zcat "$$$$f" | groff -man -rD1 -z -ww; \ done 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]). |