DoctorD90 icon

Txt2Html.tcl 1.0.0

DoctorD90 | PRO | 04/27/13 11:10:55 PM UTC | 0 ⭐ | 6199 👁️ | Never ⏰ | []
TCL |

1.91 KB

|

None

|

0 👍

/

0 👎

### Txt2Html.tcl 1.0.0 fFG93nkC
 
#SUGGESTED
# PBinSrc.tcl fMrtKqyq
 
#LICENSE
# Copyright © 2013 Alberto Dietze "DoctorD90"
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Full GPLv3 Text: http://www.gnu.org/licenses/gpl.txt
 
#PATERNITY
#Coder: DoctorD90
#Network: irc.OnlineGamesNet.net
#Chan: #eHito
#Mail: [email protected]
 
#PURPOSE
#Converts text files into html pages.
 
#USAGE
#Add this script to your eggdrop's list to load it.
 
 
### DON'T EDIT ANYTHING BELOW ###
 
proc txt2html {file lines {title ""}} {
  if {![string length $file] || ![llength $lines]} {
    return 0
  }
  if {![string match -nocase "*.html" $file]} {
    append file ".html"
  }
  if {![string length $title]} {
    set title [string trim [join [lrange [split [lindex [split $file "/"] end] "."] 0 end-1]]]
  }
  set fs [open "$file" w]
  puts $fs "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"><br><HTML>"
  puts $fs "  <HEAD>"
  puts $fs "    <META CONTENT=\"text/html; charset=ISO-8859-1\" http-equiv=\"content-type\">"
  puts $fs "      <TITLE>$title</TITLE>"
  puts $fs "  </HEAD>"
  puts $fs "  <BODY>"
  puts $fs [join $lines "<br>\n"]
  puts $fs "  </BODY>"
  puts $fs "</HTML>"
  close $fs
  return 1
}
 
###
putlog "Txt2Html.tcl LOADED"

Comments