Add support for %%content{last}%% and %%content{last-n}%%