mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-17 11:20:39 -08:00
Add version headlines to HTML NEWS export
This allows linking to, e.g. "NEWS.28.html#28.1" to go directly to those release notes. * admin/admin.el (admin--org-export-headers-format) (make-news-html-file): Add XX.Y version headlines with an HTML anchor.
This commit is contained in:
parent
5d227ae83e
commit
bcc84ac7fe
1 changed files with 39 additions and 10 deletions
|
|
@ -773,7 +773,7 @@ Optional argument TYPE is type of output (nil means all)."
|
||||||
(defvar admin--org-export-headers-format "\
|
(defvar admin--org-export-headers-format "\
|
||||||
#+title: GNU Emacs %s NEWS -- history of user-visible changes
|
#+title: GNU Emacs %s NEWS -- history of user-visible changes
|
||||||
#+author:
|
#+author:
|
||||||
#+options: author:nil creator:nil toc:1 num:2 *:nil \\n:t ^:nil tex:nil
|
#+options: author:nil creator:nil toc:2 num:3 *:nil \\n:t ^:nil tex:nil
|
||||||
#+language: en
|
#+language: en
|
||||||
#+HTML_LINK_HOME: /software/emacs
|
#+HTML_LINK_HOME: /software/emacs
|
||||||
#+HTML_LINK_UP: /software/emacs
|
#+HTML_LINK_UP: /software/emacs
|
||||||
|
|
@ -851,12 +851,13 @@ $Date: %s $
|
||||||
(unless (file-exists-p (expand-file-name "src/emacs.c" root))
|
(unless (file-exists-p (expand-file-name "src/emacs.c" root))
|
||||||
(user-error "%s doesn't seem to be the root of an Emacs source tree" root))
|
(user-error "%s doesn't seem to be the root of an Emacs source tree" root))
|
||||||
(admin--require-external-package 'htmlize)
|
(admin--require-external-package 'htmlize)
|
||||||
(let* ((orig (expand-file-name "etc/NEWS" root))
|
(let* ((newsfile (expand-file-name "etc/NEWS" root))
|
||||||
(new (expand-file-name (format "etc/NEWS.%s.org" version) root))
|
(orgfile (expand-file-name (format "etc/NEWS.%s.org" version) root))
|
||||||
(html-file (format "%s.html" (file-name-base new)))
|
(html (format "%s.html" (file-name-base orgfile)))
|
||||||
(copyright-years (format-time-string "%Y")))
|
(copyright-years (format-time-string "%Y")))
|
||||||
(copy-file orig new t)
|
(delete-file orgfile)
|
||||||
(find-file new)
|
(copy-file newsfile orgfile t)
|
||||||
|
(find-file orgfile)
|
||||||
|
|
||||||
;; Find the copyright range.
|
;; Find the copyright range.
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
|
|
@ -931,6 +932,34 @@ $Date: %s $
|
||||||
(org-mode)
|
(org-mode)
|
||||||
(save-buffer)
|
(save-buffer)
|
||||||
|
|
||||||
|
;; Make everything one level lower.
|
||||||
|
(goto-char (point-min))
|
||||||
|
(while (re-search-forward (rx bol (group (+ "*")) " ") nil t)
|
||||||
|
(replace-match "*\\1" nil nil nil 1))
|
||||||
|
|
||||||
|
;; Insert anchors for different versions.
|
||||||
|
(goto-char (point-min))
|
||||||
|
(let (last-major last-minor)
|
||||||
|
(while (re-search-forward (rx bol "** " (+ (not "\n")) "in Emacs "
|
||||||
|
(group digit digit) "." (group digit)
|
||||||
|
eol)
|
||||||
|
nil t)
|
||||||
|
(unless (and (equal (match-string 1) last-major)
|
||||||
|
(equal (match-string 2) last-minor))
|
||||||
|
(setq last-major (match-string 1))
|
||||||
|
(setq last-minor (match-string 2))
|
||||||
|
(forward-line -1)
|
||||||
|
(insert (format
|
||||||
|
(concat
|
||||||
|
;; Add anchor to allow linking to
|
||||||
|
;; e.g. "NEWS.28.html#28.1".
|
||||||
|
"#+HTML: <p id=\"%s.%s\"> </p>\n"
|
||||||
|
"* Changes in Emacs %s.%s\n")
|
||||||
|
last-major last-minor
|
||||||
|
last-major last-minor)))))
|
||||||
|
|
||||||
|
(save-buffer)
|
||||||
|
|
||||||
;; Make the HTML export.
|
;; Make the HTML export.
|
||||||
(let* ((org-html-postamble
|
(let* ((org-html-postamble
|
||||||
(format admin--org-html-postamble
|
(format admin--org-html-postamble
|
||||||
|
|
@ -942,12 +971,12 @@ $Date: %s $
|
||||||
(org-html-export-as-html))
|
(org-html-export-as-html))
|
||||||
|
|
||||||
;; Write HTML to file.
|
;; Write HTML to file.
|
||||||
(let ((new (expand-file-name html-file (expand-file-name "etc" root))))
|
(let ((html (expand-file-name html (expand-file-name "etc" root))))
|
||||||
(write-file new)
|
(write-file html)
|
||||||
(unless noninteractive
|
(unless noninteractive
|
||||||
(find-file new)
|
(find-file html)
|
||||||
(html-mode))
|
(html-mode))
|
||||||
(message "Successfully exported HTML to %s" new))))
|
(message "Successfully exported HTML to %s" html))))
|
||||||
|
|
||||||
|
|
||||||
;; Stuff to check new `defcustom's got :version tags.
|
;; Stuff to check new `defcustom's got :version tags.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue