diff options
author | Ludovic Courtès | 2009-01-07 16:01:35 +0100 |
---|---|---|
committer | Ludovic Courtès | 2009-01-07 16:01:35 +0100 |
commit | b1fa98f9ab6bd42a93847dde9baf6fc445de3f9f (patch) | |
tree | ee247f4d2f6fdbb41e5b0bf93934a241b7b9b844 | |
parent | 6fa2b3164bc06af4340957abd8644006a2d464ad (diff) | |
download | skribilo-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'.
-rw-r--r-- | po/POTFILES.in | 3 | ||||
-rw-r--r-- | 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 <ludo@gnu.org> +# Copyright 2007, 2008, 2009 Ludovic Courtès <ludo@gnu.org> 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 <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)) |