forwarded 301046 [EMAIL PROTECTED]
tags 301046 patch upstream
thanks

On Wed, Mar 23, 2005 at 06:19:05 +0100, Samuel Mimram wrote:

> Package: ocaml
> Version: 3.08.3-2
> Severity: minor
> 
> Hi Sven,
> 
> There seem to be a bug in the Pervasives man page. It's ennoying since it puts
> garbage on the screen when you do man Pervasives:
> 
> % man Pervasives > /dev/null
> Reformatting Pervasives(3o), please wait...
> /tmp/zmangQZ2ct:1893: a newline character is not allowed in an escape name
> /tmp/zmangQZ2ct:1895: a newline character is not allowed in an escape name
> /tmp/zmangQZ2ct:2206: a newline character is not allowed in an escape name
> /tmp/zmangQZ2ct:2208: a newline character is not allowed in an escape name
> 
> It's cause by things like that:
> 
> mode: depending on the operating system, some translations
> may take place during output.  For instance, under Windows,
> end-of-lines will be translated from 
> .B \n
> to 
> .B \r\n
> 
I think this is a bug in ocamldoc, which doesn't escape strings when
generating a manpage. From ocamldoc/odoc_man.ml:
     (** Escape special sequences of characters in a string. *)
     method escape (s : string) = s

groff interprets sequences beginning with a backslash, so real
backslashes need to be escaped. (There might be other substitutions
needed, but I don't know enough groff to do a complete fix)
With the following patch, the ocamldoc-generated Pervasives manpage
doesn't have any groff warnings (backslashes are escaped using the \(rs
sequence).

Index: ocamldoc/odoc_man.ml
===================================================================
RCS file: /caml/ocaml/ocamldoc/odoc_man.ml,v
retrieving revision 1.24
diff -u -b -B -r1.24 odoc_man.ml
--- ocamldoc/odoc_man.ml        24 Mar 2005 17:20:53 -0000      1.24
+++ ocamldoc/odoc_man.ml        16 Jun 2005 00:54:43 -0000
@@ -188,6 +188,7 @@
 (** This class is used to create objects which can generate a simple html 
documentation. *)
 class man =
   let re_slash = Str.regexp_string "/" in
+  let re_backslash = Str.regexp_string "\\" in
   object (self)
     inherit info
 
@@ -197,7 +198,7 @@
       Str.global_replace re_slash "slash" s
 
     (** Escape special sequences of characters in a string. *)
-    method escape (s : string) = s
+    method escape (s : string) = Str.global_replace re_backslash "\\(rs" s
 
     (** Open a file for output. Add the target directory.*)
     method open_out file =
-

Regards,
Julien Cristau


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to