aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisko Hevery2010-11-02 18:39:30 -0700
committerIgor Minar2010-11-03 09:47:22 -0700
commit5159eb76350a4da587bab3d73e212ed134cde789 (patch)
tree8027cdee61d97e3be28b81714bf0397fd65d8863
parent1ba8c2a33a2855b5c56aaaa79f402aa5196cc018 (diff)
downloadangular.js-5159eb76350a4da587bab3d73e212ed134cde789.tar.bz2
fix the linky filter
-rw-r--r--.idea/projectCodeStyle.xml9
-rw-r--r--.idea/runConfigurations/gen_docs.xml2
-rw-r--r--.idea/runConfigurations/rake_compile.xml2
-rw-r--r--.idea/workspace.xml211
-rw-r--r--docs/docs-scenario.html1
-rw-r--r--src/filters.js32
-rw-r--r--src/scenario/dsl.js1
-rwxr-xr-xtest.sh1
-rw-r--r--test/FiltersSpec.js9
9 files changed, 234 insertions, 34 deletions
diff --git a/.idea/projectCodeStyle.xml b/.idea/projectCodeStyle.xml
index a5c450f7..e9f2d7f2 100644
--- a/.idea/projectCodeStyle.xml
+++ b/.idea/projectCodeStyle.xml
@@ -24,6 +24,15 @@
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
+ <ADDITIONAL_INDENT_OPTIONS fileType="jsp">
+ <option name="INDENT_SIZE" value="4" />
+ <option name="CONTINUATION_INDENT_SIZE" value="8" />
+ <option name="TAB_SIZE" value="4" />
+ <option name="USE_TAB_CHARACTER" value="false" />
+ <option name="SMART_TABS" value="false" />
+ <option name="LABEL_INDENT_SIZE" value="0" />
+ <option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ </ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="sass">
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
diff --git a/.idea/runConfigurations/gen_docs.xml b/.idea/runConfigurations/gen_docs.xml
index 23afac13..f868b817 100644
--- a/.idea/runConfigurations/gen_docs.xml
+++ b/.idea/runConfigurations/gen_docs.xml
@@ -5,7 +5,7 @@
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="PARENT_ENVS" value="true" />
<envs />
- <module name="" />
+ <module name="angular.js" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/gen_docs.sh" />
<option name="PARAMETERS" value="" />
<RunnerSettings RunnerId="BashRunner" />
diff --git a/.idea/runConfigurations/rake_compile.xml b/.idea/runConfigurations/rake_compile.xml
index d69f3466..fa79475d 100644
--- a/.idea/runConfigurations/rake_compile.xml
+++ b/.idea/runConfigurations/rake_compile.xml
@@ -5,7 +5,7 @@
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="PARENT_ENVS" value="true" />
<envs />
- <module name="" />
+ <module name="angular.js" />
<option name="SCRIPT_NAME" value="/usr/bin/rake" />
<option name="PARAMETERS" value="compile" />
<RunnerSettings RunnerId="BashRunner" />
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 62adcd33..355943e1 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
- <list default="true" readonly="true" id="2e561485-a685-4e95-bea4-cabeda87d953" name="Default" comment="" />
+ <list default="true" readonly="true" id="2e561485-a685-4e95-bea4-cabeda87d953" name="Default" comment="updated Rakefile to support packaging of the docs">
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/filters.js" afterPath="$PROJECT_DIR$/src/filters.js" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/docs/docs-scenario.html" afterPath="$PROJECT_DIR$/docs/docs-scenario.html" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
+ </list>
<ignored path=".idea/workspace.xml" />
<ignored path="angular.js.iws" />
<option name="TRACKING_ENABLED" value="true" />
@@ -23,7 +27,88 @@
</component>
<component name="FileColors" enabled="true" enabledForTabs="true" />
<component name="FileEditorManager">
- <leaf />
+ <splitter split-orientation="horizontal" split-proportion="0.5">
+ <split-first>
+ <leaf>
+ <file leaf-file-name="filters.js" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/filters.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="377" column="5" selection-start="12137" selection-end="12137" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="docs-scenario.html" pinned="false" current="true" current-in-tab="true">
+ <entry file="file://$PROJECT_DIR$/docs/docs-scenario.html">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="3" column="26" selection-start="119" selection-end="119" vertical-scroll-proportion="0.039173014">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="validators.js" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/validators.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="54" column="69" selection-start="1564" selection-end="1611" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="test.sh" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/test.sh">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="3" column="13" selection-start="59" selection-end="59" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="docs-scenario.html" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/build/docs/docs-scenario.html">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="5" column="44" selection-start="259" selection-end="259" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="index.html" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/build/docs/index.html">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="24" column="7" selection-start="1033" selection-end="1033" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="angular.filter.html.html" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/build/docs/angular.filter.html.html">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ </leaf>
+ </split-first>
+ <split-second>
+ <leaf>
+ <file leaf-file-name="FiltersSpec.js" pinned="false" current="false" current-in-tab="true">
+ <entry file="file://$PROJECT_DIR$/test/FiltersSpec.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="89" column="20" selection-start="2996" selection-end="2996" vertical-scroll-proportion="0.7635783">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ </leaf>
+ </split-second>
+ </splitter>
</component>
<component name="FindManager">
<FindUsagesManager>
@@ -40,6 +125,11 @@
<option value="$PROJECT_DIR$/lib/nodeserver/server.js" />
<option value="$PROJECT_DIR$/Rakefile" />
<option value="$PROJECT_DIR$/docs/collect.js" />
+ <option value="$PROJECT_DIR$/src/scenario/dsl.js" />
+ <option value="$PROJECT_DIR$/test.sh" />
+ <option value="$PROJECT_DIR$/test/FiltersSpec.js" />
+ <option value="$PROJECT_DIR$/src/filters.js" />
+ <option value="$PROJECT_DIR$/docs/docs-scenario.html" />
</list>
</option>
</component>
@@ -69,8 +159,6 @@
<sortByType />
</navigator>
<panes>
- <pane id="Favorites" />
- <pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<PATH>
@@ -99,6 +187,20 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
+ <option name="myItemId" value="docs" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="angular.js" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="angular.js" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
<option name="myItemId" value="build" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
@@ -145,6 +247,8 @@
</PATH>
</subPane>
</pane>
+ <pane id="Favorites" />
+ <pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
@@ -156,7 +260,7 @@
<property name="options.splitter.details.proportions" value="0.2" />
<property name="options.searchVisible" value="true" />
</component>
- <component name="RunManager" selected="Bash.gen_docs.sh">
+ <component name="RunManager" selected="Bash.gen_docs">
<configuration default="false" name="gen_docs.sh" type="BashConfigurationType" factoryName="Bash" temporary="true">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="INTERPRETER_PATH" value="/bin/bash" />
@@ -170,6 +274,19 @@
<ConfigurationWrapper RunnerId="BashRunner" />
<method />
</configuration>
+ <configuration default="false" name="test.sh" type="BashConfigurationType" factoryName="Bash" temporary="true">
+ <option name="INTERPRETER_OPTIONS" value="" />
+ <option name="INTERPRETER_PATH" value="/bin/bash" />
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+ <option name="PARENT_ENVS" value="true" />
+ <envs />
+ <module name="angular.js" />
+ <option name="SCRIPT_NAME" value="$PROJECT_DIR$/test.sh" />
+ <option name="PARAMETERS" value="" />
+ <RunnerSettings RunnerId="BashRunner" />
+ <ConfigurationWrapper RunnerId="BashRunner" />
+ <method />
+ </configuration>
<configuration default="true" type="BashConfigurationType" factoryName="Bash">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="INTERPRETER_PATH" value="/bin/bash" />
@@ -181,8 +298,11 @@
<option name="PARAMETERS" value="" />
<method />
</configuration>
- <list size="1">
+ <list size="4">
<item index="0" class="java.lang.String" itemvalue="Bash.gen_docs.sh" />
+ <item index="1" class="java.lang.String" itemvalue="Bash.rake compile" />
+ <item index="2" class="java.lang.String" itemvalue="Bash.gen_docs" />
+ <item index="3" class="java.lang.String" itemvalue="Bash.test.sh" />
</list>
</component>
<component name="ShelveChangesManager" show_recycled="false" />
@@ -213,21 +333,21 @@
</component>
<component name="ToolWindowManager">
<frame x="0" y="22" width="2560" height="1574" extended-state="6" />
- <editor active="false" />
+ <editor active="true" />
<layout>
- <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
- <window_info id="Changes" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32943603" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
+ <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32943603" sideWeight="0.0" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
<window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.18020505" sideWeight="0.66574967" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
- <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32943603" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32943603" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+ <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
@@ -276,9 +396,7 @@
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/version.yaml">
<provider selected="true" editor-type-id="text-editor">
- <state line="2" column="23" selection-start="50" selection-end="58" vertical-scroll-proportion="0.025559105">
- <folding />
- </state>
+ <state line="2" column="23" selection-start="50" selection-end="58" vertical-scroll-proportion="0.025559105" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/docs/collect.js">
@@ -304,9 +422,7 @@
</entry>
<entry file="file://$PROJECT_DIR$/test/ResourceSpec.js">
<provider selected="true" editor-type-id="text-editor">
- <state line="13" column="35" selection-start="399" selection-end="399" vertical-scroll-proportion="0.16613418">
- <folding />
- </state>
+ <state line="13" column="35" selection-start="399" selection-end="399" vertical-scroll-proportion="0.16613418" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/nodeserver/server.js">
@@ -316,6 +432,69 @@
</state>
</provider>
</entry>
+ <entry file="file://$PROJECT_DIR$/src/scenario/dsl.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="109" column="11" selection-start="3010" selection-end="3010" vertical-scroll-proportion="-0.021905806">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/validators.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="54" column="69" selection-start="1564" selection-end="1611" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/test.sh">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="3" column="13" selection-start="59" selection-end="59" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/build/docs/docs-scenario.html">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="5" column="44" selection-start="259" selection-end="259" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/build/docs/index.html">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="24" column="7" selection-start="1033" selection-end="1033" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/build/docs/angular.filter.html.html">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/test/FiltersSpec.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="89" column="20" selection-start="2996" selection-end="2996" vertical-scroll-proportion="0.7635783">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/filters.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="377" column="5" selection-start="12137" selection-end="12137" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/docs/docs-scenario.html">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="3" column="26" selection-start="119" selection-end="119" vertical-scroll-proportion="0.039173014">
+ <folding />
+ </state>
+ </provider>
+ </entry>
</component>
</project>
diff --git a/docs/docs-scenario.html b/docs/docs-scenario.html
index 83ca6fdf..c75155c5 100644
--- a/docs/docs-scenario.html
+++ b/docs/docs-scenario.html
@@ -1,6 +1,7 @@
<!DOCTYPE HTML>
<html xmlns:ng="http://angularjs.org" wiki:ng="http://angularjs.org">
<head>
+ <title>&lt;angular/&gt; Docs Scenario Runner</title>
<script type="text/javascript" src="../angular-scenario.js" ng:autobind></script>
<script type="text/javascript" src="docs-scenario.js"></script>
</head>
diff --git a/src/filters.js b/src/filters.js
index 64d8c8ba..0cff6d56 100644
--- a/src/filters.js
+++ b/src/filters.js
@@ -360,7 +360,8 @@ angularFilter.html = function(html, option){
* @function
*
* @description
- * Finds links in text input and turns them into html links. Supports http/https/ftp/mailto links.
+ * Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and
+ * plane email address links.
*
* @param {string} text Input text.
* @returns {string} Html-linkified text.
@@ -369,7 +370,8 @@ angularFilter.html = function(html, option){
Snippet: <textarea name="snippet" cols="60" rows="3">
Pretty text with some links:
http://angularjs.org/,
-mailto:us@somewhere.org
+mailto:us@somewhere.org,
+another@somewhere.org,
and one more: ftp://127.0.0.1/.</textarea>
<table>
<tr>
@@ -392,13 +394,14 @@ and one more: ftp://127.0.0.1/.</textarea>
<td><div ng:bind="snippet"></div></td>
</tr>
</table>
-
+ *
* @scenario
it('should linkify the snippet with urls', function(){
expect(using('#linky-filter').binding('snippet | linky')).
toBe('Pretty text with some links:\n' +
- '<a href="http://angularjs.org/">http://angularjs.org/</a>,' +
- '<a href="mailto:us@somewhere.org">mailto:us@somewhere.org</a>\n' +
+ '<a href="http://angularjs.org/">http://angularjs.org/</a>,\n' +
+ '<a href="mailto:us@somewhere.org">us@somewhere.org</a>,\n' +
+ '<a href="mailto:another@somewhere.org">another@somewhere.org</a>,\n' +
'and one more: <a href="ftp://127.0.0.1/">ftp://127.0.0.1/</a>.');
});
@@ -406,7 +409,8 @@ and one more: ftp://127.0.0.1/.</textarea>
expect(using('#escaped-html').binding('snippet')).
toBe("Pretty text with some links:\n" +
"http://angularjs.org/,\n" +
- "mailto:us@somewhere.org\n" +
+ "mailto:us@somewhere.org,\n" +
+ "another@somewhere.org,\n" +
"and one more: ftp://127.0.0.1/.");
});
@@ -420,10 +424,7 @@ and one more: ftp://127.0.0.1/.</textarea>
//TODO: externalize all regexps
angularFilter.linky = function(text){
if (!text) return text;
- function regExpEscape(text) {
- return text.replace(/([\/\.\*\+\?\|\(\)\[\]\{\}\\])/g, '\\$1');
- }
- var URL = /(ftp|http|https|mailto):\/\/([^\(\)|\s]+)/;
+ var URL = /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s\.\;\,\(\)\{\}\<\>]/;
var match;
var raw = text;
var html = [];
@@ -431,13 +432,16 @@ angularFilter.linky = function(text){
var url;
var i;
while (match=raw.match(URL)) {
- url = match[0].replace(/[\.\;\,\(\)\{\}\<\>]$/,'');
- i = raw.indexOf(url);
+ // We can not end in these as they are sometimes found at the end of the sentence
+ url = match[0];
+ // if we did not match ftp/http/mailto then assume mailto
+ if (match[2]==match[3]) url = 'mailto:' + url;
+ i = match.index;
writer.chars(raw.substr(0, i));
writer.start('a', {href:url});
- writer.chars(url);
+ writer.chars(match[0].replace(/^mailto:/, ''));
writer.end('a');
- raw = raw.substring(i + url.length);
+ raw = raw.substring(i + match[0].length);
}
writer.chars(raw);
return new HTML(html.join(''));
diff --git a/src/scenario/dsl.js b/src/scenario/dsl.js
index 45156369..f37ab71d 100644
--- a/src/scenario/dsl.js
+++ b/src/scenario/dsl.js
@@ -170,7 +170,6 @@ angular.scenario.dsl('binding', function() {
if (element.is('input, textarea')) {
done(null, element.val());
} else {
- console.log('element.html(): ', element.html());
done(null, element.html());
}
return;
diff --git a/test.sh b/test.sh
index 19a74d4b..91876310 100755
--- a/test.sh
+++ b/test.sh
@@ -1,3 +1,4 @@
+#!/bin/sh
tests=$1
if [[ $tests = "" ]]; then
tests="all"
diff --git a/test/FiltersSpec.js b/test/FiltersSpec.js
index 4dd108ac..0de7b5b7 100644
--- a/test/FiltersSpec.js
+++ b/test/FiltersSpec.js
@@ -74,8 +74,8 @@ describe('filter', function(){
});
describe('Linky', function() {
+ var linky = filter.linky;
it('should do basic filter', function(){
- var linky = filter.linky;
assertEquals(
'<a href="http://ab/">http://ab/</a> ' +
'(<a href="http://a/">http://a/</a>) ' +
@@ -84,6 +84,13 @@ describe('filter', function(){
linky("http://ab/ (http://a/) <http://a/> http://1.2/v:~-123. c").html);
assertEquals(undefined, linky(undefined));
});
+
+ it('should handle mailto:', function(){
+ expect(linky("mailto:me@example.com").html).toEqual('<a href="mailto:me@example.com">me@example.com</a>');
+ expect(linky("me@example.com").html).toEqual('<a href="mailto:me@example.com">me@example.com</a>');
+ expect(linky("send email to me@example.com, but").html).
+ toEqual('send email to <a href="mailto:me@example.com">me@example.com</a>, but');
+ });
});
describe('date', function(){