From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heikki Lehvaslaiho Subject: Re: Controlling example block export? Date: Tue, 1 Apr 2014 15:40:14 +0300 Message-ID: References: <87k3b9mkcb.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c2208c65b86d04f5fa798b Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUxzb-0000qR-1w for emacs-orgmode@gnu.org; Tue, 01 Apr 2014 08:40:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUxzX-0000Og-6U for emacs-orgmode@gnu.org; Tue, 01 Apr 2014 08:40:38 -0400 Received: from mail-qc0-x229.google.com ([2607:f8b0:400d:c01::229]:57273) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUxzW-0000OP-QO for emacs-orgmode@gnu.org; Tue, 01 Apr 2014 08:40:35 -0400 Received: by mail-qc0-f169.google.com with SMTP id i17so10586279qcy.14 for ; Tue, 01 Apr 2014 05:40:34 -0700 (PDT) In-Reply-To: <87k3b9mkcb.fsf@gmail.com> 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: Thorsten Jolitz Cc: emacs-orgmode@gnu.org --001a11c2208c65b86d04f5fa798b Content-Type: text/plain; charset=ISO-8859-1 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 wrote: > Heikki Lehvaslaiho 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 > > > --001a11c2208c65b86d04f5fa798b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
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 lin= e, and can be omitted.
If NAME is “CENTER”, it w= ill 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 el= ement, 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<= br> - VERSE

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

Note: org-syntax.html  needs updating.
<= br>
So, to implement parameters for the EXAMPLE block, relevant c= ode has to be added to the exporter. That's a nontrivial task to do con= sistently.

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


#+BEGIN_COMMENT :type EXAMPLE
=
 text in a  block
#+END_COMMENT
<>

#+BEGIN_ EXAMPLE
<= div> text in a  block
#+END_EXAMPLE

Unless someone beats me t= o it, I'll write it one day. :)



 =    -Heikki

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

Saudi Arabian weekend is now Fr= iday and Saturday.

KAUST Supercomputing Center, Building #1, Level 0, 0203-WS23
4700 Ki= ng Abdullah University of Science and Technology (KAUST)
Thuwal 23955-69= 00, Kingdom of Saudi Arabia


On 1 April 2014 13:10, Thorsten Jolitz <= span dir=3D"ltr"><tjolitz@gmail.com> wrote:
Heikki Lehvaslaiho <heikki.lehvaslaiho@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

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<= br> > 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 a= nswer
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



--001a11c2208c65b86d04f5fa798b--