diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2011-04-25 01:12:16 +0300 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2011-04-25 01:25:43 +0300 |
commit | 9412606265c2774712e3f805798896734b32c7fd (patch) | |
tree | 90b352648f13f14cef32c568dd9f5f514e4cac5a /doc/src | |
parent | e6a30a8c3c81a7a2949f852379d34a19dfc26a0d (diff) | |
download | postgresql-9412606265c2774712e3f805798896734b32c7fd.tar.gz postgresql-9412606265c2774712e3f805798896734b32c7fd.zip |
Normalize whitespace in the arguments of <indexterm>
Strip leading and trailing whitespace and replace interior whitespace
by a single space. This avoids problems with the index generator
producing duplicate index entries for terms that differ only in
whitespace.
Commit dca30da3433c40b5f92f1704c496cda052decef9 actually fixed all the
indexterm elements that would cause this problem at the moment, but in
case it sneaks in again, we're set.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/stylesheet.dsl | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/doc/src/sgml/stylesheet.dsl b/doc/src/sgml/stylesheet.dsl index b95b357294e..637758ff429 100644 --- a/doc/src/sgml/stylesheet.dsl +++ b/doc/src/sgml/stylesheet.dsl @@ -163,6 +163,22 @@ ;; Add more here if needed... +;; Replace a sequence of whitespace in a string by a single space +(define (normalize-whitespace str #!optional (whitespace '(#\space #\U-000D))) + (let loop ((characters (string->list str)) + (result '()) + (prev-was-space #f)) + (if (null? characters) + (list->string (reverse result)) + (let ((c (car characters)) + (rest (cdr characters))) + (if (member c whitespace) + (if prev-was-space + (loop rest result #t) + (loop rest (cons #\space result) #t)) + (loop rest (cons c result) #f)))))) + + <!-- HTML output customization ..................................... --> <![ %output-html; [ @@ -414,6 +430,26 @@ (literal ""))))) +;; Changed to strip and normalize index term content (overrides +;; dbindex.dsl) +(define (htmlindexterm) + (let* ((attr (gi (current-node))) + (content (data (current-node))) + (string (strip (normalize-whitespace content))) ;; changed + (sortas (attribute-string (normalize "sortas")))) + (make sequence + (make formatting-instruction data: attr) + (if sortas + (make sequence + (make formatting-instruction data: "[") + (make formatting-instruction data: sortas) + (make formatting-instruction data: "]")) + (empty-sosofo)) + (make formatting-instruction data: " ") + (make formatting-instruction data: string) + (htmlnewline)))) + + ]]> <!-- %output-html --> |