projects
/
blog.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2f98df7
)
Add publish make target
author
Peng Li
<seudut@gmail.com>
Sun, 12 Mar 2017 11:12:39 +0000
(19:12 +0800)
committer
Peng Li
<seudut@gmail.com>
Sun, 12 Mar 2017 11:12:39 +0000
(19:12 +0800)
Makefile
patch
|
blob
|
history
my-publish.el
patch
|
blob
|
history
diff --git
a/Makefile
b/Makefile
index
f1f4d12
..
00e53a2
100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-1,8
+1,9
@@
## Makefile to export org in blog file to html
emacs ?= emacs
## Makefile to export org in blog file to html
emacs ?= emacs
-OUTDIR :=
""
+OUTDIR :=
FORCE := "no"
FORCE := "no"
+BLOGDIR := $(PWD)
all:
$(emacs) -Q --script blog.el $(OUTDIR) $(FORCE)
all:
$(emacs) -Q --script blog.el $(OUTDIR) $(FORCE)
@@
-11,8
+12,17
@@
all:
update:
git pull && $(emacs) -Q --script blog.el "~/www/html" "true"
update:
git pull && $(emacs) -Q --script blog.el "~/www/html" "true"
-test:
- $(emaca) -Q --script blog.el "test" "true"
+publish:
+ $(emacs) -Q --batch -l my-publish.el index.org \
+ --eval '(setq debug-on-error t)' \
+ --eval '(blog-setup-project-alist "$(BLOGDIR)" "$(OUTDIR)")' \
+ --eval '(org-publish-current-project)'
+
+compile:
+ $(emacs) -Q --batch -l my-publish.el index.org \
+ --eval '(setq debug-on-error t)' \
+ --eval '(blog-setup-project-alist "$(BLOGDIR)" "$(OUTDIR)")' \
+ --eval '(org-publish-current-project t)'
clean:
rm -rf _site/*
clean:
rm -rf _site/*
diff --git
a/my-publish.el
b/my-publish.el
index
984bb11
..
cd0f340
100644
(file)
--- a/
my-publish.el
+++ b/
my-publish.el
@@
-59,7
+59,11
@@
License: <a href= \"https://creativecommons.org/licenses/by-sa/4.0/\">CC BY-SA 4
(defun blog-setup-project-alist (root-dir &optional output-dir)
"Set project alist. `output-dir' is the directory of publish-directory.
`root-dir' is the root directory of blog repository."
(defun blog-setup-project-alist (root-dir &optional output-dir)
"Set project alist. `output-dir' is the directory of publish-directory.
`root-dir' is the root directory of blog repository."
- (unless output-dir (setq output-dir (concat root-dir "_site/")))
+ (unless (> (length output-dir) 0)
+ (setq output-dir (concat root-dir "/_site/")))
+ (message "Blog dir is: %s\nOut dir is: %s"
+ (format root-dir)
+ (format output-dir))
(setq org-publish-project-alist
`(
("blog-pages"
(setq org-publish-project-alist
`(
("blog-pages"
@@
-125,13
+129,5
@@
License: <a href= \"https://creativecommons.org/licenses/by-sa/4.0/\">CC BY-SA 4
:recursive t)
("blog" :components ("blog-pages" "blog-posts" "blog-css" "blog-cgi")))))
:recursive t)
("blog" :components ("blog-pages" "blog-posts" "blog-css" "blog-cgi")))))
-
-(defun blog-publish (out-dir force)
- "publish the project"
- (interactive)
- (blog-setup-project out-dir)
- (org-publish-project "blog" force))
-
-
(provide 'my-publish)
;;; publish.el ends here
(provide 'my-publish)
;;; publish.el ends here