Re: Hiding a node title in export but not the content

2020-01-09 Thread Fraga, Eric
On Thursday,  9 Jan 2020 at 16:09, alain.coch...@unistra.fr wrote:
> It seems to me that this is what you are referring to, Eric: using the
> :ignore: tag in conjunction with package 'ox-extra'.

Thanks.  I haven't tried it but, looking at the documentation & code, it
does what my little snippet does and a lot more.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.3-34-g2eee3c



Re: Hiding a node title in export but not the content

2020-01-09 Thread Alain . Cochard


 > Note that my implementation is old and it could very well be that
 > later versions of org have introduced something to cater for this
 > use case.  I have org customizations going back over 10 years...

It seems to me that this is what you are referring to, Eric: using the
:ignore: tag in conjunction with package 'ox-extra'.


-- 
EOST (École et Observatoire des Sciences de la Terre) 
IPG (Institut de Physique du Globe) | alain.coch...@unistra.fr
5 rue René Descartes   [bureau 106] | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France| Fax:   +33 (0)3 68 85 01 25 



Re: Hiding a node title in export but not the content

2020-01-09 Thread Sven Bretfeld
Fraga, Eric writes:

> On Thursday,  9 Jan 2020 at 11:38, Sven Bretfeld wrote:
>> Works like a charm! Almost perfect. Thank you very much. One problem:
>> For some reason the :ignoreheading: tag causes the PROPERTY drawer to be
>> exported. 
>
> Ah, probably because the property drawer is now not in the right place
> (i.e. immediately after a headline) so prop:nil doesn't affect it.  You
> may need to disable export of all drawers (d:nil) which may or may not
> cause you other problems...

Oh yes, works. I never need any drawers in the output, so I disabled
them globally:

(setq org-export-with-drawers nil)

So far no unwanted consequences.

Thank you very much,

Sven

-- 
Sven Bretfeld
Department of Philosophy and Religious Studies
NTNU Trondheim




Re: Hiding a node title in export but not the content

2020-01-09 Thread Fraga, Eric
On Thursday,  9 Jan 2020 at 11:38, Sven Bretfeld wrote:
> Works like a charm! Almost perfect. Thank you very much. One problem:
> For some reason the :ignoreheading: tag causes the PROPERTY drawer to be
> exported. 

Ah, probably because the property drawer is now not in the right place
(i.e. immediately after a headline) so prop:nil doesn't affect it.  You
may need to disable export of all drawers (d:nil) which may or may not
cause you other problems...
-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.3-34-g2eee3c



Re: Hiding a node title in export but not the content

2020-01-09 Thread Sven Bretfeld
Fraga, Eric writes:

> On Thursday,  9 Jan 2020 at 09:20, Sven Bretfeld wrote:
>> Hi everybody
>>
>> Is this possible?
>>
>> ** headline  <-- not exported
>>:PROPERTIES:  <-- not exported
>>Some content. <-- exported
>
> yes.  I do this all the time to add structure to a document, structure
> that is not required in the exported version.
>
> I have the following code:
>
> #+begin_src emacs-lisp
>   (defun esf/remove-lines-with-ignore-heading-tag (backend)
> (message "Deleting lines with ignore heading tag")
> (while (search-forward-regexp "^\\*+.*[ 
> \t]+[a-ZA-Z0-9:]*:ignoreheading:[a-ZA-Z0-9:]*$" (point-max) t)
>   (cond
>((eq backend 'latex) (replace-match "#+latex: % \\&" ))
>((eq backend 'html) (replace-match "#+html: " ))
>(t (replace-match ""
> (message "... done deleting ignored headings."))
>   (add-hook 'org-export-before-processing-hook 
> 'esf/remove-lines-with-ignore-heading-tag)
> #+end_src
>
> which then causes any headline with the ignoreheading tag to be removed,
> leaving the subtree under that headline present.

Works like a charm! Almost perfect. Thank you very much. One problem:
For some reason the :ignoreheading: tag causes the PROPERTY drawer to be
exported. So every paragraph starts with the org-brain ID of the node. I
have the option prop:nil set in the file but it is ignored for nodes
containing the :ignoreheading: tag. Same for other properties like
CATEGORY. I saw properties unexpectedly exported already yesterday,
before I had your code. It went away after I inserted the prop:nil
option. But now it's back. Some changes in a recent update that I'm
unaware of?

> One caveat: the subtree content inherits behaviour from the previous
> headline.  For instance, if the previous headline was one that would not
> be exported at all, then this subtree will also not be exported.  E.g.:

This is fine for me.

Sven

--
Sven Bretfeld
Department of Philosophy and Religious Studies
NTNU Trondheim



Re: Hiding a node title in export but not the content

2020-01-09 Thread Fraga, Eric
On Thursday,  9 Jan 2020 at 09:20, Sven Bretfeld wrote:
> Hi everybody
>
> Is this possible?
>
> ** headline  <-- not exported
>:PROPERTIES:  <-- not exported
>Some content. <-- exported

yes.  I do this all the time to add structure to a document, structure
that is not required in the exported version.

I have the following code:

#+begin_src emacs-lisp
  (defun esf/remove-lines-with-ignore-heading-tag (backend)
(message "Deleting lines with ignore heading tag")
(while (search-forward-regexp "^\\*+.*[ 
\t]+[a-ZA-Z0-9:]*:ignoreheading:[a-ZA-Z0-9:]*$" (point-max) t)
  (cond
   ((eq backend 'latex) (replace-match "#+latex: % \\&" ))
   ((eq backend 'html) (replace-match "#+html: " ))
   (t (replace-match ""
(message "... done deleting ignored headings."))
  (add-hook 'org-export-before-processing-hook 
'esf/remove-lines-with-ignore-heading-tag)
#+end_src

which then causes any headline with the ignoreheading tag to be removed,
leaving the subtree under that headline present.

One caveat: the subtree content inherits behaviour from the previous
headline.  For instance, if the previous headline was one that would not
be exported at all, then this subtree will also not be exported.  E.g.:

#+begin_src org
  ,* heading 1
  Text that will be exported
  ,* heading 2:ignoreheading:
  Text that will also be exported but without the heading
  ,* heading 3 :noexport:
  Text that will not be exported.
  ,* heading 4:ignoreheading:
  Text here will also not be exported because it ends up being under
  "heading 3" which has the :noexport: tag.
#+end_src

Note that my implementation is old and it could very well be that later
versions of org have introduced something to cater for this use case.  I
have org customizations going back over 10 years...

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.3-34-g2eee3c