From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sven Bretfeld Subject: Re: Hiding a node title in export but not the content Date: Thu, 09 Jan 2020 11:38:51 +0100 Message-ID: <87k160didg.fsf@ntnu.no> References: <87muaxca82.fsf@ntnu.no> <877e21hsf2.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:55101) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipVP0-0002Wh-P2 for emacs-orgmode@gnu.org; Thu, 09 Jan 2020 05:50:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipVOy-00048H-Ue for emacs-orgmode@gnu.org; Thu, 09 Jan 2020 05:50:58 -0500 Received: from mailgw02.it.ntnu.no ([2001:700:300:3::175]:55934) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ipVOy-0003pH-KM for emacs-orgmode@gnu.org; Thu, 09 Jan 2020 05:50:56 -0500 Received: from localhost (localhost [127.0.0.1]) by mailgw02.it.ntnu.no (Postfix) with ESMTP id 34D1F8047A0 for ; Thu, 9 Jan 2020 11:50:52 +0100 (CET) Received: from mailgw02.it.ntnu.no ([127.0.0.1]) by localhost (mailgw02.it.ntnu.no [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id unOmhGpZRCf8 for ; Thu, 9 Jan 2020 11:50:51 +0100 (CET) Received: from relwi-brf (unknown [IPv6:2001:700:300:1302:6600:6aff:fe62:4b39]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: svenbre) by mailgw02.it.ntnu.no (Postfix) with ESMTPSA id E8D198047CD for ; Thu, 9 Jan 2020 11:38:51 +0100 (CET) In-reply-to: <877e21hsf2.fsf@ucl.ac.uk> 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-mx.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org 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