forked from lujun9972/emacs-document
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto_publish.el
70 lines (65 loc) · 2.82 KB
/
auto_publish.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(when no-ssl (warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
(package-refresh-contents)
(package-install 'mustache)
(package-install 'htmlize)
(setq load-path (cons "~/EGO/" load-path))
(require 'log-edit)
(require 'htmlize)
(require 'ego)
(setq ego-project-config-alist
`(("emacs-document"
:repository-directory "~/source"
:site-domain "https://lujun9972.github.io/emacs-document"
:site-main-title "EMACS-DOCUMENT"
:site-sub-title "=============>随便,谢谢"
:repository-org-branch "master"
:repository-html-branch "gh-pages"
:theme (default)
:summary
(("years" :year :updates 10)
("authors" :authors)
("tags" :tags))
:source-browse-url
("Github" ,(getenv "REPO"))
:personal-disqus-shortname "emacs-document"
:personal-google-analytics-id "7bac4fd0247f69c27887e0d4e3aee41e"
:ignore-file-name-regexp "README.org"
:store-dir "~/web")))
(message "BEGIN TO AUTO PUBLIC")
(setq org-export-use-babel nil)
(setq debug-on-error t)
(setq org-src-fontify-natively t)
;; 增加video link,用于为html生成video tag
(defun org-video-link-export (path desc backend)
(let ((ext (file-name-extension path)))
(cond
((eq 'html backend)
(format "<video preload='metadata' controls='controls'><source type='video/%s' src='%s' /></video>" ext path))
;; fall-through case for everything else
(t
path))))
(defun org-video-link-follow (path)
(let* ((player (or (executable-find "mpv")
(executable-find "vlc")
(executable-find "smplayer")
(executable-find "mplayer")))
(command (format "%s '%s'" player path)))
(async-shell-command command)))
(org-link-set-parameters "video" :export 'org-video-link-export :follow 'org-video-link-follow)
(ego-do-publication "emacs-document" nil nil nil)