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]
|
||||
foreach name $names {
|
||||
# puts stderr "JET0: name: $name"
|
||||
upvar 0 currentGlossArray($name) glossEntryList
|
||||
|
||||
# skip this array entry if we've already emitted it; mark as
|
||||
|
@ -2215,7 +2216,10 @@ proc SortAndEmitGlossary {popForm} {
|
|||
|
||||
set names [lsort -command CompareI18NStrings [array names sortArray]]
|
||||
foreach name $names {
|
||||
Emit $sortArray($name)
|
||||
# puts stderr "JET1: name: $name"
|
||||
if {[info exists sortArray($name)]} {
|
||||
Emit $sortArray($name)
|
||||
}
|
||||
}
|
||||
|
||||
if {[string toupper $popForm] == "POPFORM"} {
|
||||
|
@ -2481,24 +2485,26 @@ proc WriteIndex {} {
|
|||
set oldLevel 0
|
||||
puts $file "<INDEX COUNT=\"$length\">"
|
||||
foreach name $names {
|
||||
set thisEntry $indexArray($name)
|
||||
switch [lindex $thisEntry 0] {
|
||||
1 { switch $oldLevel {
|
||||
1 { puts $file "</ENTRY>" }
|
||||
2 { puts $file "</ENTRY>\n</ENTRY>" }
|
||||
3 { puts $file "</ENTRY>\n</ENTRY>\n</ENTRY>" }
|
||||
if {[info exists indexArray($name)]} {
|
||||
set thisEntry $indexArray($name)
|
||||
switch [lindex $thisEntry 0] {
|
||||
1 { switch $oldLevel {
|
||||
1 { puts $file "</ENTRY>" }
|
||||
2 { puts $file "</ENTRY>\n</ENTRY>" }
|
||||
3 { puts $file "</ENTRY>\n</ENTRY>\n</ENTRY>" }
|
||||
}
|
||||
}
|
||||
2 { switch $oldLevel {
|
||||
2 { puts $file "</ENTRY>" }
|
||||
3 { puts $file "</ENTRY>\n</ENTRY>" }
|
||||
}
|
||||
2 { switch $oldLevel {
|
||||
2 { puts $file "</ENTRY>" }
|
||||
3 { puts $file "</ENTRY>\n</ENTRY>" }
|
||||
}
|
||||
}
|
||||
3 { if {$oldLevel == 3} { puts $file "</ENTRY>" } }
|
||||
}
|
||||
puts -nonewline $file "<ENTRY[Locs $thisEntry]>"
|
||||
puts -nonewline $file [lindex $thisEntry 3]
|
||||
set oldLevel [lindex $thisEntry 0]
|
||||
}
|
||||
3 { if {$oldLevel == 3} { puts $file "</ENTRY>" } }
|
||||
}
|
||||
puts -nonewline $file "<ENTRY[Locs $thisEntry]>"
|
||||
puts -nonewline $file [lindex $thisEntry 3]
|
||||
set oldLevel [lindex $thisEntry 0]
|
||||
}
|
||||
}
|
||||
|
||||
switch $oldLevel {
|
||||
|
@ -2547,10 +2553,10 @@ proc FootnoteRef {idref} {
|
|||
|
||||
# add an element to the current SNB - try to reuse an entry if
|
||||
# possible
|
||||
proc AddToSNB {type data} {
|
||||
proc AddToSNB {stype data} {
|
||||
global currentSNB nextId
|
||||
|
||||
set index "$type::$data"
|
||||
set index "${stype}::${data}"
|
||||
|
||||
if {[info exists currentSNB($index)]} {
|
||||
set snbId $currentSNB($index)
|
||||
|
|
Loading…
Reference in a new issue