#
# Version 2.5.1
# Copyright 2002, 2004 Thorsten Haude
# HTML validification by Joor Loohuis
#
# This is free software; you may modify and redistribute it under
# the terms of the GNU General Public License, Version 2.
# (http://www.gnu.org/licenses/gpl.html)
#
# sh2html(params)
# The single parameter is an array containing the following keys:
# source source file name; relative pathes ('^[^/]') are prepended
# by $PWD (mandatory)
# html html file name; relative pathes ('^[^/]') are prepended
# by source's dirname (defaults to source".html")
# css css file name or "INLINE" for inline css; relative pathes
# ('^[^/]') are prepended by source's dirname (defaults to
# source".css")
# numbered set for applying line numbers (defaults to unset)
# mode language mode to use (defaults to whatever your NEdit
# comes up with for the source file)
#
define sh2html
{
# Setting up options
if ($n_args != 1)
{
# Wrong number of arguments
beep()
return ""
}
params = $1
if ("source" in params)
{
sourceFile = params["source"]
if (search_string(sourceFile, "^/", 0, "regex") == -1)
{
# relative path, prepend by $filepath
sourceFile = $file_path sourceFile
}
} else
{
# required key missing
beep()
return ""
}
if ("html" in params)
{
htmlFile = params["html"]
} else
{
htmlFile = sourceFile ".html"
}
if ("css" in params)
{
cssFile = params["css"]
} else
{
cssFile = sourceFile ".css"
}
if ("numbered" in params)
{
numbered = 1
} else
{
numbered = 0
}
# Begin and end of the fragment to work with
cursorPos = 0
fragmentEnd = 1
# Array to keep the names of all styles already in CSS
stylesInCSS = $empty_array
# Setup some bits which will become part of the document
tab = " "
date = chomp(shell_command("date +%Y-%m-%d", ""))
myVersion = "2.5.1"
# Set up HTML templates
htmlHeader = \
"\n"\
"\n"\
"