emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] tagged code blocks


From: Nicolas Goaziou
Subject: Re: [O] tagged code blocks
Date: Fri, 24 Jun 2016 11:16:33 +0200

Hello,

claude fuhrer <address@hidden> 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



reply via email to

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