mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 05:03:04 +00:00
publish org doc from Rakefile
This commit is contained in:
parent
07b1d3925c
commit
fd3fa39444
12
Rakefile
12
Rakefile
@ -54,11 +54,11 @@ task :release => [:package, 'doc:archive'] do
|
||||
raise "Not implemented for github yet!"
|
||||
end
|
||||
|
||||
rule '.html' => '.rst' do |t|
|
||||
sh "doc/compile-doc.py #{t.source} > #{t.name}"
|
||||
end
|
||||
desc "Generate document"
|
||||
task :doc => FileList['doc/*.rst'].ext('html')
|
||||
task :doc do
|
||||
sh "#{$EMACS} -Q -L . --batch -l doc/yas-doc-helper.el" +
|
||||
" -f yas--generate-html-batch"
|
||||
end
|
||||
|
||||
namespace :doc do
|
||||
task :archive do
|
||||
@ -79,8 +79,10 @@ namespace :doc do
|
||||
Dir.glob("doc/images/*").each do |file|
|
||||
FileUtils.cp file, 'doc/gh-pages/images'
|
||||
end
|
||||
rev = `git rev-parse --verify HEAD`
|
||||
Dir.chdir 'doc/gh-pages' do
|
||||
sh "git commit -a -m 'Automatic documentation update.'"
|
||||
sh "git commit -a -m 'Automatic documentation update.\n\n" +
|
||||
"From #{rev.chomp()}'"
|
||||
sh "git push"
|
||||
end
|
||||
end
|
||||
|
@ -24,6 +24,12 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'cl))
|
||||
(require 'org)
|
||||
(require 'org-publish)
|
||||
(require 'yasnippet) ; docstrings must be loaded
|
||||
|
||||
(defun yas--document-symbol (symbol level)
|
||||
(flet ((concat-lines (&rest lines)
|
||||
(mapconcat #'identity lines "\n")))
|
||||
@ -94,18 +100,35 @@
|
||||
|
||||
;; This lets all the org files be exported to HTML with
|
||||
;; `org-publish-current-project' (C-c C-e P).
|
||||
(progn
|
||||
(defvar yas--document-org-project-plist
|
||||
`(:style
|
||||
"<link rel='stylesheet' type='text/css' href='stylesheets/styles.css'/>"
|
||||
:base-directory ,default-directory
|
||||
:publishing-directory ,default-directory))
|
||||
|
||||
(let ((project (assoc "yasnippet" org-publish-project-alist)))
|
||||
(if project
|
||||
(setcdr project yas--document-org-project-plist)
|
||||
(push `("yasnippet" . ,yas--document-org-project-plist)
|
||||
org-publish-project-alist))))
|
||||
(let* ((rev (or (with-temp-buffer
|
||||
(when (eq (call-process "git" nil t nil
|
||||
"rev-parse" "--verify" "HEAD") 0)
|
||||
(buffer-string)))
|
||||
yas--version))
|
||||
(dir (if load-file-name (file-name-directory load-file-name)
|
||||
default-directory))
|
||||
(proj-plist
|
||||
(list
|
||||
:base-directory dir :publishing-directory dir
|
||||
:html-postamble
|
||||
(concat "<hr><p class='creator'>Generated by %c on %d from "
|
||||
rev "</p>\n"
|
||||
"<p class='xhtml-validation'>%v</p>\n")))
|
||||
(project (assoc "yasnippet" org-publish-project-alist)))
|
||||
(if project
|
||||
(setcdr project proj-plist)
|
||||
(push `("yasnippet" . ,proj-plist)
|
||||
org-publish-project-alist)))
|
||||
|
||||
(defun yas--generate-html-batch ()
|
||||
(let ((org-publish-use-timestamps-flag nil)
|
||||
(org-export-copy-to-kill-ring nil)
|
||||
(org-confirm-babel-evaluate nil)
|
||||
(make-backup-files nil))
|
||||
(org-publish "yasnippet" 'force)))
|
||||
|
||||
|
||||
|
||||
(provide 'yas-doc-helper)
|
||||
;;; yas-doc-helper.el ends here
|
||||
|
Loading…
x
Reference in New Issue
Block a user