From b1fa98f9ab6bd42a93847dde9baf6fc445de3f9f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 7 Jan 2009 16:01:35 +0100 Subject: 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'. --- po/POTFILES.in | 3 ++- src/guile/skribilo/engine/info.scm | 30 +++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index 7754e67..8b9cae1 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,6 +1,6 @@ # List of source files which contain translatable strings. # -# Copyright 2007, 2008 Ludovic Courtès +# Copyright 2007, 2008, 2009 Ludovic Courtès src/guile/skribilo/utils/syntax.scm src/guile/skribilo/biblio/template.scm @@ -13,4 +13,5 @@ src/guile/skribilo/source.scm src/guile/skribilo/sui.scm src/guile/skribilo/verify.scm src/guile/skribilo/engine/lout.scm +src/guile/skribilo/engine/info.scm src/guile/skribilo/reader/rss-2.scm 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 +;;; Copyright 2008, 2009 Ludovic Courtès ;;; 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) @@ -149,12 +150,39 @@ title (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)) -- cgit v1.2.3