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: Heikki Lehvaslaiho
Subject: Re: [O] Controlling example block export?
Date: Tue, 1 Apr 2014 15:40:14 +0300

Thanks, Torsten. Very illuminating.


The org-syntax.html says of blocks:


#+BEGIN_NAME PARAMETERS
CONTENTS
#+END_NAME

NAME can contain any non-whitespace character.
PARAMETERS can contain any character other than new line, and can be omitted.
If NAME is “CENTER”, it will be a “center block”. If it is “QUOTE”, it will be a “quote block”.
If the block is neither a center block, a quote block or a block element, it will be a “special block”.


That does not seem to be quite true as lisp/org-element.el recognises the following blocks (perlregexp: /begin_(\w+)/i):

- CENTER
- COMMENT
- EXAMPLE
- QUOTE
- SRC
- VERSE

... in addition to any other valid block names. For these, the content is displayed as plain text after striping the BEGIN/END lines unless the exporter used has code for handling it differently.

Note: org-syntax.html  needs updating.

So, to implement parameters for the EXAMPLE block, relevant code has to be added to the exporter. That's a nontrivial task to do consistently.

Incidentally, the solution to my immediate problem is the COMMENT block. Its contents are completely ignored and not passed to exporters. If I find myself using that a lot, a macro or a a function to toggle between these two might come handy:


#+BEGIN_COMMENT :type EXAMPLE
 text in a  block
#+END_COMMENT

<>

#+BEGIN_ EXAMPLE
 text in a  block
#+END_EXAMPLE

Unless someone beats me to it, I'll write it one day. :)



     -Heikki

Heikki Lehvaslaiho - skype:heikki_lehvaslaiho http://about.me/heikki
cell: +966 545 595 849  office: +966 12 808 2429

Saudi Arabian weekend is now Friday and Saturday.

KAUST Supercomputing Center, Building #1, Level 0, 0203-WS23
4700 King Abdullah University of Science and Technology (KAUST)
Thuwal 23955-6900, Kingdom of Saudi Arabia


On 1 April 2014 13:10, Thorsten Jolitz <address@hidden> wrote:
Heikki Lehvaslaiho <address@hidden> 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

I don't think example blocks take arguments. You might try

#+BEGIN_SRC org :exports none
 private notes...
#+END_SRC

or collect these example blocks in subtrees with export tags/properties.

> 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.

AFAIK export of these block types is backend specific, e.g. ox-ascii.el
might treat example block different than ox-html.el, so thats where to
look.

,---------------------------
| C-h v org-export-with- TAB
`---------------------------

gives some hints too. Using drawers instead of example blocks would
enable you to toggle export documentwise.

I asked a similar 'bigger' question before, and remember that the answer
was more or less 'the block name says it all'.

However, here is a (dense) description of the org syntax:

,--------------------------------------------
| http://orgmode.org/worg/dev/org-syntax.html
`--------------------------------------------

--
cheers,
Thorsten




reply via email to

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