Commit 8bc627a4 authored by Fred Drake's avatar Fred Drake

Add --l2h-init option, which can augment the standard LaTeX2HTML

initialization with additional Perl files.  This can be given more
than once.
parent b9b4c5b5
...@@ -97,6 +97,7 @@ class Options: ...@@ -97,6 +97,7 @@ class Options:
def __init__(self): def __init__(self):
self.formats = [] self.formats = []
self.l2h_init_files = []
def __getitem__(self, key): def __getitem__(self, key):
# This is used when formatting the usage message. # This is used when formatting the usage message.
...@@ -108,7 +109,7 @@ class Options: ...@@ -108,7 +109,7 @@ class Options:
def parse(self, args): def parse(self, args):
opts, args = getopt.getopt(args, "Hi:a:s:lDkqr:", opts, args = getopt.getopt(args, "Hi:a:s:lDkqr:",
["all", "postscript", "help", "iconserver=", ["all", "postscript", "help", "iconserver=",
"address=", "a4", "letter", "address=", "a4", "letter", "l2h-init=",
"link=", "split=", "logging", "debugging", "link=", "split=", "logging", "debugging",
"keep", "quiet", "runs=", "image-type=", "keep", "quiet", "runs=", "image-type=",
"about=", "numeric", "style="] "about=", "numeric", "style="]
...@@ -151,6 +152,8 @@ class Options: ...@@ -151,6 +152,8 @@ class Options:
self.numeric = 1 self.numeric = 1
elif opt == "--style": elif opt == "--style":
self.style_file = os.path.abspath(arg) self.style_file = os.path.abspath(arg)
elif opt == "--l2h-init":
self.l2h_init_files.append(os.path.abspath(arg))
# #
# Format specifiers: # Format specifiers:
# #
...@@ -303,7 +306,7 @@ class Job: ...@@ -303,7 +306,7 @@ class Job:
self.process_synopsis_files() self.process_synopsis_files()
def use_latex_manual(self, binary): def use_latex_manual(self, binary):
pass self.use_latex_howto(binary)
def process_synopsis_files(self): def process_synopsis_files(self):
synopsis_files = glob.glob(self.doc + "*.syn") synopsis_files = glob.glob(self.doc + "*.syn")
...@@ -364,6 +367,7 @@ class Job: ...@@ -364,6 +367,7 @@ class Job:
self.build_aux(binary=binary) self.build_aux(binary=binary)
def write_l2h_aux_init_file(self): def write_l2h_aux_init_file(self):
options = self.options
fp = open(self.l2h_aux_init_file, "w") fp = open(self.l2h_aux_init_file, "w")
d = string_to_perl(os.path.dirname(L2H_INIT_FILE)) d = string_to_perl(os.path.dirname(L2H_INIT_FILE))
fp.write("package main;\n" fp.write("package main;\n"
...@@ -371,12 +375,16 @@ class Job: ...@@ -371,12 +375,16 @@ class Job:
"$mydir = '%s';\n" "$mydir = '%s';\n"
% (d, d)) % (d, d))
fp.write(open(L2H_INIT_FILE).read()) fp.write(open(L2H_INIT_FILE).read())
for filename in options.l2h_init_files:
fp.write("\n# initialization code incorporated from:\n# ")
fp.write(filename)
fp.write("\n")
fp.write(open(filename).read())
fp.write("\n" fp.write("\n"
"# auxillary init file for latex2html\n" "# auxillary init file for latex2html\n"
"# generated by mkhowto\n" "# generated by mkhowto\n"
"$NO_AUTO_LINK = 1;\n" "$NO_AUTO_LINK = 1;\n"
) )
options = self.options
l2hoption(fp, "ABOUT_FILE", options.about_file) l2hoption(fp, "ABOUT_FILE", options.about_file)
l2hoption(fp, "ICONSERVER", options.icon_server) l2hoption(fp, "ICONSERVER", options.icon_server)
l2hoption(fp, "IMAGE_TYPE", options.image_type) l2hoption(fp, "IMAGE_TYPE", options.image_type)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment