Secret structure in org mode?

I am wondering if there is any functionality in org mode that can make me work with a secret structure, that is: a structure that I can see when I edit, but it is treated as if it were not there when exporting . This mainly imports when I export to ascii.

Example:

I would like this in a .org file:

* Normal heading
** Secret heading 1
Some text 1
** Secret heading 2
Some text 2
** Secret heading 3
Some text 3

To export to this:

Normal heading
--------------
Some text 1
Some text 2
Some text 3

What makes secret headers such as a tag, property, or something else, but secret headers must be collapsible.

Edit:

Found this solution (from here) (I am using org-mode 7.9.3 f. This does not work. Headers with the tag: ignoreheading: are still displayed:

;; backend aware export preprocess hook
(defun sa-org-export-preprocess-hook ()
  "My backend aware export preprocess hook."
  (save-excursion
    (when (eq org-export-current-backend 'latex)
      ;; ignoreheading tag for bibliographies and appendices
      (let* ((tag "ignoreheading"))
        (org-map-entries (lambda ()
                           (delete-region (point-at-bol) (point-at-eol)))
                         (concat ":" tag ":"))))))

(add-hook 'org-export-preprocess-hook 'sa-org-export-preprocess-hook)
+4
5

org-mode 8.2.5h, :

(defun sa-ignore-headline (contents backend info)
  "Ignore headlines with tag `ignoreheading'."
  (when (and (org-export-derived-backend-p backend 'latex 'html 'ascii)
          (string-match "\\`.*ignoreheading.*\n"
                (downcase contents)))
    (replace-match "" nil nil contents)))

(add-to-list 'org-export-filter-headline-functions 'sa-ignore-headline)

: # + OPTIONS: tags:nil. , , , , , .

: ascii , :

(setq org-ascii-underline (quote ((ascii) (latin1) (utf-8))))

... .

+1

EXCLUDE_TAGS , org-export-exclude-tags. :

#+EXCLUDE_TAGS: noexport

* Public Section

* Secret Section :noexport:

.

+4

, - ():

  • .emacs :

    (require 'ox-extra)
    (ox-extras-activate '(ignore-headlines))
    
  • ignore , ( )

+3

ignoreheading , org-export-before-parsing-hook Org 8.2.10 Emacs 24.1.1.

org-map-entries, , save-recursion. , concat, org-map-entries .

+1

, , ox-extra.el notignore. any, notignore. .

notignore , "", " ", .

notignore-headlines init.el. - .

+1

Source: https://habr.com/ru/post/1535318/


All Articles