mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
docbook.tcl: fix up some problems using a modern Tcl
One issue that came up was attempting to read array values indexed by a key that didn't exist when generating indexes and glossaries. I am not sure why this hasn't been a problem before, but for now, we simply won't try to emit array values for non-existant array indexes.
This commit is contained in:
parent
68559d4f76
commit
776e031b60
1 changed files with 25 additions and 19 deletions
|
@ -2195,6 +2195,7 @@ proc SortAndEmitGlossary {popForm} {
|
||||||
|
|
||||||
set names [array names currentGlossArray]
|
set names [array names currentGlossArray]
|
||||||
foreach name $names {
|
foreach name $names {
|
||||||
|
# puts stderr "JET0: name: $name"
|
||||||
upvar 0 currentGlossArray($name) glossEntryList
|
upvar 0 currentGlossArray($name) glossEntryList
|
||||||
|
|
||||||
# skip this array entry if we've already emitted it; mark as
|
# skip this array entry if we've already emitted it; mark as
|
||||||
|
@ -2215,8 +2216,11 @@ proc SortAndEmitGlossary {popForm} {
|
||||||
|
|
||||||
set names [lsort -command CompareI18NStrings [array names sortArray]]
|
set names [lsort -command CompareI18NStrings [array names sortArray]]
|
||||||
foreach name $names {
|
foreach name $names {
|
||||||
|
# puts stderr "JET1: name: $name"
|
||||||
|
if {[info exists sortArray($name)]} {
|
||||||
Emit $sortArray($name)
|
Emit $sortArray($name)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if {[string toupper $popForm] == "POPFORM"} {
|
if {[string toupper $popForm] == "POPFORM"} {
|
||||||
PopForm
|
PopForm
|
||||||
|
@ -2481,6 +2485,7 @@ proc WriteIndex {} {
|
||||||
set oldLevel 0
|
set oldLevel 0
|
||||||
puts $file "<INDEX COUNT=\"$length\">"
|
puts $file "<INDEX COUNT=\"$length\">"
|
||||||
foreach name $names {
|
foreach name $names {
|
||||||
|
if {[info exists indexArray($name)]} {
|
||||||
set thisEntry $indexArray($name)
|
set thisEntry $indexArray($name)
|
||||||
switch [lindex $thisEntry 0] {
|
switch [lindex $thisEntry 0] {
|
||||||
1 { switch $oldLevel {
|
1 { switch $oldLevel {
|
||||||
|
@ -2500,6 +2505,7 @@ proc WriteIndex {} {
|
||||||
puts -nonewline $file [lindex $thisEntry 3]
|
puts -nonewline $file [lindex $thisEntry 3]
|
||||||
set oldLevel [lindex $thisEntry 0]
|
set oldLevel [lindex $thisEntry 0]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch $oldLevel {
|
switch $oldLevel {
|
||||||
1 { puts $file "</ENTRY>" }
|
1 { puts $file "</ENTRY>" }
|
||||||
|
@ -2547,10 +2553,10 @@ proc FootnoteRef {idref} {
|
||||||
|
|
||||||
# add an element to the current SNB - try to reuse an entry if
|
# add an element to the current SNB - try to reuse an entry if
|
||||||
# possible
|
# possible
|
||||||
proc AddToSNB {type data} {
|
proc AddToSNB {stype data} {
|
||||||
global currentSNB nextId
|
global currentSNB nextId
|
||||||
|
|
||||||
set index "$type::$data"
|
set index "${stype}::${data}"
|
||||||
|
|
||||||
if {[info exists currentSNB($index)]} {
|
if {[info exists currentSNB($index)]} {
|
||||||
set snbId $currentSNB($index)
|
set snbId $currentSNB($index)
|
||||||
|
|
Loading…
Reference in a new issue