From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: Cannot get the EXPORT_FILE_NAME override to work Date: Thu, 04 May 2017 19:56:11 +0000 Message-ID: References: <871ss44lud.fsf@alphaville.usersys.redhat.com> <87fugk34st.fsf@alphaville.usersys.redhat.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113cc734d30298054eb82a4e Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6MrS-0001vm-Db for emacs-orgmode@gnu.org; Thu, 04 May 2017 15:56:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6MrR-0005NR-0N for emacs-orgmode@gnu.org; Thu, 04 May 2017 15:56:26 -0400 Received: from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234]:36481) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d6MrQ-0005Mv-LF for emacs-orgmode@gnu.org; Thu, 04 May 2017 15:56:24 -0400 Received: by mail-lf0-x234.google.com with SMTP id h4so14226143lfj.3 for ; Thu, 04 May 2017 12:56:24 -0700 (PDT) In-Reply-To: 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.org@gnu.org Sender: "Emacs-orgmode" To: Nick Dokos , emacs-orgmode@gnu.org --001a113cc734d30298054eb82a4e Content-Type: text/plain; charset=UTF-8 > > On Thu, May 4, 2017 at 1:34 PM Nick Dokos wrote: > >> You could probably org-map your way >> through the subtrees and export each one by calling >> >> (org-export-as 'html t) >> >> N.B. the subtreep setting in this call. > > Thanks for the tip. I ended up with this: (let ((subtree-tags-to-export '("readme" "contributing" "wikitcsh")) ;; If a subtree matches a tag, do not try to export further ;; subtrees separately that could be under that. (org-use-tag-inheritance nil) (org-export-with-toc nil) ;Do not export TOC (org-export-with-tags nil)) ;Do not print tag names in exported files (dolist (tag subtree-tags-to-export) (let* ((exported-file-list (org-map-entries '(org-gfm-export-to-markdown nil :subtreep) tag)) ;; The assumption is that for each tag, *only* one file is exported (exported-file (when exported-file-list (car exported-file-list)))) (when (string-match-p "\\`wiki.+" tag) ;Move the wiki files to the correct directory (rename-file (expand-file-name exported-file eless-root-dir) (expand-file-name exported-file eless-wiki-dir) :ok-if-already-exists))))) https://github.com/kaushalmodi/eless/blob/4c4aea14f7293b25644d48ebf90dbc68cf1b3654/build/build.el#L88-L104 -- Kaushal Modi --001a113cc734d30298054eb82a4e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
=
On Thu, May 4,= 2017 at 1:34 PM Nick Dokos <ndokos@gmail.com> wrote:
You could prob= ably org-map your way
through the subtrees and export each one by calling

=C2=A0 =C2=A0(org-export-as 'html t)

N.B. the subtreep setting in this call.

Thanks for the tip. I ended up with this:
<= br>
(let ((subtree-tags-to-export '("readme" "= contributing"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "wi= kitcsh"))
=C2=A0 =C2=A0 =C2=A0 ;; If a subtree matches a tag= , do not try to export further
=C2=A0 =C2=A0 =C2=A0 ;; subtrees s= eparately that could be under that.
=C2=A0 =C2=A0 =C2=A0 (org-use= -tag-inheritance nil)
=C2=A0 =C2=A0 =C2=A0 (org-export-with-toc n= il) =C2=A0;Do not export TOC
=C2=A0 =C2=A0 =C2=A0 (org-export-wit= h-tags nil)) ;Do not print tag names in exported files
=C2=A0 (do= list (tag subtree-tags-to-export)
=C2=A0 =C2=A0 (let* ((exported-= file-list (org-map-entries '(org-gfm-export-to-markdown nil :subtreep) = tag))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; The assumption = is that for each tag, *only* one file is exported
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(exported-file (when exported-file-list
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 (car exported-file-list))))
=C2=A0 =C2= =A0 =C2=A0 (when (string-match-p "\\`wiki.+" tag) ;Move the wiki = files to the correct directory
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (renam= e-file (expand-file-name exported-file eless-root-dir)
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(expand-f= ile-name exported-file eless-wiki-dir)
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0:ok-if-already-exists))= )))=C2=A0


--

Kaushal Modi

--001a113cc734d30298054eb82a4e--