From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [babel][PATCHES] exporting inline source code Date: Wed, 30 Jul 2014 21:26:08 +0200 Message-ID: <8761iesl67.fsf@nicolasgoaziou.fr> References: <878uopbnhi.fsf@gmail.com> <874my19z1f.fsf@bzg.ath.cx> <87a97sfgkx.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCZVO-000293-As for emacs-orgmode@gnu.org; Wed, 30 Jul 2014 15:25:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCZVG-00007b-HQ for emacs-orgmode@gnu.org; Wed, 30 Jul 2014 15:25:42 -0400 In-Reply-To: (Nicolas Berthier's message of "Wed, 30 Jul 2014 18:06:45 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Berthier Cc: Bastien , Aaron Ecay , emacs-orgmode@gnu.org Hello, Nicolas Berthier writes: > In any case, as advised earlier in the discussion, I updated one patch > to integrate new tests for the new feature. I also slightly simplified > the HTML export patch to avoid useless display attributes. Thank you for this nice patch. Some comments follow. > + "\\(?:^\\|[^-[:alnum:]]\\)\\(src_\\([^ \f\t\n\r\v\\[]+\\)" I think "[^ \f\t\n\r\v[]" is enough. > +(defcustom org-babel-exp-inline-code-template > + "src_%lang[%switches%flags]{%body}" > + "Template used to export the body of inline code blocks. > +This template may be customized to include additional information > +such as the code block name, or the values of particular header > +arguments. The template is filled out using `org-fill-template', > +and the following %keys may be used. > + > + lang ------ the language of the code block > + name ------ the name of the code block > + body ------ the body of the code block > + switches -- the switches associated to the code block > + flags ----- the flags passed to the code block > + > +In addition to the keys mentioned above, every header argument > +defined for the code block may be used as a key and will be > +replaced with its value." > + :group 'org-babel > + :type 'string) You need to add :version and :package-version values for new defcustoms. > +(ert-deftest ob-exp/exports-inline-code () > + (should > + (string-match > + (replace-regexp-in-string > + "\\\\\\[]{" "\\(?:\\[]\\)?{" ;accept both src_sh[]{...} or src_sh{...} > + (regexp-quote "Here is one in the middle src_sh[]{echo 1} of a line. > +Here is one at the end of a line. src_sh[]{echo 2} > +src_sh[]{echo 3} Here is one at the beginning of a line. > +Here is one that is also evaluated: src_sh[]{echo 4} =4=") > + nil t) > + (org-test-at-id "cd54fc88-1b6b-45b6-8511-4d8fa7fc8076" > + (org-narrow-to-subtree) > + (org-test-with-expanded-babel-code (buffer-string)))))) It is a matter of taste, but I think tests should be self-contained. In particular, it isn't fun debugging `org-test-at-id'. The same goes for other tests. > + (if lang > + (format "%s" lang label code) > + (format "\n%s" label code))))) LANG cannot be nil. So, (format "%s" lang label code) is sufficient. Regards, -- Nicolas Goaziou