00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 from SCons.Script import Action, Dir, Mkdir
00034 from os.path import splitext
00035 from SCons.Scanner import Scanner
00036 from repro.scanners.latexgraphics import scanner_function
00037 from repro.DefaultL2Hfiles import l2hdefault_init, l2hdefault_style
00038 from repro.functions.SourceToHtml import PyHtmlAction
00039
00040
00041
00042
00043
00044
00045 def html_emitter( target, source, env ):
00046
00047 html_folder = splitext(str(target[0]))[0]
00048 l2h_init_fname = 'l2h_init-'+html_folder
00049 env.Clean( target, [html_folder, l2h_init_fname] )
00050
00051 env.Alias( 'html',target)
00052
00053 return (target + [l2h_init_fname], source)
00054
00055
00056
00057
00058
00059
00060 def generate(env):
00061
00062 env['debug'] = False
00063 env['_debug'] = "${debug and '-debug' or ' '}"
00064 env['LATEX2HTMLOPTS'] = "$_debug"
00065
00066 html_actions = [Action(l2hdefault_init),
00067 Mkdir('${TARGET.filebase}'),
00068 Action('latex2html $LATEX2HTMLOPTS -dir ${TARGET.filebase} '\
00069 '${SOURCE.abspath} -init_file l2h_init-${TARGET.filebase}'),
00070 Action(l2hdefault_style),
00071 ]
00072
00073 html_builder = env.Builder( action=html_actions,
00074 src_suffix='.ltx',
00075 emitter=html_emitter,
00076 target_factory=Dir,
00077 source_scanner=Scanner( scanner_function )
00078 )
00079
00080 env["BUILDERS"]['HTML'] = html_builder
00081
00082
00083 py_html_bldr = env.Builder( action=PyHtmlAction,
00084 suffix='.html',
00085 src_suffix='.py')
00086
00087 env["BUILDERS"]['ColorPySource'] = py_html_bldr
00088
00089
00090
00091
00092
00093 def exists( env ):
00094 return 1
00095
00096