* Cannot get the EXPORT_FILE_NAME override to work @ 2017-05-04 15:30 Kaushal Modi 2017-05-04 15:36 ` Kaushal Modi 2017-05-04 16:40 ` Nick Dokos 0 siblings, 2 replies; 7+ messages in thread From: Kaushal Modi @ 2017-05-04 15:30 UTC (permalink / raw) To: emacs-org list [-- Attachment #1: Type: text/plain, Size: 823 bytes --] Hello, I am trying to use the EXPORT_FILE_NAME property for the first time, but it is not working. Here is the MWE: ===== override-export-file-name.org ===== #+TITLE: Test overriding of export file name * Heading 1 :PROPERTIES: :EXPORT_FILE_NAME: foo :END: I want to name the exported file as =foo.=(something). If I export to HTML, it should be named =foo.html=. ===== I am using emacs and org version built from master today. Attempt 1: Export the whole file using C-c C-e h h. But override-export-file-name.html gets created instead of foo.html. Attempt 2: Select just the Heading 1 subtree, narrow to it, and export that using C-c C-e h h. Again override-export-file-name.html gets created instead of foo.html. So when does the EXPORT_FILE_NAME property work? What am I doing wrong? Thanks. -- Kaushal Modi [-- Attachment #2: Type: text/html, Size: 1286 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Cannot get the EXPORT_FILE_NAME override to work 2017-05-04 15:30 Cannot get the EXPORT_FILE_NAME override to work Kaushal Modi @ 2017-05-04 15:36 ` Kaushal Modi 2017-05-04 16:40 ` Nick Dokos 1 sibling, 0 replies; 7+ messages in thread From: Kaushal Modi @ 2017-05-04 15:36 UTC (permalink / raw) To: emacs-org list [-- Attachment #1: Type: text/plain, Size: 1412 bytes --] Here's the motive for this question. I am working on this project ( https://github.com/kaushalmodi/eless ) that is basically a bash script. I have eless.org and am tangling the bash script eless from that, plus all the documentation (HTML, Info, README.md, CONTRIBUTING.md, etc.). The publish project alist is here: https://github.com/kaushalmodi/eless/blob/master/build/build.el If EXPORT_FILE_NAME starting working for me, I would not need these completion functions for publish that just do the file renaming: (defun eless/readme-completion-fn (proj-plist) (let* ((pub-dir (plist-get proj-plist :publishing-directory)) (before-name (concat pub-dir "eless.md")) (after-name (concat pub-dir "README.md"))) (rename-file before-name after-name :ok-if-already-exists))) (defun eless/contributing-completion-fn (proj-plist) (let* ((pub-dir (plist-get proj-plist :publishing-directory)) (before-name (concat pub-dir "eless.md")) (after-name (concat pub-dir "CONTRIBUTING.md"))) (rename-file before-name after-name :ok-if-already-exists))) (defun eless/wiki-tcsh-completion-fn (proj-plist) (let* ((pub-dir (plist-get proj-plist :publishing-directory)) (before-name (concat pub-dir "eless.md")) (after-name (concat pub-dir "Example eless Config in tcsh.md"))) (rename-file before-name after-name :ok-if-already-exists))) -- Kaushal Modi [-- Attachment #2: Type: text/html, Size: 2193 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Cannot get the EXPORT_FILE_NAME override to work 2017-05-04 15:30 Cannot get the EXPORT_FILE_NAME override to work Kaushal Modi 2017-05-04 15:36 ` Kaushal Modi @ 2017-05-04 16:40 ` Nick Dokos 2017-05-04 17:02 ` Kaushal Modi 1 sibling, 1 reply; 7+ messages in thread From: Nick Dokos @ 2017-05-04 16:40 UTC (permalink / raw) To: emacs-orgmode Kaushal Modi <kaushal.modi@gmail.com> writes: > Hello, > > I am trying to use the EXPORT_FILE_NAME property for the first time, but it is not working. > > Here is the MWE: > > ===== override-export-file-name.org ===== > #+TITLE: Test overriding of export file name > > * Heading 1 > :PROPERTIES: > :EXPORT_FILE_NAME: foo > :END: > I want to name the exported file as =foo.=(something). If I export to HTML, it should be named =foo.html > =. > ===== > > I am using emacs and org version built from master today. > > Attempt 1: Export the whole file using C-c C-e h h. But override-export-file-name.html gets created > instead of foo.html. > That does not work: you have to set #+EXPORT_FILE_NAME: foo for that. > Attempt 2: Select just the Heading 1 subtree, narrow to it, and export that using C-c C-e h h. Again > override-export-file-name.html gets created instead of foo.html. > I don't know how narrowing interacts with export but the following C-c C-e C-s h h works (assuming you are in the correct subtree at the time). > So when does the EXPORT_FILE_NAME property work? What am I doing wrong? > > Thanks. > > -- > > Kaushal Modi > -- Nick ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Cannot get the EXPORT_FILE_NAME override to work 2017-05-04 16:40 ` Nick Dokos @ 2017-05-04 17:02 ` Kaushal Modi 2017-05-04 17:33 ` Nick Dokos 0 siblings, 1 reply; 7+ messages in thread From: Kaushal Modi @ 2017-05-04 17:02 UTC (permalink / raw) To: Nick Dokos, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 3867 bytes --] On Thu, May 4, 2017 at 12:41 PM Nick Dokos <ndokos@gmail.com> wrote: > That does not work: you have to set #+EXPORT_FILE_NAME: foo for that. > That works. But the node property should also have worked: In (org) Export settings: When exporting only a subtree, each of the previous keywords(4) can be overridden locally by special node properties. These begin with ‘EXPORT_’, followed by the name of the keyword they supplant, unless the keyword already beging with ‘EXPORT_’. For example, ‘DATE’ and ‘EXPORT_FILE_NAME’ keywords become, respectively, ‘EXPORT_DATE’ and ‘EXPORT_FILE_NAME’ properties. > I don't know how narrowing interacts with export but the following > > C-c C-e C-s h h > > works (assuming you are in the correct subtree at the time). > I tried with narrowing and that works. ===== #+TITLE: Test overriding of export file name # Below works #+EXPORT_FILE_NAME: baz * Heading 1 :PROPERTIES: :EXPORT_FILE_NAME: foo :END: # Above override does not work I want to name the exported file as =foo.=(something). If I export to HTML, it should be named =foo.html=. #+EXPORT_FILE_NAME: hd2 * Heading 2 Stuff in heading 2 ===== I narrowed down to ===== #+EXPORT_FILE_NAME: hd2 * Heading 2 Stuff in heading 2 ===== And that exported to hd2.html.. But this does not fit my requirement.. I need to specify the export file name to be different for different subtrees. So that publishing the whole project "eless-all" would put stuff in their correct files in one go: (setq org-publish-project-alist `(;; HTML ("eless-html" :base-directory ,eless-root-dir :with-tags nil :exclude-tags ("noexport" "readme" "wiki") :publishing-function org-html-publish-to-html :publishing-directory ,eless-doc-dir) ;; Info ("eless-info" :base-directory ,eless-root-dir :with-tags nil :exclude-tags ("noexport" "readme" "wiki") :publishing-function org-texinfo-publish-to-texinfo :publishing-directory ,eless-doc-dir :completion-function my/org-texinfo-publish-to-info) ;; eless script ("eless-tangle" :base-directory ,eless-root-dir :publishing-function org-babel-tangle-publish :publishing-directory ,eless-root-dir) ;; README.md ("eless-readme" :base-directory ,eless-root-dir :with-toc nil :with-tags nil :select-tags ("readme") ;Cannot have hyphens in tags! :publishing-function org-gfm-publish-to-gfm :publishing-directory ,eless-root-dir :completion-function eless/readme-completion-fn) ;; CONTRIBUTING.md ("eless-contributing" :base-directory ,eless-root-dir :with-toc nil :with-tags nil :select-tags ("contributing") ;Cannot have hyphens in tags! :publishing-function org-gfm-publish-to-gfm :publishing-directory ,eless-root-dir :completion-function eless/contributing-completion-fn) ;; Wiki Pages ("eless-wiki-tcsh" :base-directory ,eless-root-dir :with-toc nil :with-tags nil :select-tags ("wikitcsh") ;Cannot have hyphens in tags! :publishing-function org-gfm-publish-to-gfm :publishing-directory ,eless-wiki-dir :completion-function eless/wiki-tcsh-completion-fn) ("eless-wiki" :components ("eless-wiki-tcsh")) ("eless-all-docs" :components ("eless-html" "eless-info" "eless-readme" "eless-contributing" "eless-wiki")) ("eless-all" :components ("eless-all-docs" "eless-tangle")))) -- Kaushal Modi [-- Attachment #2: Type: text/html, Size: 5946 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Cannot get the EXPORT_FILE_NAME override to work 2017-05-04 17:02 ` Kaushal Modi @ 2017-05-04 17:33 ` Nick Dokos 2017-05-04 18:28 ` Kaushal Modi 0 siblings, 1 reply; 7+ messages in thread From: Nick Dokos @ 2017-05-04 17:33 UTC (permalink / raw) To: emacs-orgmode Kaushal Modi <kaushal.modi@gmail.com> writes: >> I don't know how narrowing interacts with export but the following >> >> C-c C-e C-s h h >> works (assuming you are in the correct subtree at the time). >> I meant that this works with the property set in the subtree. > ... > And that exported to hd2.html.. But this does not fit my requirement.. I need to specify the export file > name to be different for different subtrees. So add the EXPORT_FILE_NAME property to each subtree, and then do C-c C-e C-s h h *for each subtree of interest*. 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. -- Nick ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Cannot get the EXPORT_FILE_NAME override to work 2017-05-04 17:33 ` Nick Dokos @ 2017-05-04 18:28 ` Kaushal Modi 2017-05-04 19:56 ` Kaushal Modi 0 siblings, 1 reply; 7+ messages in thread From: Kaushal Modi @ 2017-05-04 18:28 UTC (permalink / raw) To: Nick Dokos, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 848 bytes --] On Thu, May 4, 2017 at 1:34 PM Nick Dokos <ndokos@gmail.com> wrote: > I meant that this works with the property set in the subtree. > Ah, I understand now. So add the EXPORT_FILE_NAME property to each subtree, and then do > > C-c C-e C-s h h > > *for each subtree of interest*. Got it. So the EXPORT_FILE_NAME property is exclusive to subtree scope exporting. Even though a tag is present on only one subtree, exporting by selecting that tag will not do the same thing. (I assumed, hoped that would happen :)) > 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. > org-map is a golden suggestion! I'll dive into that. All said, looks like ox-publish misses an ":export_file_name" option. Don't you think? -- Kaushal Modi [-- Attachment #2: Type: text/html, Size: 1577 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Cannot get the EXPORT_FILE_NAME override to work 2017-05-04 18:28 ` Kaushal Modi @ 2017-05-04 19:56 ` Kaushal Modi 0 siblings, 0 replies; 7+ messages in thread From: Kaushal Modi @ 2017-05-04 19:56 UTC (permalink / raw) To: Nick Dokos, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 1407 bytes --] > > On Thu, May 4, 2017 at 1:34 PM Nick Dokos <ndokos@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 [-- Attachment #2: Type: text/html, Size: 2466 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-05-04 19:56 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-05-04 15:30 Cannot get the EXPORT_FILE_NAME override to work Kaushal Modi 2017-05-04 15:36 ` Kaushal Modi 2017-05-04 16:40 ` Nick Dokos 2017-05-04 17:02 ` Kaushal Modi 2017-05-04 17:33 ` Nick Dokos 2017-05-04 18:28 ` Kaushal Modi 2017-05-04 19:56 ` Kaushal Modi
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).