emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Controlling example block export?


From: Charles Berry
Subject: Re: [O] Controlling example block export?
Date: Tue, 1 Apr 2014 16:33:45 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Heikki Lehvaslaiho <heikki.lehvaslaiho <at> gmail.com> writes:

> 
> 
> 
> I am using example blocks as inline notes where I paste snippets of 
> (pre-formatted) text. I'd like to  be able to control the exporting of 
> those block individually (per document would also be useful). I do not 
> seem to be able to find documentation about anything along those lines. 
> 
> 
> Here is a mock-up:
> 
> 
> #+BEGIN_EXAMPLE :exports none
> private notes...
> #+END_EXAMPLE
> 
> 

Advise or redefine the org-<backend>-example-block function to use
:switches to decide whether to skip an example block.

Something like this:

#+BEGIN_SRC emacs-lisp

  (defvar org-example-block-skip ":skip"
    "example block :switch to skip.")

  (defun org-latex-example-block (example-block contents info)
      "Transcode an EXAMPLE-BLOCK element from Org to LaTeX.
    CONTENTS is nil.  INFO is a plist holding contextual
    information."
      (when (and (org-string-nw-p 
                  (org-element-property :value example-block))
                 (not (string= 
                       org-example-block-skip 
                       (org-element-property :switches example-block))))
        (org-latex--wrap-label
         example-block
         (format "\\begin{verbatim}\n%s\\end{verbatim}"
                 (org-export-format-code-default 
                  example-block info)))))

#+END_SRC

> A bigger question is that while code blocks are well defined and well 
> documented, all other blocks are not. Is there somewhere a design 
> document the would give a logic of having different blocks and how they 
> are controlled? Maybe there is an other type of a block that does what I 
> want?
> 
> 
> The inline documentation in ox*.el files is too low level to be helpful.
> 

See also org-element.el and 
http://orgmode.org/worg/dev/org-export-reference.html

Looking at what (org-element-at-point) returns often helps.

Special blocks are another possibility, but will require some customization.

HTH,

Chuck





reply via email to

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