From: Noam Postavsky Date: Wed, 27 Nov 2013 02:47:47 +0000 (-0500) Subject: publish org doc from Rakefile X-Git-Url: https://code.delx.au/gnu-emacs-elpa/commitdiff_plain/fd3fa394449da99b191e56eae35e4ad4db6679ee publish org doc from Rakefile --- diff --git a/Rakefile b/Rakefile index b7eb238b1..0044d1cac 100644 --- a/Rakefile +++ b/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 diff --git a/doc/yas-doc-helper.el b/doc/yas-doc-helper.el index 4300597c4..67e598699 100755 --- a/doc/yas-doc-helper.el +++ b/doc/yas-doc-helper.el @@ -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 - "" - :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 "

Generated by %c on %d from " + rev "

\n" + "

%v

\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