anchor.diff:      Acc = [{ids,[]}, {list,ul}, {functions,[]}, {types,Types}],
   
       {[_Id, _List, {functions,_Funs}, {types,_Types}], NXml}
  -        = render(fun tr_erlref/2,  Xml, Acc),
  +        = render(fun tr_erlref/2, Xml, Acc),
   
   %%  XmlFuns = [{li, [], [{a, [{href,"#"++X}], [X]}]}
   %%              || X <- lists:reverse(Funs) ],
  
positive.code:             throw({error_in_read_xml, XmlFile, Error})
      end.
  
  %% @doc shorthand for lists:keyfind
  -spec kf (_, list()) -> _.
  kf (Key, Conf) ->
      {Key, Val} = lists:keyfind(Key, 1, Conf),
  
negative.code:            , {ga,      kf(ga,Conf)}
             ],
      {ok, Data} = erldocs_dtl:render(Args),
      Path = jname(kf(dest,Conf), "index.html"),
      ok = file:write_file(Path, Data).
  
  index_to_xml (SortedIndex) ->
      lists:flatmap(
        fun ({"app", App, _,  _Sum}) ->
                [{a, [{name, App}]}, {h4, [], [App]}];
            ({"mod", App, Mod, Sum}) ->
                Url = jname(App, Mod++".html"),
                [{p,[], [{a, [{href, Url}], [Mod]}, {br,[],[]}, Sum]}];
            ({"fun", _App, _MFA, _Sum}) ->
                []
        end,
        SortedIndex).
  
  
  sort_index (Index) ->
      lists:sort(fun compare_index_items/2, Index).
  
  compare_index_items (Lhs, Rhs) ->
      index_ordering(Lhs) =< index_ordering(Rhs).
  
  index_ordering ({Type, App, Mod, _Sum}) ->
      [ string:to_lower(App)
      , index_item(Type)
      , string:to_lower(Mod)
      ].
  
  index_item ("app") -> 1;
  index_item ("mod") -> 2;
  index_item ("fun") -> 3.
  
  
  js_strip (Str) ->
      [C || C <- Str, C /= $\n, C /= $\r, C /= $'].
  
  javascript_index (Conf, SortedIndex) ->
      ?log("Creating erldocs_index.js ..."),
      IndexStr = iolists_tl(  %% Removes leading $,
                   [ [ ",['", js_strip(A)
                     , "','", js_strip(B)
                     , "','", js_strip(C)
                     , "','", js_strip(D), "']"
                     ]
                     || {A,B,C,D} <- SortedIndex ]
                  ),
      %% io:format("bin ~s\n", [iolists_flatten(IndexStr)]),
      Data = ["var index = [", IndexStr, "];"],
      Path = jname(kf(dest,Conf), "erldocs_index.js"),
      ok = file:write_file(Path, Data).
  
  %% Note: handles both erlref and cref types
  render (App, Mod, Xml, Types, Conf) ->
      File = jname([kf(dest,Conf), App, Mod++".html"]),
  