mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
Add timestamp of source revision to HTML doc
* doc/yas-doc-helper.el: Put revision's commit date into :html-postamble project property. Use SOURCE_DATE_EPOCH instead of git data, if it's defined.
This commit is contained in:
parent
cce2e0df5d
commit
4ef1768e81
@ -120,11 +120,20 @@
|
|||||||
|
|
||||||
(let* ((dir (if load-file-name (file-name-directory load-file-name)
|
(let* ((dir (if load-file-name (file-name-directory load-file-name)
|
||||||
default-directory))
|
default-directory))
|
||||||
(rev (with-temp-file (expand-file-name "html-revision" dir)
|
(src-epoch (getenv "SOURCE_DATE_EPOCH"))
|
||||||
(or (when (eq (call-process "git" nil t nil
|
;; Presence of SOURCE_DATE_EPOCH indicates a reproducible
|
||||||
"rev-parse" "--verify" "HEAD") 0)
|
;; build, don't depend on git.
|
||||||
(buffer-string))
|
(rev (unless src-epoch
|
||||||
(princ yas--version (current-buffer)))))
|
(ignore-errors
|
||||||
|
(car (process-lines "git" "rev-parse" "--verify" "HEAD")))))
|
||||||
|
(date (format-time-string
|
||||||
|
"(%Y-%m-%d %H:%M:%S)"
|
||||||
|
(seconds-to-time
|
||||||
|
(string-to-number
|
||||||
|
(or (if rev (car (process-lines "git" "show" "--format=%ct" rev))
|
||||||
|
src-epoch)
|
||||||
|
"0")))
|
||||||
|
t))
|
||||||
(proj-plist
|
(proj-plist
|
||||||
`(,@(when (fboundp 'org-html-publish-to-html)
|
`(,@(when (fboundp 'org-html-publish-to-html)
|
||||||
'(:publishing-function org-html-publish-to-html))
|
'(:publishing-function org-html-publish-to-html))
|
||||||
@ -134,10 +143,13 @@
|
|||||||
(insert-file-contents (expand-file-name "nav-menu.html.inc" dir))
|
(insert-file-contents (expand-file-name "nav-menu.html.inc" dir))
|
||||||
(buffer-string))
|
(buffer-string))
|
||||||
:html-postamble
|
:html-postamble
|
||||||
,(concat "<hr><p class='creator'>Generated by %c on %d from "
|
,(concat "<hr><p class='creator'>Generated by %c from "
|
||||||
rev "</p>\n"
|
(or rev yas--version) " " date "</p>\n"
|
||||||
"<p class='xhtml-validation'>%v</p>\n")))
|
"<p class='xhtml-validation'>%v</p>\n")))
|
||||||
(project (assoc "yasnippet" org-publish-project-alist)))
|
(project (assoc "yasnippet" org-publish-project-alist)))
|
||||||
|
(when rev ;; Rakefile :doc:upload uses "html-revision".
|
||||||
|
(with-temp-file (expand-file-name "html-revision" dir)
|
||||||
|
(princ rev (current-buffer))))
|
||||||
(if project
|
(if project
|
||||||
(setcdr project proj-plist)
|
(setcdr project proj-plist)
|
||||||
(push `("yasnippet" . ,proj-plist)
|
(push `("yasnippet" . ,proj-plist)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user