neocotic/template — Issue #64: New Function: Shorten
Author: neocotic
Created: 2012-02-08 11:42:01+00:00
State: open
Labels: javascript, template

Calls the URL shortener service with the rendered contents (hopefully a URL - trust the user here but perform simple validation - i.e. is blank, maybe also check that it begins with `http[s]://`).

During the initial render, replace all URLs with a unique placeholder (using `utils.keyGen` w/o a separator) while ensuring duplicate URLs are replaced with the same placeholders (minimizing calls to the web service) and then render the result again for each replacement, this time replacing the placeholders with the response from the web service (or showing any errors if they were encountered).

This makes `{short}` obsolete and therefore should be deprecated, replacing its functionality with `{#shorten}{url}{/shorten}`, which should also be used to replace the contents of the **Short** template.