David Masterson <dsmaster...@icloud.com> writes:

> Is there a way to export a section of an Org file only if the export
> backend is *NOT* a particular backend?  For instance, some things don't
> work in Texinfo, but are fine in HTML and LATEX.
>
> Is there a generalized IF for processing an Org file?

Nothing out of the box, but you can, for example, introduce a custom
attribute that will control that.

#+attr_all: :export (not texinfo)
Some text _not_ for texinfo here.

Then,
(defun yant/org-export-conditional-export (data backend info)
  (org-element-map data org-element-all-elements
    (lambda (el)
      (pcase (car (read-from-string (or (org-export-read-attribute :attr_all el 
:export) "nil")))
        (`nil t)
        (`(not . ,backends)
         (when (member backend backends)
           (org-element-extract el)))
        (backends
         (unless (member backend backends)
           (org-element-extract el)))))
    info nil nil t)
  data)
(add-to-list 'org-export-filter-parse-tree-functions  
#'yant/org-export-conditional-export)


-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to