From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <5764c029b688c1c0d24a2e97cd764f@gmail.com> X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 529967EE6B for ; Mon, 25 Nov 2013 16:46:05 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of 5764c029b688c1c0d24a2e97cd764f@gmail.com) identity=pra; client-ip=209.85.214.48; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="5764c029b688c1c0d24a2e97cd764f@gmail.com"; x-sender="5764c029b688c1c0d24a2e97cd764f@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of 5764c029b688c1c0d24a2e97cd764f@gmail.com designates 209.85.214.48 as permitted sender) identity=mailfrom; client-ip=209.85.214.48; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="5764c029b688c1c0d24a2e97cd764f@gmail.com"; x-sender="5764c029b688c1c0d24a2e97cd764f@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-bk0-f48.google.com) identity=helo; client-ip=209.85.214.48; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="5764c029b688c1c0d24a2e97cd764f@gmail.com"; x-sender="postmaster@mail-bk0-f48.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgkEAE1wk1LRVdYwnGdsb2JhbABZgh+BILwsgXgWDgEBAQEBBg0JCRQhB4JsARscAgMSEBYWGAMCAQIBEREBBQEiDQgCh2oBAw8EAQidfoMFjFmDCYQoChknDWSHNgEFDI0QgQOFIgOYFIZEiWJBgxWBPg X-IPAS-Result: AgkEAE1wk1LRVdYwnGdsb2JhbABZgh+BILwsgXgWDgEBAQEBBg0JCRQhB4JsARscAgMSEBYWGAMCAQIBEREBBQEiDQgCh2oBAw8EAQidfoMFjFmDCYQoChknDWSHNgEFDI0QgQOFIgOYFIZEiWJBgxWBPg X-IronPort-AV: E=Sophos;i="4.93,768,1378850400"; d="scan'208";a="45273360" Received: from mail-bk0-f48.google.com ([209.85.214.48]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 25 Nov 2013 16:46:04 +0100 Received: by mail-bk0-f48.google.com with SMTP id v10so2033857bkz.21 for ; Mon, 25 Nov 2013 07:46:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=kJXrfhjmQj6Q27AwelEs+6Xuif9Yqwy7dP7fvqIyKhg=; b=woM3h5lb76d6/jI/4kMAh3E6jSzGEcpp1pO/XOl2dOHipQdZg0DYRBJl8ryiRCXxkt 8VLQdjLFRVa2S2wjNWVNaj7DO/D1du/TnNHugIR51bSyyJT/8/2Z4OzkjKMpDbKiKXGU ua3+REBzam04KHzerTPuodIYHhcfy3Tm9/VvuD1SxtfEwKKNFOfVpDOrwKdkDjpg6Tzn OWK9jPJBELDCeYkGr12T9xMwQvrCXw7un1y7HyVsbCaVcqCV3malkJORk7j5LD8Nt0V2 lK9XCb9+Td0vs4GUeOaBQhph/0upR5y4M9o7r8p6VhuRUDctJYJT+oDUaPOCdJDh5Z/5 ps2A== X-Received: by 10.204.107.140 with SMTP id b12mr1830045bkp.58.1385394364182; Mon, 25 Nov 2013 07:46:04 -0800 (PST) Received: from [172.27.6.157] ([213.106.240.92]) by mx.google.com with ESMTPSA id zl3sm46874592bkb.4.2013.11.25.07.46.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Nov 2013 07:46:03 -0800 (PST) Message-ID: <529370C0.9020801@gmail.com> Date: Mon, 25 Nov 2013 15:46:08 +0000 From: Matej Kosik <5764c029b688c1c0d24a2e97cd764f@gmail.com> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131005 Icedove/17.0.9 MIME-Version: 1.0 To: "caml-list@inria.fr" X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Caml-list] [batteries] ... how to create (format) directives that do not take any arguments? 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 bold regular italic 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.