221V 5 years ago
parent
commit
5de1175fed
3 changed files with 6 additions and 6 deletions
  1. 1 1
      include/mad.hrl
  2. 4 4
      src/mad_groff.erl
  3. 1 1
      src/mad_man.erl

+ 1 - 1
include/mad.hrl

@@ -1 +1 @@
--define(VERSION,"5.4-28-gb3ae4e3").
+-define(VERSION,"5.4-29-gfbf836e").

+ 4 - 4
src/mad_groff.erl

@@ -74,7 +74,7 @@ head([#xmlElement{name=title, content=[#xmlText{value=V} | _]} | _], _) -> V;
 head([_|T], A) -> head(T, A).
 
 write2new(F, S) ->
-  file:write_file(F ++ ".1",
-  io_lib:fwrite("~s", [
-  mad_man:trim(
-  unicode:characters_to_binary(S,utf8))]), [append]).
+  S2 = unicode:characters_to_binary(S,utf8),
+  file:write_file(F ++ ".1", io_lib:fwrite("~ts", [ binary:part(S2, 0, size(S2) - 2) ]), [append]).
+
+

+ 1 - 1
src/mad_man.erl

@@ -29,7 +29,7 @@ man(["check"]) ->
 
 write(Gen,Bin) -> io:format("Generated: ~p~n",[Gen]), file:write_file(Gen,Bin).
 replace(S,A,B) -> re:replace(S,A,B,[global,{return,list}]).
-trim(A) when is_list(A) -> trim(unicode:characters_to_binary(A));
+trim(A) when is_list(A) -> trim(unicode:characters_to_binary(A,utf8));
 trim(A) when is_binary(A) -> re:replace(A, "(^\\s+)|(\\s+$)", "", [global,{return,list}]).
 fix([Prefix]) -> Prefix;
 fix([_Prefix,Name|_Rest]) -> Name.