caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] [batteries] ... how to create (format) directives that do not take any arguments?
@ 2013-11-25 15:46 Matej Kosik
  2013-11-25 16:27 ` Gabriel Scherer
  2013-11-27 11:54 ` [Caml-list] [batteries] ... how to create (format) directives that do not take any arguments? Jeremie Dimino
  0 siblings, 2 replies; 10+ messages in thread
From: Matej Kosik @ 2013-11-25 15:46 UTC (permalink / raw)
  To: caml-list

Dear all,

I would like to define custom directives, that would enable me to write code like e.g. this:

Print.printf "regular %bold_on bold %bold_off regular %italic_on italic %italic_off";

This might expand to (in HTML codes)

              regular <B>bold</B> regular <I>italic</I>

or in ANSI codes to something analogous.

I am currently looking at:

  http://ocaml-batteries-team.github.io/batteries-included/hdoc/BatPrint.html

It refers to:

  https://github.com/ocaml-batteries-team/batteries-included/blob/master/examples/snippets/test_printf.ml

Those things work, although there is no example for:

  Print.literal

which might be (?) what I need to employ.

Can somebody give me some advice how to create simple "parameterless format directives" (like those above)?

----

Basically, I just want to refactor some weird markup out of the literal string while I do not want to reinsert the refactored stuff via %s because it is not maintainable.

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

end of thread, other threads:[~2013-11-30  3:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-25 15:46 [Caml-list] [batteries] ... how to create (format) directives that do not take any arguments? Matej Kosik
2013-11-25 16:27 ` Gabriel Scherer
2013-11-27 11:37   ` Matej Kosik
2013-11-28  6:30     ` [Caml-list] [batteries] ... how to create (format) directives oleg
2013-11-29  9:32       ` Matej Kosik
2013-11-30  3:15         ` oleg
2013-11-27 11:54 ` [Caml-list] [batteries] ... how to create (format) directives that do not take any arguments? Jeremie Dimino
2013-11-27 12:52   ` Matej Kosik
2013-11-27 13:00     ` Jeremie Dimino
2013-11-29  9:32       ` Matej Kosik

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).