emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Hiding a node title in export but not the content
@ 2020-01-09  8:20 Sven Bretfeld
  2020-01-09  9:48 ` Fraga, Eric
  0 siblings, 1 reply; 7+ messages in thread
From: Sven Bretfeld @ 2020-01-09  8:20 UTC (permalink / raw)
  To: emacs-orgmode

Hi everybody

Is this possible?

** headline      <-- not exported
   :PROPERTIES:  <-- not exported
   Some content. <-- exported

The reason is that I use to finely pre-structure articles, starting with
org-brain and gradually developing each node into a paragraph of the
article. So basically each argumentative or informative block is an
individual org-node. In this way paragraphs of the article can be kept
mobile during the writing process and they can easily be moved when I
decide to restructure the text.

In a LaTeX export of the draft, each node-name is, of course,
interpreted as a section/subsection title, leaving me with dozens of
headlines for a 10-paper draft. Very disturbing while
proof-reading. This is why I'm looking for a way to exclude the
headlines from the export. They should be interpreted as a blank line,
so that LaTeX simply makes a new paragraph.

It would be even better if the node names can be converted to margin
text instead of completely hiding them. This would be a great
orientation help without distracting the reading flow.

Thanks for ideas,

Sven

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Hiding a node title in export but not the content
  2020-01-09  8:20 Hiding a node title in export but not the content Sven Bretfeld
@ 2020-01-09  9:48 ` Fraga, Eric
  2020-01-09 10:38   ` Sven Bretfeld
  2020-01-09 15:09   ` Alain.Cochard
  0 siblings, 2 replies; 7+ messages in thread
From: Fraga, Eric @ 2020-01-09  9:48 UTC (permalink / raw)
  To: Sven Bretfeld; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Hiding a node title in export but not the content
  2020-01-09  9:48 ` Fraga, Eric
@ 2020-01-09 10:38   ` Sven Bretfeld
  2020-01-09 12:04     ` Fraga, Eric
  2020-01-09 15:09   ` Alain.Cochard
  1 sibling, 1 reply; 7+ messages in thread
From: Sven Bretfeld @ 2020-01-09 10:38 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Hiding a node title in export but not the content
  2020-01-09 10:38   ` Sven Bretfeld
@ 2020-01-09 12:04     ` Fraga, Eric
  2020-01-09 12:48       ` Sven Bretfeld
  0 siblings, 1 reply; 7+ messages in thread
From: Fraga, Eric @ 2020-01-09 12:04 UTC (permalink / raw)
  To: Sven Bretfeld; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Hiding a node title in export but not the content
  2020-01-09 12:04     ` Fraga, Eric
@ 2020-01-09 12:48       ` Sven Bretfeld
  0 siblings, 0 replies; 7+ messages in thread
From: Sven Bretfeld @ 2020-01-09 12:48 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Hiding a node title in export but not the content
  2020-01-09  9:48 ` Fraga, Eric
  2020-01-09 10:38   ` Sven Bretfeld
@ 2020-01-09 15:09   ` Alain.Cochard
  2020-01-09 15:33     ` Fraga, Eric
  1 sibling, 1 reply; 7+ messages in thread
From: Alain.Cochard @ 2020-01-09 15:09 UTC (permalink / raw)
  To: Fraga, Eric; +Cc: Sven Bretfeld, emacs-orgmode


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Hiding a node title in export but not the content
  2020-01-09 15:09   ` Alain.Cochard
@ 2020-01-09 15:33     ` Fraga, Eric
  0 siblings, 0 replies; 7+ messages in thread
From: Fraga, Eric @ 2020-01-09 15:33 UTC (permalink / raw)
  To: Alain.Cochard; +Cc: Sven Bretfeld, emacs-orgmode

On Thursday,  9 Jan 2020 at 16:09, Alain.Cochard@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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-01-09 15:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-09  8:20 Hiding a node title in export but not the content Sven Bretfeld
2020-01-09  9:48 ` Fraga, Eric
2020-01-09 10:38   ` Sven Bretfeld
2020-01-09 12:04     ` Fraga, Eric
2020-01-09 12:48       ` Sven Bretfeld
2020-01-09 15:09   ` Alain.Cochard
2020-01-09 15:33     ` Fraga, Eric

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).