From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: ox-publish export subtree scopes? (Was: org to static site?) Date: Tue, 05 Dec 2017 19:10:17 +0000 Message-ID: References: <86fu8w5oyf.fsf@gmail.com> <87fu8unqut.fsf@hyperbola.info> <86wp25kfgb.fsf@gmail.com> <87o9nd73ww.fsf@gmx.us> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a113edb7682ad0c055f9c96b8" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eMIbu-0004J9-Mv for emacs-orgmode@gnu.org; Tue, 05 Dec 2017 14:10:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eMIbt-0000bR-5V for emacs-orgmode@gnu.org; Tue, 05 Dec 2017 14:10:30 -0500 Received: from mail-yb0-x22b.google.com ([2607:f8b0:4002:c09::22b]:42522) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eMIbs-0000bG-U9 for emacs-orgmode@gnu.org; Tue, 05 Dec 2017 14:10:29 -0500 Received: by mail-yb0-x22b.google.com with SMTP id t127so580528ybf.9 for ; Tue, 05 Dec 2017 11:10:28 -0800 (PST) In-Reply-To: <87o9nd73ww.fsf@gmx.us> 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: Rasmus Cc: emacs-orgmode@gnu.org --001a113edb7682ad0c055f9c96b8 Content-Type: text/plain; charset="UTF-8" On Tue, Dec 5, 2017 at 7:31 AM Rasmus wrote: > If you have any suggestions on how to improve ox-publish to better suit > please share them. > Hello Rasmus, I'd like to make the ox-publish based exporting working for my ox-hugo[1] package but so far have been unsuccessful. The main reason is that org-foo-publish-to-bar functions take only plist, filename and pub-dir as args. I miss the ability to first pick a subtree scope from the specific Org file and then export only that. Is something like that already possible which I am missing? In addition, when given a file name, I need to auto-decide (i) if I need to cycle through "valid" subtrees (see more about that below) and export those subtrees,or (ii) export the whole Org file if #+TITLE is present. So I ended up with org-hugo-export-wim-to-md[2] ("wim" stands for What I Mean). Below is a snippet from its doc string: ===== - If the current subtree has the \"EXPORT_FILE_NAME\" property, export that subtree. - If the current subtree doesn't have that property, but one of its parent subtrees has, then export from that subtree's scope. - If none of the subtrees have that property (or if there are no Org subtrees at all), but the Org #+TITLE keyword is present, export the whole Org file as a post with that title (calls `org-hugo-export-to-md' with its SUBTREEP argument set to nil). - If ALL-SUBTREES is non-nil, export all valid Hugo post subtrees \(that have the \"EXPORT_FILE_NAME\" property) in the current file to multiple Markdown posts. - If ALL-SUBTREES is non-nil, and again if none of the subtrees have that property (or if there are no Org subtrees), but the Org #+TITLE keyword is present, export the whole Org file. - If the file neither has valid Hugo post subtrees, nor has the #+TITLE present, throw a user error. If NOERROR is non-nil, use `message' to display the error message instead of signaling a user error. ===== And I use a Makefile[3] to find all Org files in the current directly and call the above function, which then does the right thing as explained in the conditions above. Is there any way to call org-publish to export either the entire file or cycle through the file and export the subtrees matching a predicate? [1]: https://github.com/kaushalmodi/ox-hugo [2]: https://github.com/kaushalmodi/ox-hugo/blob/832a5d7424013f60b77354ec28613440afac0269/ox-hugo.el#L2424-L2448 [3]: https://github.com/kaushalmodi/ox-hugo/blob/master/Makefile -- Kaushal Modi --001a113edb7682ad0c055f9c96b8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Dec 5, 2017 at 7:3= 1 AM Rasmus <rasmus@gmx.us> wrot= e:
If you have any suggestions on = how to improve ox-publish to better suit
please share them.

Hello Rasmus,
<= div>
I'd like to make the ox-publish based exporting work= ing for my ox-hugo[1] package but so far have been unsuccessful.
<= div>
The main reason is that org-foo-publish-to-bar functions= take only plist, filename and pub-dir as args. I miss the ability to first= pick a subtree scope from the specific Org file and then export only that.= Is something like that already possible which I am missing?

=
In addition, when given a file name, I need to auto-decide (i) i= f I need to cycle through "valid" subtrees (see more about that b= elow) and export those subtrees,or (ii) export the whole Org file if #+TITL= E is present.

So I ended up with org-hugo-export-w= im-to-md[2] ("wim" stands for What I Mean). Below is a snippet fr= om its doc string:

=3D=3D=3D=3D=3D
- If = the current subtree has the \"EXPORT_FILE_NAME\" property, export=
=C2=A0 that subtree.
- If the current subtree doesn't have that = property, but one of its
=C2=A0 parent subtrees has, then export from th= at subtree's scope.
- If none of the subtrees have that property (or= if there are no Org
=C2=A0 subtrees at all), but the Org #+TITLE keywor= d is present,
=C2=A0 export the whole Org file as a post with that title= (calls
=C2=A0 `org-hugo-export-to-md' with its SUBTREEP argument se= t to nil).

- If ALL-SUBTREES is non-nil, export all valid Hugo post = subtrees
=C2=A0 \(that have the \"EXPORT_FILE_NAME\" property)= in the current file
=C2=A0 to multiple Markdown posts.
- If ALL-SUBT= REES is non-nil, and again if none of the subtrees have
=C2=A0 that prop= erty (or if there are no Org subtrees), but the Org #+TITLE
=C2=A0 keywo= rd is present, export the whole Org file.

- If the file neither has = valid Hugo post subtrees, nor has the
=C2=A0 #+TITLE present, throw a us= er error.=C2=A0 If NOERROR is non-nil, use
=C2=A0 `message' to displ= ay the error message instead of signaling a user
=C2=A0 error.
=3D=3D= =3D=3D=3D

And I use a Makefile[3] to find all Org = files in the current directly and call the above function, which then does = the right thing as explained in the conditions above.

<= div>Is there any way to call org-publish to export either the entire file o= r cycle through the file and export the subtrees matching a predicate?
<= /div>

--

Kaushal Modi

--001a113edb7682ad0c055f9c96b8--