Hi all,
I wanted to batch publish files passed on the command line, rather than
whole projects, so I came up with this (see below).
If muse-project-file-batch-publish is called you only need pass file
names, unlike muse-batch-publish-files which requires a style and
output-dir be passed on the command-line as well as file names.
It works by parsing the file name, and assumes a path format of:
/foo/bar/baz/project-name/file-name.muse
It then passes project-name and file-name to muse-project-find-file
before finally calling muse-project-publish-this-file.
I don't know if there's a way around this limitation... suggestions
welcome.
Hope it's useful to others.
Sebastian
;;; publish individual files
(defun muse-project-file-batch-publish ()
"Publish Muse files (not projects) in batch mode."
(let ((muse-batch-publishing-p t)
force)
(and (string= "--force" (or (car command-line-args-left) ""))
(progn
(setq force t
command-line-args-left (cdr command-line-args-left))
(message "Forcing publication.")))
(if command-line-args-left
(mapc
(lambda (f)
;; file path must be of the form
.../.../.../project-name/file.muse
(let* ((pathlist (split-string f "/"))
(name (car (last pathlist)))
(project (car (last pathlist 2)))
;; prevent muse-project-find-file from adding '.muse'
;; to file names (they already end with '.muse')
(muse-file-extension nil))
(message "Publishing file %s ..." f)
(muse-project-find-file name project)
(muse-project-publish-this-file force)))
command-line-args-left)
(message "No files specified."))))
_______________________________________________
Muse-el-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/muse-el-discuss