anchor.diff:  
   
   %% @spec url_for(atom(), Context) -> iolist()
  -%% @doc Construct an uri from a named dispatch, assuming no parameters
  -url_for(Name, #context{dispatcher=Dispatcher}) ->
  -    gen_server:call(Dispatcher, {'url_for', Name, [], html}).
  +%% @doc Construct an uri from a named dispatch, assuming no parameters. Use html escape.
  +url_for(Name, #context{dispatcher=Dispatcher} = Context) ->
  +    gen_server:call(Dispatcher, {'url_for', Name, [], default_args(Context), html}).
   
   
   %% @spec url_for(atom(), Args, Context) -> iolist()
   %%        type Args = PropList
  -%% @doc Construct an uri from a named dispatch and the parameters
  +%% @doc Construct an uri from a named dispatch and the parameters. Use html escape.
   url_for(Name, Args, #context{dispatcher=Dispatcher} = Context) ->
  -    Args1 = append_qargs(Args, Context),
  -    gen_server:call(Dispatcher, {'url_for', Name, Args1, html}).
  -
  -
  -%% @spec url_for(atom(), Args, bool(), Context) -> iolist()
  +    Args1 = append_extra_args(Args, Context),
  +    gen_server:call(Dispatcher, {'url_for', Name, Args1, default_args(Context), html}).
  +
  +
  +%% @spec url_for(atom(), Args, atom(), Context) -> iolist()
   %%        type Args = PropList
   %% @doc Construct an uri from a named dispatch and the parameters
   url_for(Name, Args, Escape, #context{dispatcher=Dispatcher} = Context) ->
  -    Args1 = append_qargs(Args, Context),
  -    gen_server:call(Dispatcher, {'url_for', Name, Args1, Escape}).
  +    Args1 = append_extra_args(Args, Context),
  +    gen_server:call(Dispatcher, {'url_for', Name, Args1, default_args(Context), Escape}).
   
   
   %% @spec hostname(Context) -> iolist()
  
positive.code:     revjoin(Rest, Separator, [S]);
  revjoin([S | Rest], Separator, Acc) ->
      revjoin(Rest, Separator, [S, Separator | Acc]).
  
  
  %% @spec Append all query arguments iff they are not mentioned in the arglist and if qargs parameter is set
  
negative.code:                   end,
              [Uri, $?, urlencode(QueryStringArgs, Sep)]
      end;
  make_url_for1(Args, [Pattern|T], Escape, Best, Defaults) ->
      Best1 = select_best_pattern(Args, Pattern, Best, Defaults),
      make_url_for1(Args, T, Escape, Best1, Defaults).
      
      
      % Find a value in the args, when not found then check the defaults.
      arg_value(V, Args, Defaults) ->
          case proplists:lookup(V, Args) of
              {V, Value} -> Value;
              none -> proplists:get_value(V, Defaults)
          end.
  
  
  select_best_pattern(Args, {PCount, PArgs, Pattern}, Best, Defaults) ->
      if 
          length(Args)+length(Defaults) >= PCount ->
              %% Check if all PArgs are part of Args
              {PathArgs, QueryStringArgs} = lists:partition(
                                              fun
                                                  ({star,_}) -> lists:member('*', PArgs);
                                                  ({A,_}) -> lists:member(A, PArgs)
                                              end, Args),
              case length(PathArgs) of
                  PCount ->
                      % Could fill all path args, this match satisfies
                      select_best_pattern1({QueryStringArgs,Pattern}, Best);
                  _ ->
                      % Check if there are defaults for the missing path args
                      case lists:foldl(fun(PArg, HasDefaults) ->
                                          HasDefaults andalso 
                                              (        lists:keymember(PArg, 1, PathArgs)
                                                orelse lists:keymember(PArg, 1, Defaults))
                                       end,
                                       true,
                                       PArgs) of
                          true -> select_best_pattern1({QueryStringArgs, Pattern}, Best);
                          false -> Best
                      end
              end;
          true ->
              Best
  