- Russian help files was conerting into utf-8 encode
This commit is contained in:
44
lib/help.tcl
44
lib/help.tcl
@@ -23,7 +23,7 @@
|
||||
source [file join $dataDir html_lib.tcl]
|
||||
#source [file join $dataDir htmllib.tcl]
|
||||
|
||||
set sourceEncode "koi8-r"
|
||||
set sourceEncode "utf-8"
|
||||
|
||||
## LOAD MESSAGES FILE? LANGUAGE AND NEDDED FILES ##
|
||||
#source $homeDir/html.tcl
|
||||
@@ -59,13 +59,10 @@ proc GetTOC {} {
|
||||
foreach dir [lsort [glob -nocomplain *]] {
|
||||
if {[file isdirectory $dir] == 1} {
|
||||
foreach file [lsort [glob -nocomplain [file join $dir *toc.html]]] {
|
||||
#puts $file
|
||||
set fileName [file join $file]
|
||||
set tocFile [open $fileName r]
|
||||
fconfigure $tocFile -encoding binary
|
||||
set dot "_"
|
||||
#set nodeParent [string range $fileName 0 [expr [string first "." $fileName]-1]]
|
||||
#puts $fileName
|
||||
set nodeParent [file dirname $fileName]
|
||||
while {[gets $tocFile line]>=0} {
|
||||
set a ""
|
||||
@@ -75,28 +72,21 @@ proc GetTOC {} {
|
||||
if {[regexp ">.+\<" $line a]} {
|
||||
set length [string length $a]
|
||||
set title [string range $a 1 [expr $length-2]]
|
||||
#puts $nodeParent ;# debug info
|
||||
$hlpTree insert end root $nodeParent -text "$title" -font $fontNormal \
|
||||
-data "toc_$nodeParent" -open 0\
|
||||
-image [Bitmap::get [file join $imgDir books.gif]]
|
||||
-data "toc_$nodeParent" -open 0\
|
||||
-image [Bitmap::get [file join $imgDir books.gif]]
|
||||
}
|
||||
} elseif {[regexp "\".+\"" $line a]} {
|
||||
set data [string range $a 1 [expr [string last "\"" $a]-1]]
|
||||
if {[regexp ">.+\<" $line b]} {
|
||||
set line [string range $b 1 [expr [string first "<" $b]-1]]
|
||||
regsub -all {[ :]} $line "_" subNode
|
||||
#regsub -all ":" $ubNode "_" node
|
||||
set subNode "$nodeParent$dot$subNode"
|
||||
if {[info exists arr($subNode)] == 0} {
|
||||
set arr($subNode) [file join $dir $data]
|
||||
}
|
||||
set data [file join $dir $data]
|
||||
#puts "$subNode" ;# debug info
|
||||
$hlpTree insert end "$nodeParent" $subNode -text "$line"\
|
||||
-font $fontNormal -data "doc_$data" -open 0\
|
||||
-image [Bitmap::get [file join $imgDir file.gif]]
|
||||
$lstSearch insert end $line
|
||||
}
|
||||
} elseif {[regexp -nocase -all -line -- {(<a href=)(|\")(.+\.[a-zA-Z]+)(\">|>)(.+)(</a><br>)} $line match v1 v2 v3 v4 v5 v6]} {
|
||||
regsub -all {[ :]} $v5 "_" subNode
|
||||
set subNode "$nodeParent$dot$subNode"
|
||||
if {[info exists arr($subNode)] == 0} {
|
||||
set arr($subNode) [file join $dir $v3]
|
||||
}
|
||||
set data [file join $dir $v3]
|
||||
$hlpTree insert end "$nodeParent" $subNode -text "$v5"\
|
||||
-font $fontNormal -data "doc_$data" -open 0\
|
||||
-image [Bitmap::get [file join $imgDir file.gif]]
|
||||
$lstSearch insert end $v3
|
||||
} else {
|
||||
break
|
||||
}
|
||||
@@ -164,7 +154,7 @@ proc GetContent {file} {
|
||||
HM::parse_html $html "HM::render $txt"
|
||||
# HM::tag_title .help "Help - $nbTitle"
|
||||
$txt configure -state disabled
|
||||
|
||||
|
||||
}
|
||||
## GOTO URL PROCEDURE ##
|
||||
proc LinkCallback {w url} {
|
||||
@@ -359,6 +349,10 @@ proc TopLevelHelp {} {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -715,21 +715,12 @@ proc GoToURL {url} {
|
||||
|
||||
proc launchBrowser {url} {
|
||||
global tcl_platform
|
||||
|
||||
if {$tcl_platform(platform) eq "windows"} {
|
||||
# first argument to "start" is "window title", which is not used here
|
||||
set command [list {*}[auto_execok start] {}]
|
||||
# (older) Windows shell would start a new command after &, so shell escape it with ^
|
||||
#set url [string map {& ^&} $url]
|
||||
# but 7+ don't seem to (?) so this nonsense is gone
|
||||
if {[file isdirectory $url]} {
|
||||
# if there is an executable named eg ${url}.exe, avoid opening that instead:
|
||||
set url [file nativename [file join $url .]]
|
||||
}
|
||||
} elseif {$tcl_platform(os) eq "Darwin"} {
|
||||
# It *is* generally a mistake to use $tcl_platform(os) to select functionality,
|
||||
# particularly in comparison to $tcl_platform(platform). For now, let's just
|
||||
# regard it as a stylistic variation subject to debate.
|
||||
set command [list open]
|
||||
} else {
|
||||
set command [list xdg-open]
|
||||
@@ -737,24 +728,15 @@ proc launchBrowser {url} {
|
||||
exec {*}$command $url &
|
||||
}
|
||||
|
||||
proc _launchBrowser {url} {
|
||||
if [catch {launchBrowser $url} err] {
|
||||
tk_messageBox -icon error -message "error '$err' with '$command'"
|
||||
}
|
||||
}
|
||||
|
||||
## SEND EMAIL PROCEDURE ##
|
||||
proc SendEmail {mail} {
|
||||
global env tcl_platform
|
||||
if {$tcl_platform(platform) == "windows"} {
|
||||
|
||||
} elseif {$tcl_platform(platform) == "mac"} {
|
||||
|
||||
} elseif {$tcl_platform(platform) == "unix"} {
|
||||
set pipe [open "|xdg-open $mail" "r"]
|
||||
fileevent $pipe readable
|
||||
fconfigure $pipe -buffering none -blocking no
|
||||
|
||||
}
|
||||
}
|
||||
## QUIT PROJECT MANAGER PROCEDURE ##
|
||||
@@ -1102,3 +1084,4 @@ proc GetExtention {node} {
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -87,7 +87,7 @@ proc NewProj {type proj l} {
|
||||
pack $frm -fill both -expand true
|
||||
|
||||
image create photo imgFold -format gif -file [file join $imgDir folder.gif]
|
||||
|
||||
|
||||
set frm_1 [frame $frm.frmProjName]
|
||||
label $frm_1.lblProjName -text [::msgcat::mc "Project name"] -width 20 -anchor w
|
||||
entry $frm_1.txtProjName -textvariable txtProjName
|
||||
@@ -322,9 +322,8 @@ proc CreateProj {type lang txtFileName txtProjName txtFileName txtDirName txtCom
|
||||
set text "\%**************************************************\n%\t$txtProjName\n%\tDistributed under GNU Public License\n% Author: $txtProjAuthor $txtProjEmail\n* Home page: $txtProjHome\n%*****************************************************\)\n"
|
||||
set lang erl
|
||||
}
|
||||
|
||||
if {[file exists [file join $dir $txtFileName.[string tolower $lang]]] == 0} {
|
||||
set file [open [file join $dir $txtFileName.[string tolower $lang]] w]
|
||||
if {[file exists [file join $dir $txtFileName]] == 0} {
|
||||
set file [open [file join $dir $txtFileName] w]
|
||||
puts $file $text
|
||||
close $file
|
||||
}
|
||||
@@ -713,7 +712,7 @@ proc MakeProj {action t} {
|
||||
}
|
||||
} elseif {$action == "run"} {
|
||||
if {$t == "proj"} {
|
||||
set prog [file join $projDirName $projFileName.tcl]
|
||||
set prog [file join $projDirName $projFileName]
|
||||
} elseif {$t == "file"} {
|
||||
set node [$tree selection get]
|
||||
set fullPath [$tree itemcget $node -data]
|
||||
@@ -908,3 +907,8 @@ proc InsertTitle {newFile type} {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user