Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9412606

Browse files
committed
Normalize whitespace in the arguments of <indexterm>
Strip leading and trailing whitespace and replace interior whitespaceby a single space. This avoids problems with the index generatorproducing duplicate index entries for terms that differ only inwhitespace.Commitdca30da actually fixed all theindexterm elements that would cause this problem at the moment, but incase it sneaks in again, we're set.
1 parente6a30a8 commit9412606

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

‎doc/src/sgml/stylesheet.dsl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,22 @@
163163
;;Add more here if needed...
164164

165165

166+
;; Replace a sequence of whitespace in a string by a single space
167+
(define (normalize-whitespace str #!optional (whitespace '(#\space #\U-000D)))
168+
(let loop ((characters (string->list str))
169+
(result '())
170+
(prev-was-space #f))
171+
(if (null? characters)
172+
(list->string (reverse result))
173+
(let ((c (car characters))
174+
(rest (cdr characters)))
175+
(if (member c whitespace)
176+
(if prev-was-space
177+
(loop rest result #t)
178+
(loop rest (cons #\space result) #t))
179+
(loop rest (cons c result) #f))))))
180+
181+
166182
<!-- HTML output customization ..................................... -->
167183

168184
<![ %output-html; [
@@ -414,6 +430,26 @@
414430
(literal"")))))
415431

416432

433+
;; Changed to strip and normalize index term content (overrides
434+
;; dbindex.dsl)
435+
(define (htmlindexterm)
436+
(let* ((attr (gi (current-node)))
437+
(content (data (current-node)))
438+
(string (strip (normalize-whitespace content))) ;; changed
439+
(sortas (attribute-string (normalize"sortas"))))
440+
(make sequence
441+
(make formatting-instruction data: attr)
442+
(if sortas
443+
(make sequence
444+
(make formatting-instruction data:"[")
445+
(make formatting-instruction data: sortas)
446+
(make formatting-instruction data:"]"))
447+
(empty-sosofo))
448+
(make formatting-instruction data:" ")
449+
(make formatting-instruction data: string)
450+
(htmlnewline))))
451+
452+
417453
]]> <!-- %output-html -->
418454

419455

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp