aboutsummaryrefslogtreecommitdiff
path: root/src/guile
diff options
context:
space:
mode:
authorLudovic Courtès2009-01-07 16:01:35 +0100
committerLudovic Courtès2009-01-07 16:01:35 +0100
commitb1fa98f9ab6bd42a93847dde9baf6fc445de3f9f (patch)
treeee247f4d2f6fdbb41e5b0bf93934a241b7b9b844 /src/guile
parent6fa2b3164bc06af4340957abd8644006a2d464ad (diff)
downloadskribilo-b1fa98f9ab6bd42a93847dde9baf6fc445de3f9f.tar.gz
skribilo-b1fa98f9ab6bd42a93847dde9baf6fc445de3f9f.tar.lz
skribilo-b1fa98f9ab6bd42a93847dde9baf6fc445de3f9f.zip
info: Warn about duplicate node titles.
* src/guile/skribilo/engine/info.scm (check-node-title-conflicts): New. (document): Use it. * po/POTFILES.in: Add `info.scm'.
Diffstat (limited to 'src/guile')
-rw-r--r--src/guile/skribilo/engine/info.scm30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/guile/skribilo/engine/info.scm b/src/guile/skribilo/engine/info.scm
index 811017b..2744f4e 100644
--- a/src/guile/skribilo/engine/info.scm
+++ b/src/guile/skribilo/engine/info.scm
@@ -1,6 +1,6 @@
;;; info.scm -- GNU Info engine.
;;;
-;;; Copyright 2008 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright 2008, 2009 Ludovic Courtès <ludo@gnu.org>
;;; Copyright 2001, 2002 Manuel Serrano
;;;
;;;
@@ -31,6 +31,7 @@
:autoload (skribilo utils justify) (output-justified make-justifier
with-justification)
:autoload (skribilo utils text-table) (table->ascii)
+ :autoload (srfi srfi-1) (fold)
:use-module (srfi srfi-8)
:use-module (srfi srfi-13)
@@ -150,11 +151,38 @@
(ast->string title)))))
;*---------------------------------------------------------------------*/
+;* check-node-title-conflicts ... */
+;*---------------------------------------------------------------------*/
+(define (check-node-title-conflicts doc e)
+ ;; Check whether Info node titles are unique and issue a warning if they're
+ ;; not. Since we compute node titles based on the `:title' option of
+ ;; sections, we can't guarantee uniqueness so the best we can do is report
+ ;; about it.
+ (let ((sections (search-down %block? doc)))
+ (fold (lambda (section section+title)
+ (let* ((title (block-title section e))
+ (same-named (assoc title section+title string=?)))
+ (if (pair? same-named)
+ (begin
+ (skribe-warning/ast 1 section
+ (format #f
+ (_ "Info node title `~A' already used")
+ title))
+ (skribe-warning/ast 1 (cdr same-named)
+ (_ "previous occurrence was here"))
+ section+title)
+ (alist-cons title section section+title))))
+ '()
+ sections)
+ #t))
+
+;*---------------------------------------------------------------------*/
;* info ::%document ... */
;*---------------------------------------------------------------------*/
(markup-writer 'document info-engine
:options '(:title :author :ending)
:action (lambda (doc e)
+ (check-node-title-conflicts doc e)
(let ((title (markup-option doc :title))
(authors (markup-option doc :author))
(body (markup-body doc))