emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Rasmus <rasmus@gmx.us>
Cc: emacs-orgmode@gnu.org
Subject: ox-publish export subtree scopes? (Was:  org to static site?)
Date: Tue, 05 Dec 2017 19:10:17 +0000	[thread overview]
Message-ID: <CAFyQvY38qg=e49sou3SW==N+e95v=n0oAurRdLaAVT-Tq_b60A@mail.gmail.com> (raw)
In-Reply-To: <87o9nd73ww.fsf@gmx.us>

[-- Attachment #1: Type: text/plain, Size: 2505 bytes --]

On Tue, Dec 5, 2017 at 7:31 AM Rasmus <rasmus@gmx.us> 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

[-- Attachment #2: Type: text/html, Size: 3484 bytes --]

  parent reply	other threads:[~2017-12-05 19:10 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31 15:00 org to static site? Matt Price
2017-05-31 15:08 ` Russell Adams
2017-05-31 15:17   ` Jeffrey Brent McBeth
2017-05-31 15:29     ` Russell Adams
2017-05-31 15:34       ` John Hendy
2017-05-31 16:20         ` Russell Adams
2017-05-31 16:37           ` John Kitchin
2017-05-31 15:32     ` John Hendy
2017-05-31 16:08       ` Puneeth Chaganti
2017-05-31 16:17         ` John Hendy
2017-05-31 17:05 ` Chunyang Xu
2017-05-31 19:51   ` John Ankarström
2017-05-31 18:23 ` lists
2017-06-01  7:46 ` Julian M. Burgos
2017-06-01 10:09 ` Rasmus
2017-06-04 18:26 ` Scott Randby
2017-06-05  5:59   ` John Ankarström
2017-06-05 16:54     ` Scott Randby
2017-06-05 21:16       ` Nick Dokos
2017-06-06  2:41         ` Scott Randby
2017-06-10  9:21           ` Nicolas Goaziou
2017-06-10 18:13             ` Scott Randby
2017-06-06  9:12   ` Fabrice Popineau
2017-06-08  8:14     ` Ken Mankoff
2017-11-30  5:13 ` George myglc2 Clemmer
2017-12-01 17:17   ` Tory S. Anderson
2017-12-01 21:13     ` George myglc2 Clemmer
2017-12-01 20:19   ` Adonay Felipe Nogueira
2017-12-02  2:53     ` myglc2
2017-12-05 12:30       ` Rasmus
2017-12-05 16:40         ` myglc2
2017-12-05 19:10         ` Kaushal Modi [this message]
2017-12-10  7:15           ` ox-publish export subtree scopes? Narendra Joshi
2017-12-19 11:53             ` Rasmus
2018-01-15 21:27           ` Adonay Felipe Nogueira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFyQvY38qg=e49sou3SW==N+e95v=n0oAurRdLaAVT-Tq_b60A@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rasmus@gmx.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).