From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jambunathan K Subject: Re: example or source blocks with captions Date: Sat, 30 Apr 2011 10:30:08 +0530 Message-ID: <81tydg8gmu.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:36071) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QG2WL-0000TS-Vj for emacs-orgmode@gnu.org; Sat, 30 Apr 2011 01:15:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QG2WK-00011a-T0 for emacs-orgmode@gnu.org; Sat, 30 Apr 2011 01:15:09 -0400 Received: from mail-pw0-f41.google.com ([209.85.160.41]:58536) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QG2WK-000118-Ix for emacs-orgmode@gnu.org; Sat, 30 Apr 2011 01:15:08 -0400 Received: by pwi10 with SMTP id 10so2848003pwi.0 for ; Fri, 29 Apr 2011 22:15:07 -0700 (PDT) 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: emacs-orgmode@gnu.org (Forwarding it - Looks like the original mail didn't make it's way to the list) > Hi Neilen, > > Neilen Marais wrote: >> Is it possible to caption a #+begin_src or #+begin_example block? Doing >> >> #+CAPTION: dipole_analytical_balanis.mac >> #+begin_example >> .... >> #+end_example >> >> doesn't seem to do the trick. I would find this useful to include >> suggested filenames when quoting source on a web page. > > Would such block be better for you? > > #+srcname: dipole_analytical_balanis.mac > #+begin_src mac > .... > #+end_src > > The source name should be exported in HTML. If not, this is a feature.[1] > A cursory look suggests that org-export-format-source-code-or-example takes caption as an arg. This is used only if htmlize or org-export-latex-listings is configured by the user - Both of these are not part of factory settings and wouldn't work out of the box. (Seems like the situation could be improved) ASCII export always exports a caption without fail. So if I export * Source Block ** Emacs Lisp Block --8<---------------cut here---------------start------------->8--- #+CAPTION: HelloWorldCaption #+srcname: HelloWorldSrcName #+begin_src emacs-lisp (defun helloworld () "" (message "hello world")) #+end_src --8<---------------cut here---------------end--------------->8--- I get something like --8<---------------cut here---------------start------------->8--- 1 Source Block --------------- 1.1 Emacs Lisp Block ===================== (defun helloworld () "" (message "hello world")) --8<---------------cut here---------------end--------------->8--- meaning that captions are not possibly passed into org-export-format-source-code-or-example. A cursory look at org-export-attach-captions-and-attributes where ('org-caption text property is added) suggests that captions are not getting associated with the src blocks. In summary, there seems to be a clear intent to attach a caption to example or source blocks but somehow things are turning out otherwise. Jambunathan K. > Best regards, > Seb > > Footnotes: > > [1] I know for sure it does when the block has "grounded" parameters (ie, with > a given value). --