emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [babel][PATCHES] exporting inline source code


From: Nicolas Goaziou
Subject: Re: [O] [babel][PATCHES] exporting inline source code
Date: Wed, 30 Jul 2014 21:26:08 +0200

Hello,

Nicolas Berthier <address@hidden> 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 "<code class=\"src src-%s\"%s>%s</code>" lang label code)
> +       (format "<code class=\"example\"%s>\n%s</code>" label code)))))

LANG cannot be nil. So,

  (format "<code class=\"src src-%s\"%s>%s</code>" lang label code)

is sufficient.


Regards,

-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]