anchor.diff:          {NewT,true} ->
               {[Tag | NewT],true};
           {T,false} ->
  -            {NewContent,NewState} = trim_last(Content,What),
  -            {[{Elem,Attr,NewContent}|T],NewState}
  +            case trim_last(Content,What) of
  +                {[],NewState} ->
  +                    {T,NewState};
  +                {NewContent,NewState} ->
  +                    {[{Elem,Attr,NewContent}|T],NewState}
  +            end
       end;
   trim_last([],_What) ->
       {[],false}.
  
positive.code: normalize_space([{Pre,Attr,Content}|T]) when ?IS_PRE(Pre) ->
      [{Pre,Attr,trim_first_and_last(Content,$\n)} | normalize_space(T)];
  normalize_space([{Block,Attr,Content}|T]) when ?IS_BLOCK(Block) ->
      [{Block,Attr,trim_first_and_last(trim_inline(Content),$ )} | normalize_space(T)];
  normalize_space([B]) when is_binary(B) ->
      trim_first_and_last([B],$ );
  normalize_space([E|T]) ->
      [E|normalize_space(T)];
  normalize_space([]) ->
      [].
  
  trim_inline(Content) ->
      {NewContent,_} = trim_inline(Content,false),
      NewContent.
  trim_inline([Bin|T],false) when is_binary(Bin) ->
      LastElem = binary:at(Bin,byte_size(Bin)-1),
      {NewT, NewState} = trim_inline(T,LastElem =:= $ ),
      {[Bin | NewT],NewState};
  trim_inline([<<" ">>|T],true) ->
      trim_inline(T,false);
  trim_inline([<<" ",Bin/binary>>|T],true) when is_binary(Bin) ->
      trim_inline([Bin | T],false);
  trim_inline([Bin|T],true) when is_binary(Bin) ->
      trim_inline([Bin|T],false);
  trim_inline([{Elem,Attr,Content}|T],TrimSpace) when ?IS_INLINE(Elem) ->
      {NewContent,ContentTrimSpace} = trim_inline(Content,TrimSpace),
      {NewT,TTrimSpace} = trim_inline(T,ContentTrimSpace),
      {[{Elem,Attr,NewContent} | NewT], TTrimSpace};
  trim_inline([{Elem1,_A1,_C1} = B1,<<" ">>,{Elem2,_A2,_C2} = B2|T],TrimSpace)
    when ?IS_BLOCK(Elem1),?IS_BLOCK(Elem2) ->
      trim_inline([B1,B2|T],TrimSpace);
  trim_inline([{Elem,_Attr,_Content} = Block|T],_TrimSpace) when ?IS_BLOCK(Elem) ->
      [NewBlock] = normalize_space([Block]),
      {NewT,TTrimSpace} = trim_inline(T,false),
      {[NewBlock | NewT], TTrimSpace};
  trim_inline([],TrimSpace) ->
      {[],TrimSpace}.
  
  
negative.code:     end;
  trim_first([{Elem,Attr,Content} = Tag|T],false,What) ->
      case trim_first(Content,false,What) of
          {[],true} ->
              {T,true};
          {NewContent,true} ->
              {[{Elem,Attr,NewContent}|T],true};
          {Content,false} ->
  