emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* "ignoreheading" for non-beamer export
@ 2013-07-25 21:42 James Harkins
  2013-07-26 11:41 ` Suvayu Ali
  0 siblings, 1 reply; 2+ messages in thread
From: James Harkins @ 2013-07-25 21:42 UTC (permalink / raw)
  To: orgmode

Hi, I found an inventive solution by Suvayu to discard headlines from export here [1], but the 8.0+ solution throws an error in my environment.

(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 headline)))
    (replace-match "" nil nil headline)))

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

--> string-match: Symbol's value as variable is void: headline

It seems it should actually be:

(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)

I'm not allowed to reply to the answer on stackexchange, so I'm posting here.

Thanks.
hjh

[1] http://stackoverflow.com/questions/10295177/is-there-an-equivalent-of-org-modes-b-ignoreheading-for-non-beamer-documents

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: "ignoreheading" for non-beamer export
  2013-07-25 21:42 "ignoreheading" for non-beamer export James Harkins
@ 2013-07-26 11:41 ` Suvayu Ali
  0 siblings, 0 replies; 2+ messages in thread
From: Suvayu Ali @ 2013-07-26 11:41 UTC (permalink / raw)
  To: emacs-orgmode

Hi James,

On Thu, Jul 25, 2013 at 05:42:00PM -0400, James Harkins wrote:
> Hi, I found an inventive solution by Suvayu to discard headlines from export here [1], but the 8.0+ solution throws an error in my environment.
> 
> (defun sa-ignore-headline (contents backend info)

 [...chomp...chomp...chomp...]

>                 (downcase headline)))
>     (replace-match "" nil nil headline)))
> 
> (add-to-list 'org-export-filter-headline-functions 'sa-ignore-headline)
> 
> --> string-match: Symbol's value as variable is void: headline
> 
> It seems it should actually be:
> 
> (defun sa-ignore-headline (contents backend info)

 [...chomp...chomp...chomp...]

>                 (downcase contents)))
>     (replace-match "" nil nil contents)))
> 
> (add-to-list 'org-export-filter-headline-functions 'sa-ignore-headline)

Oops, typo!  Also a correction, I had a solution for the old exporter.
If I recall correctly Nick Dokos helped me come up with it.  The 8.0<
solution was from Rasmus based on suggestions from Nicolas.

I'll update the answer on SO.

Thanks for checking it,

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-26 11:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-25 21:42 "ignoreheading" for non-beamer export James Harkins
2013-07-26 11:41 ` Suvayu Ali

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).