caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Can I pass added command line option through ocamlfind?
@ 2014-12-06 13:06 Kenichi Asai
  2014-12-06 13:43 ` Peter Zotov
  0 siblings, 1 reply; 3+ messages in thread
From: Kenichi Asai @ 2014-12-06 13:06 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 1039 bytes --]

Following Francois Ripault's comment, I am studying OCamlDoc's custom
tags.  (Thank you Francois!)  I implemented the attached custom
generator implementing @en and @ja tags together with a new command
line option "-lang".  Now, what I want to do is:

ocamlfind ocamldoc -package lablgtk2.gnomecanvas -g custom.cmxs -d html -lang ja file.ml ...

However, since ocamlfind does not recognize -lang as a proper option
for ocamldoc, I get:

ocamldoc: unknown option `-lang'.

Is there any way to tell ocamlfind to pass the '-lang ja' option as is
to ocamldoc?  Alternatively, how do I specify the equivalent of
'-package lablgtk2.gnomecanvas' without using ocamlfind?  I tried:

ocamldoc -I lablgtk2.gnomecanvas     -g custom.cmxs -d html -lang ja file.ml ...
ocamldoc -I +lablgtk2.gnomecanvas    -g custom.cmxs -d html -lang ja file.ml ...
ocamldoc -I +lablgtk2                -g custom.cmxs -d html -lang ja file.ml ...

etc., but they all produced:

Error: Unbound class GnoCanvas.group

Thank you in advance.

Sincerely,

-- 
Kenichi Asai

[-- Attachment #2: custom.ml --]
[-- Type: text/plain, Size: 870 bytes --]

(** language tag: "en" for English, "ja" for Japanese *)
let lang = ref "en"

module Generator (G : Odoc_html.Html_generator) =
struct
  class html =
    object(self)
      inherit G.html

      (** copied from argot: http://argot.x9c.fr *)
      method private string_of_text text =
	let buff = Buffer.create 256 in
	self#html_of_text buff text;
	Buffer.contents buff

      (** Return HTML code for the given text of a lang tag. *)
      method private html_of_lang text = (* your code here *)
	self#string_of_text text

      initializer
        tag_functions <- (!lang, self#html_of_lang) :: tag_functions
	(** register only !lang.  Other tags are ignored *)
  end
end

let _ = begin
  Odoc_args.add_option
    ("-lang", Arg.Set_string lang, "[en|ja]\n\t\tGenerate English document");
  Odoc_args.extend_html_generator (module Generator : Odoc_gen.Html_functor)
end

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Can I pass added command line option through ocamlfind?
  2014-12-06 13:06 [Caml-list] Can I pass added command line option through ocamlfind? Kenichi Asai
@ 2014-12-06 13:43 ` Peter Zotov
  2014-12-06 15:17   ` Kenichi Asai
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Zotov @ 2014-12-06 13:43 UTC (permalink / raw)
  To: Kenichi Asai; +Cc: caml-list, caml-list-request

On 2014-12-06 16:06, Kenichi Asai wrote:
> Following Francois Ripault's comment, I am studying OCamlDoc's custom
> tags.  (Thank you Francois!)  I implemented the attached custom
> generator implementing @en and @ja tags together with a new command
> line option "-lang".  Now, what I want to do is:
> 
> ocamlfind ocamldoc -package lablgtk2.gnomecanvas -g custom.cmxs -d
> html -lang ja file.ml ...
> 
> However, since ocamlfind does not recognize -lang as a proper option
> for ocamldoc, I get:
> 
> ocamldoc: unknown option `-lang'.
> 
> Is there any way to tell ocamlfind to pass the '-lang ja' option as is
> to ocamldoc?  Alternatively, how do I specify the equivalent of
> '-package lablgtk2.gnomecanvas' without using ocamlfind?  I tried:

You can use:

   ocamlfind -passopt '-lang ja' ...

-- 
Peter Zotov

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Can I pass added command line option through ocamlfind?
  2014-12-06 13:43 ` Peter Zotov
@ 2014-12-06 15:17   ` Kenichi Asai
  0 siblings, 0 replies; 3+ messages in thread
From: Kenichi Asai @ 2014-12-06 15:17 UTC (permalink / raw)
  To: Peter Zotov; +Cc: caml-list

> You can use:
> 
>   ocamlfind -passopt '-lang ja' ...

Thank you!  The following saved the day!

ocamlfind ocamldoc -package lablgtk2.gnomecanvas -g custom.cmxs -d html -passopt -lang ja file.ml ...

-- 
Kenichi Asai

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-06 15:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-06 13:06 [Caml-list] Can I pass added command line option through ocamlfind? Kenichi Asai
2014-12-06 13:43 ` Peter Zotov
2014-12-06 15:17   ` Kenichi Asai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).