all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* tagged code blocks
@ 2016-06-24  8:21 claude fuhrer
  2016-06-24  9:16 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: claude fuhrer @ 2016-06-24  8:21 UTC (permalink / raw)
  To: emacs-orgmode

Hi all

I'm trying to write a document where some source codes block may be 
conditionally excluded from export.

Here a small example of what I want, with the wrong syntax:


===========================================
#+EXCLUDE_TAGS  solution

#+begin_src java :tag question
    public class Test {
     // write java code here

     }
#+end_src


and the solution is:

#+begin_src java :tag solution
      // the solution here
#+end_src
==========================================


So then, I only need to modify the EXCLUDE_TAGS to generate a document 
with or without solution.

Thank you in advance for your help

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: tagged code blocks
  2016-06-24  8:21 tagged code blocks claude fuhrer
@ 2016-06-24  9:16 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2016-06-24  9:16 UTC (permalink / raw)
  To: claude fuhrer; +Cc: emacs-orgmode

Hello,

claude fuhrer <claude@fuhrer.ch> writes:

> I'm trying to write a document where some source codes block may be 
> conditionally excluded from export.
>
> Here a small example of what I want, with the wrong syntax:
>
>
> ===========================================
> #+EXCLUDE_TAGS  solution
>
> #+begin_src java :tag question
>     public class Test {
>      // write java code here
>
>      }
> #+end_src
>
>
> and the solution is:
>
> #+begin_src java :tag solution
>       // the solution here
> #+end_src
> ==========================================
>
>
> So then, I only need to modify the EXCLUDE_TAGS to generate a document 
> with or without solution.

I would use drawers for this, but there are probably other ways:

  #+options: d:(not "SOLUTION")

  :QUESTION:
  #+begin_src emacs-lisp
  (+ 1 1)
  #+end_src
  :END:

  :SOLUTION:
  #+begin_src emacs-lisp
  10
  #+end_src
  :END:

where "d:t" would give you the full output.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-24  9:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-24  8:21 tagged code blocks claude fuhrer
2016-06-24  9:16 ` Nicolas Goaziou

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.