Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignoreheading tag does not work properly on level 4 #9

Closed
Berndone opened this issue Jul 16, 2024 · 1 comment · Fixed by #10
Closed

ignoreheading tag does not work properly on level 4 #9

Berndone opened this issue Jul 16, 2024 · 1 comment · Fixed by #10

Comments

@Berndone
Copy link

When using the ignoreheading tag it does not work on the first entry of a level 4 heading. E.g.

* A
** B
*** C
**** D1   :ignoreheading:
Foo
**** D2   :ignoreheading:
Bar

results in the exported block

\begin{enumerate}
\item D1\hfill{}\textsc{ignoreheading}
\label{sec:org0817d3c}
Foo
\label{sec:org5d8ea88}
Bar
\end{enumerate}

D1 gets exported, because the regex pattern in the function sa-ignore-headline in org-files-to-tex.el matches only the line \item D1\hfill{}\textsc{ignoreheading} but for the first entry \begin{enumerate} is part of the string which does not lead to a match. Extending the regex is not really an option: If \begin{enumerate} gets removed there is a lonely \end{enumerate}.

For me, replacing sa-ignore-headline with the following block worked, but I don't know if this has some unwanted side effects I'm not aware about:

(defun org-remove-headlines (backend)
  "Remove headlines with :ignoreheading: tag."
  (org-map-entries (lambda () (delete-region (point-at-bol) (point-at-eol)))
                   "ignoreheading"))
(add-hook 'org-export-before-processing-hook #'org-remove-headlines)
@fangohr
Copy link
Owner

fangohr commented Jul 16, 2024

Thanks for the input. I'd be happy to include a pull request with that change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants