1 ;;; gnus-news.el --- a hack to create GNUS-NEWS from texinfo source
2 ;; Copyright (C) 2004 Free Software Foundation, Inc.
4 ;; Author: Reiner Steib <Reiner.Steib@gmx.de>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
28 (defvar gnus-news-header-disclaimer
29 "GNUS NEWS -- history of user-visible changes.
30 Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
31 See the end for copying conditions.
33 Please send Gnus bug reports to bugs\@gnus.org.
34 For older news, see Gnus info node \"New Features\".
42 (defvar gnus-news-trailer
44 * For older news, see Gnus info node \"New Features\".
46 ----------------------------------------------------------------------
47 Copyright information:
49 Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
51 Permission is granted to anyone to make or distribute verbatim copies
52 of this document as received, in any medium, provided that the
53 copyright notice and this permission notice are preserved,
54 thus giving the recipient permission to redistribute in turn.
56 Permission is granted to distribute modified versions
57 of this document, or of portions of it,
58 under the above conditions, provided also that they
59 carry prominent notices stating who last changed them.
60 \f\nLocal variables:\nmode: outline
61 paragraph-separate: \"[
\f]*$\"\nend:\n")
63 (defvar gnus-news-makeinfo-command "makeinfo")
65 (defvar gnus-news-fill-column 72)
67 (defvar gnus-news-makeinfo-switches
68 (concat " --no-headers --paragraph-indent=0"
69 " --fill-column=" (number-to-string
70 (+ 3 ;; will strip leading spaces later
71 (or gnus-news-fill-column 80)))))
73 (defun batch-gnus-news ()
74 "Make GNUS-NEWS in batch mode."
76 (setq infile (car command-line-args-left)
77 command-line-args-left (cdr command-line-args-left)
78 outfile (car command-line-args-left)
79 command-line-args-left nil)
80 (if (and infile outfile)
81 (message "Creating `%s' from `%s'..." outfile infile)
82 (error "Not enough files given."))
83 (gnus-news-translate-file infile outfile)))
85 (defun gnus-news-translate-file (infile outfile)
86 "Translate INFILE (texinfo) to OUTFILE (GNUS-NEWS)."
87 (let* ((dir (concat (or (getenv "srcdir") ".") "/"))
88 (infile (concat dir infile))
89 (buffer (find-file-noselect (concat dir outfile))))
91 ;; Could be done using `texinfmt' stuff as in `infohack.el'.
93 (shell-command-to-string
94 (concat gnus-news-makeinfo-command " "
95 gnus-news-makeinfo-switches " " infile)))
96 (goto-char (point-max))
98 (goto-char (point-min))
100 (while (re-search-forward "^ \\* " nil t)
101 (replace-match "** ")))
103 (while (re-search-forward "^ " nil t)
105 (goto-char (point-min))
106 (insert gnus-news-header-disclaimer)
107 (goto-char (point-max))
108 (insert gnus-news-trailer)
109 (write-region (point-min) (point-max) outfile))))
111 ;;; gnus-news.el ends here