From: Sven Bretfeld <sven.bretfeld@ntnu.no>
To: emacs-orgmode@gnu.org
Subject: Re: Hiding a node title in export but not the content
Date: Thu, 09 Jan 2020 11:38:51 +0100 [thread overview]
Message-ID: <87k160didg.fsf@ntnu.no> (raw)
In-Reply-To: <877e21hsf2.fsf@ucl.ac.uk>
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
next prev parent reply other threads:[~2020-01-09 10:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k160didg.fsf@ntnu.no \
--to=sven.bretfeld@ntnu.no \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).