Permalink
Browse files

Escape reserved characters in ocamldoc documentation

  • Loading branch information...
1 parent ca6b753 commit 17edbc6437e57040ee996a47e41b6f192ffb416f @astrada committed Jul 4, 2013
Showing with 14 additions and 6 deletions.
  1. +2 −2 src/gapi/gapiBigqueryV2Model.mli
  2. +1 −1 src/gapi/gapiDriveV2Model.mli
  3. +11 −3 tools/serviceGenerator.ml
@@ -1092,13 +1092,13 @@ sig
domain : string;
(** [Pick one] A domain to grant access to. Any users signed in with the domain specified will be granted the specified access. Example: "example.com". *)
groupByEmail : string;
- (** [Pick one] A fully-qualified email address of a mailing list to grant access to. This must be either a Google Groups mailing list (ends in @googlegroups.com) or a group managed by an enterprise version of Google Groups. *)
+ (** [Pick one] A fully-qualified email address of a mailing list to grant access to. This must be either a Google Groups mailing list (ends in \@googlegroups.com) or a group managed by an enterprise version of Google Groups. *)
role : string;
(** [Required] Describes the rights granted to the user specified by the other member of the access object. The following string values are supported: READER - User can call any list() or get() method on any collection or resource. WRITER - User can call any method on any collection except for datasets, on which they can call list() and get(). OWNER - User can call any method. The dataset creator is granted this role by default. *)
specialGroup : string;
(** [Pick one] A special group to grant access to. The valid values are: projectOwners: Owners of the enclosing project. projectReaders: Readers of the enclosing project. projectWriters: Writers of the enclosing project. allAuthenticatedUsers: All authenticated BigQuery users. *)
userByEmail : string;
- (** [Pick one] A fully qualified email address of a user to grant access to. For example: fred@example.com. *)
+ (** [Pick one] A fully qualified email address of a user to grant access to. For example: fred\@example.com. *)
}
@@ -1101,7 +1101,7 @@ sig
objectType : string;
(** The type of object this app creates (e.g. Chart). If empty, the app name should be used instead. *)
openUrlTemplate : string;
- (** The template url for opening files with this app. The template will contain {ids} and/or {exportIds} to be replaced by the actual file ids. *)
+ (** The template url for opening files with this app. The template will contain \{ids\} and/or \{exportIds\} to be replaced by the actual file ids. *)
primaryFileExtensions : string list;
(** The list of primary file extensions. *)
primaryMimeTypes : string list;
View
@@ -11,6 +11,14 @@ let no_overwrite = ref false
(* END Configuration *)
+(* Docs *)
+
+let to_escape_regexp = Str.regexp "[@{}]"
+
+let clean_doc s = Str.global_replace to_escape_regexp "\\\\\\0" s
+
+(* END Docs *)
+
(* State monad implementation *)
module GeneratorStateMonad =
@@ -1173,7 +1181,7 @@ let rec generate_schema_module_signature
"%s : %s;@,(** %s *)@,"
ocaml_name
ocaml_type
- (ComplexType.get_description field_type))
+ (clean_doc (ComplexType.get_description field_type)))
fields;
Format.fprintf formatter
"@]@,}@\n@\n";
@@ -1283,7 +1291,7 @@ let rec generate_service_module_signature
Format.fprintf formatter
"| %s (** %s *)@,"
constructor
- description)
+ (clean_doc description))
enum_module.EnumModule.values;
Format.fprintf formatter "@]@,val to_string : t -> string@,@,val of_string : string -> t@,@]@\nend@\n";
in
@@ -1316,7 +1324,7 @@ let rec generate_service_module_signature
(* Documentation *)
Format.fprintf formatter
"@[<hov 2>(** %s@\n@\n@@param base_url Service endpoint base URL (defaults to [\"%s\"]).@\n"
- methd.Method.description
+ (clean_doc methd.Method.description)
base_url;
if methd.Method.original_name = "get" then begin
Format.fprintf formatter

0 comments on commit 17edbc6

Please sign in to comment.