1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00
guile/libguile/texi-fragments-to-docstrings
Ludovic Courtès 6cfdc6b878 Build guile-procedures.txt' using (texinfo) instead of makeinfo'.
* Makefile.am (schemelibdir, schemelib_DATA): New variables.
  (libguile/guile-procedures.txt): New target.
  (EXTRA_DIST): Add libguile/texi-fragments-to-docstrings.
* libguile/Makefile.am (guile-procedures.txt): Remove target.
  (schemelibdir, schemelib_DATA): Remove.
* libguile/texi-fragments-to-docstrings: New file.
2013-03-21 23:24:47 +01:00

55 lines
2.2 KiB
Scheme
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;;; -*- mode: scheme; coding: utf-8; -*-
;;;
;;; Copyright (C) 2013 Free Software Foundation, Inc.
;;;
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public
;;; License as published by the Free Software Foundation; either
;;; version 3 of the License, or (at your option) any later version.
;;;
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; Lesser General Public License for more details.
;;;
;;; You should have received a copy of the GNU Lesser General Public
;;; License along with this library; if not, write to the Free Software
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;;;
;;; Read Texinfo fragments from stdin (docstrings of Guile's primitives
;;; in the format of `guile-procedures.texi'), and write to stdout a
;;; textual rendering thereof. The output preserves page breaks (^L)
;;; found in the input, as per the Guile Documentation Format
;;; version 2---see (ice-9 documentation).
;;;
(use-modules (texinfo)
(texinfo plain-text)
(srfi srfi-1)
(ice-9 match)
(rnrs io ports))
(define (docstring-fragments->strings str)
"Return the list resulting from the split of STR at each page
break (^L)"
(string-tokenize str (char-set-complement (char-set #\page))))
(match (command-line)
((_ texi-file)
(let* ((fragments (remove (compose string-null? string-trim-both)
(call-with-input-file texi-file
(compose docstring-fragments->strings
get-string-all))))
(stexi (map texi-fragment->stexi fragments)))
(format #t "Produced by GNU Guile ~a from `~a'.~%~%"
(version) texi-file)
(for-each (lambda (stexi)
(display #\page)
(display (stexi->plain-text stexi)))
stexi)))
((command args ...)
(format (current-error-port) "invalid arguments: ~s~%" args)
(format (current-error-port) "Usage: ~a TEXINFO-FILE~%" command)
(exit 1)))