anchor.diff:  	[DoctypeString | AST].
   
   handle_javascript(AST, Attr, SourceFN, {_, DTmp, DJS, _, _, _}) ->
  -	BaseName = filename:basename(SourceFN, ".zml"),
  +	{LibFiles, IndFiles} = get_js_list(Attr, SourceFN),
   
  -	JSFileList = get_js_list(Attr, SourceFN),
  -	LoadedFiles = load_js_files(JSFileList, DTmp),
  -	Result = optimize_js(LoadedFiles, filename:join([DJS, BaseName ++ ".js"])),
  -	case Result of
  -		[] -> great;
  -		_ -> erlang:error({"Javascript Error", Result})
  -	end,
  -	AST.
  +	% Optimize "lib" js files
  +	LoadedFiles = load_js_files(LibFiles, DTmp),
  +	OptLibFName = filename:join([DTmp, zml:tmp_filename()]),
  +	optimize_js(LoadedFiles, OptLibFName),
  +	file:write_file(OptLibFName, "_zmlll=1;", [append]),
  +	[MD5Sum | _] = string:tokens(os:cmd("md5sum '"++OptLibFName++"'")," "),
  +	FinLibFName = filename:join([DJS, MD5Sum ++ ".js"]),
  +	file:rename(OptLibFName, FinLibFName),
  +
  +	% Optimize inline js
  +	LF2 = load_js_files(IndFiles, DTmp),
  +	OptIndFName = filename:join([DTmp, zml:tmp_filename()]),
  +	optimize_js(LF2, OptIndFName, false),
  +	{ok, Inner} = file:read_file(OptIndFName),
  +	Inline = ?JS_LOADER("js/" ++ MD5Sum ++ ".js", Inner),
  +	% TODO! you are here.  Put this in the correct spot in the AST
  +	AST ++ [Inline].
   
   % Look in the attributes and in the source directory to see which javascript
   % files should be associated with this html block.  Resolves paths relative to
  
positive.code: 			end
  	end.
  
  optimize_js([], _) ->
  	[];
  optimize_js(Files, Dest) ->
  	Cmd = lists:flatten(["java -jar $ZML_CLOSURE_JAR",
  		lists:map(fun(A) -> [" --js=",A] end, Files),
  		" --js_output_file=", Dest,
  		" --compilation_level=ADVANCED_OPTIMIZATIONS",
  		" --warning_level=QUIET"]),
  	string:strip(os:cmd(Cmd)).
  
negative.code: %% Author: Joseph Wecker <joseph.wecker@gmail.com>
  %%
  %% TODO:
  %%  - Put js loader etc. in correct spot in AST
  %%  - Simplified case for loader if inline JS is empty
  %%  - Check environment variable for closure jar before trying the command in
  %%    order to make the error less cryptic.
  %%  - Shorten the library js filename - look in that dir. and see what's
  %%    already there, etc.?
  %%
  
  -module(zml_special_html).
  