emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Nicolas Berthier <nberth@member.fsf.org>
Cc: Bastien <bzg@gnu.org>, Aaron Ecay <aaronecay@gmail.com>,
	emacs-orgmode@gnu.org
Subject: Re: [babel][PATCHES] exporting inline source code
Date: Wed, 30 Jul 2014 21:26:08 +0200	[thread overview]
Message-ID: <8761iesl67.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <vp0ovbqezv8q.fsf@epicea.irisa.fr> (Nicolas Berthier's message of "Wed, 30 Jul 2014 18:06:45 +0200")

Hello,

Nicolas Berthier <nberth@member.fsf.org> 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	other threads:[~2014-07-30 19:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-13 17:37 [babel][PATCHES] exporting inline source code Nicolas Berthier
2014-06-22  4:02 ` Aaron Ecay
2014-07-27 17:23   ` Bastien
2014-07-29  7:40     ` Nicolas Berthier
2014-07-29 13:19       ` Bastien
2014-07-30 16:06         ` Nicolas Berthier
2014-07-30 19:26           ` Nicolas Goaziou [this message]
2014-07-30 20:01             ` Achim Gratz
2014-07-30 20:23               ` Nicolas Goaziou
2014-08-01 12:23             ` Nicolas Berthier
2014-08-22 12:47               ` Nicolas Goaziou
2014-08-22 13:32                 ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8761iesl67.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=aaronecay@gmail.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=nberth@member.fsf.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).