>
> On Thu, May 4, 2017 at 1:34 PM Nick Dokos <ndo...@gmail.com> 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

Reply via email to