Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linkify 2.0 #51

Merged
merged 68 commits into from Jun 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
66a92d2
Initial commit of basic Linkify 2.0
nfrasser Jan 2, 2015
390ab15
Very basic hashtag support
nfrasser Jan 3, 2015
3cb7101
Linkify `test` method
nfrasser Jan 3, 2015
851119a
Tests cases for linkify hashtags
nfrasser Jan 3, 2015
7f45ef8
Basic String API for linkify
nfrasser Jan 4, 2015
027aaa9
Fixes for linkify-string and initial test cases
nfrasser Jan 6, 2015
d44b852
Switching to ES6 Module system
nfrasser Jan 12, 2015
bc935ac
Quick test cases for linkify-string
nfrasser Jan 12, 2015
5e9788c
String jshing error, this fixes it.
nfrasser Jan 12, 2015
1f4827c
Directory restructure to better play with modules
nfrasser Jan 14, 2015
987f65f
Moving everything yet again to make the AMD compiler happy
nfrasser Jan 14, 2015
838f327
Looks like we have a working AMD module system!
nfrasser Jan 14, 2015
5846ac0
More tweaking, preparing additional building blocks
nfrasser Jan 14, 2015
355c814
Finishing off the Linkify 2.0 build system
nfrasser Jan 18, 2015
ea32f87
Configuration for Node.js
nfrasser Jan 18, 2015
c537170
Updated plugin build locations
nfrasser Jan 18, 2015
f87023b
Better linkify-string options
nfrasser Jan 18, 2015
cd63fcc
linkify-string prototype, initial round of docs updates
nfrasser Jan 18, 2015
754f7b5
Updated docs and renamed test files
nfrasser Jan 19, 2015
960d375
Further tests updates, dependencies
nfrasser Jan 19, 2015
54c8a9e
Options and initial linkify-element code
nfrasser Jan 28, 2015
bb5e6a9
Tokens to nodes implementation
nfrasser Feb 1, 2015
87db493
Linkify element, reverting to push.apply
nfrasser Feb 8, 2015
74ca125
push.apply for dynamic domain states
nfrasser Feb 8, 2015
3b3f226
Fixing up linkify element, build system updates
nfrasser Feb 8, 2015
5555999
Linkify element test and linkify jQuery
nfrasser Mar 1, 2015
32c262d
Updating dependencies
nfrasser Mar 1, 2015
089dede
Fixing newline token naming issues.
nfrasser Mar 1, 2015
e815449
Token fixes, test debugging for linkify-element
nfrasser Mar 1, 2015
a4873dd
Test fixes for linkify-element
nfrasser Mar 8, 2015
17053f6
Build tool enhancements
nfrasser Mar 8, 2015
d83762e
jQuery interface fixes and tests
nfrasser Mar 9, 2015
3eef0f7
Linkify Build fixes
nfrasser Mar 9, 2015
83116a6
Find by type and additional linkify tests
nfrasser Mar 14, 2015
36d5fde
Code coverage
nfrasser Mar 15, 2015
010241b
Improved gulp file stream handling
nfrasser Mar 16, 2015
c3b6a80
Better jQuery/HTML testing options
nfrasser Mar 16, 2015
6308e2c
Updated documentation
nfrasser Mar 16, 2015
eb66d3f
Fixed jQuery interface build step
nfrasser Mar 16, 2015
dbd9165
Preparing for prerelease
nfrasser Mar 16, 2015
bfa77c7
Do not trip the text nodes
nfrasser Mar 16, 2015
052905a
Updated Readme, package.json bump
nfrasser Mar 16, 2015
818ccdc
Updating dev dependencies
nfrasser Mar 16, 2015
c666b73
Badges galore!
nfrasser Mar 16, 2015
343d73d
Test/compilation fixes, Travis, readme
nfrasser Mar 16, 2015
73bbd29
NPM version bump, additional docs
nfrasser Mar 16, 2015
cb1e6c1
travis.yml fixes
nfrasser Mar 16, 2015
219c70a
Wrapping Travis node versions in quotes
nfrasser Mar 16, 2015
8d1eb20
Readme fixes, Travis
nfrasser Mar 16, 2015
9276679
Small readme update, prepublish script
nfrasser Mar 16, 2015
ba00660
Tiny readme update
nfrasser Mar 18, 2015
ced72c4
Updated gitignore for demo site branch
nfrasser Mar 30, 2015
7e67b31
Gulp tasks of legacy and benchmarks
nfrasser Mar 31, 2015
179823a
Added new `events` option to linkify-element
nfrasser Apr 4, 2015
410a90e
Legacy build files now save into the correct folder
nfrasser Apr 4, 2015
8a40469
Removing old demo folder
nfrasser Apr 4, 2015
c653bcb
Tweaking dev files for Saucelabs CI
nfrasser May 31, 2015
7a1f033
Refactoring linkify-test tests for maintainability
nfrasser May 31, 2015
2542d02
Updated test names, browser compatibility
nfrasser Jun 6, 2015
d1f7046
Alternate test script so complete suite is not always run
nfrasser Jun 7, 2015
833bd59
Fixed test run script filename in .travis.yml
nfrasser Jun 7, 2015
6065e51
Moved test runner file for better node compatibility
nfrasser Jun 7, 2015
508443a
Updating .npmignore, better legacy template
nfrasser Jun 7, 2015
b0dbdfc
Full IE 9+, partial IE8 support
nfrasser Jun 7, 2015
384f590
Fixed typo in package.json
nfrasser Jun 7, 2015
d7c0f04
Additional possible HTML for IE9 DOM test
nfrasser Jun 10, 2015
18089d2
Updated README, added first CONTRIBUTING.md
nfrasser Jun 10, 2015
2fab342
v2.0.0-beta.1, changelog
nfrasser Jun 13, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 39 additions & 1 deletion .gitignore
Expand Up @@ -6,5 +6,43 @@
Thumbs.DB
node_modules
bower_components
build/*
demo/dist/*

# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules

# Build files
build
dist
lib

# Specific to plugin website branch
.sass-cache
_site
_sass
js
35 changes: 15 additions & 20 deletions .jshintrc
@@ -1,21 +1,16 @@
{
"boss": true,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"expr": true,
"immed": false,
"noarg": true,
"smarttabs": true,
"trailing": true,
"unused": true,
"strict": false,
"node": true,
"browser": true,
"jquery": true,
"globals": {
"prettyPrint": false,
"jQuery": false,
"Linkified": false
}
}
"esnext": true,
"globalstrict": false,
"node": true,
"globals": {
"__base": false,
"__TLDS__": false,
"after": false,
"afterEach": false,
"before": false,
"beforeEach": false,
"expect": false,
"describe": false,
"it": false
}
}
24 changes: 24 additions & 0 deletions .npmignore
@@ -0,0 +1,24 @@
# All compiled code will be in the `lib` folders
.sass-cache
_sass
_site
amd
assets
bower_components
build
coverage
demo
dist
js
src
templates
test

# Files
.editorconfig
.jshintrc
.travis.yml
bower.json
gulpfile.js
testem.json
run-tests.sh
11 changes: 11 additions & 0 deletions .travis.yml
@@ -0,0 +1,11 @@
language: node_js
node_js:
- "0.12"
- "0.10"
- "iojs"
env:
global:
- secure: LhH+mMqOktTe6cIt97PGKBfgUjZM8vRd0qddyg61FSxg7a3WrHQoHE8WdRioJ9+DDzpu/NSTsHEUFUpGN+kSRw1UY4tsNLH6HoBQnqrNN4tVOeefudJpdeteOKZrJ8r8TaA/eO7sAgXO2T+RLJ8+qTbhx8FVZtLaCAgkrS0w9Qk=
- secure: Okwm1aAR3oo09AhHDsjFSq1UGlIUtWYYvYeoolJScC/UVFGMiK9oC4fzRtUHv3kXcnshDlcVDrr/Q5JL9Qx6E+tosPJp+tioaqE8X4IDbVk7PPs/ToOOEmWnGvxkgmfCGSDuneG8RVhILkhls3fbm0z+rRWlvJkjefeA96T6zps=
script: ./run-tests.sh
after_script: npm run coverage
11 changes: 11 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,11 @@
# Linkify Changelog

### v2.0.0

* New link-detection technique based on lexicographical analysis via two-stage scanner - essentially regexp with more flexibility.
* Node.js API via `var linkify = require('linkifyjs');`
* Internal plugin system so you can require only features you need. e.g., `require('linkifyjs/plugins/hashtag')(linkify);`
* Browser modules (Browserify, AMD)
* Mocha Unit tests
* ES6 Implementation
* Updated documentation
82 changes: 82 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,82 @@
# Contributing

**Note:** This guide is a work in progress. Feel free to [submit an issue](https://github.com/SoapBox/jQuery-linkify/issues/new) if anything is confusing or unclear.

## How linkify works

_TODO: Insert diagram here_

Linkify uses a two stage lexicographical analysis to detect patterns in plain text.

The first stage, called the scanner, takes the input string and generates encompassing tokens that aggregate different types of components like domain names and TLDs. For example, substings like `http:` or `com` are converted into tokens named `PROTOCOL` and `TLD`, respectively.

The second stage, the parser, takes this array of tokens and aggregates them into complete entities that are either become links or do not. For example, the tokens `PROTOCOL`, `SLASH`, `SLASH`, `DOMAIN`, `TLD` (appearing in that order) are grouped into a `URL` entity. These groups are called multitokens.

A multi token is either a link or not a link. Basic linkify comes with these multitokens

* **`TEXT`** is plain text (that contains no linkable entities)
* **`NL`** represents a single newline character
* **`EMAIL`** email address
* **`URL`**

The latter two are converted to links. `NL` is in some cases converted to a `<br>` HTML tag.

You can use the Token class system to [create plugins](#building-plugins).

## Style

* ES6 Syntax (except tests for now)
* Hard tabs with a width of 4 characters

As usualy, try to keep it consistent with what's already there.

## Development

### Setup

1. Install the latest version of [Node.js](https://nodejs.org/)
2. Install the [gulp.js](http://gulpjs.com/) build system from the Terminal
* `npm install -g gulp`

### Building

Linkify is built and tested in the command line. Build tasks have the following format.

```
gulp <task>
```

Here are the primary build tasks used for development. See [gulpfile.js](https://github.com/SoapBox/jQuery-linkify/blob/master/gulpfile.js) for the complete list.

* **`build`** transpiles ES6 to ES5 (via [Babel](http://babeljs.io/)) from `src/` into `lib/`. The lib folder will be published to [NPM](https://www.npmjs.com/). Also generates browser-ready scripts (globals and [AMD](http://requirejs.org/docs/whyamd.html)) into the `build/` folder.
* **`dist`** copies and compresses the contents of `build/` into `dist/`. The contents of the dist folder will be published to [Bower](http://bower.io/).
* **default** (run `gulp` without arguments) runs `build` and begins watching files for changes (rebuilding when they do)

### Running tests

Here are the tools used for testing linkify:

* [Mocha](http://mochajs.org/) is our primary test case framework
* [JSHint](http://jshint.com/) for code linting
* [Istanbul](https://gotwarlost.github.io/istanbul/) for code coverage analysis
* [Karma](http://karma-runner.github.io/0.12/index.html) is our browser test runner
* [Sauce Labs](https://saucelabs.com/) for cross-browser testing

These are all configured to run on gulp. Tasks `mocha` and `jshint` are the most basic you can run. Other tasks include:

* `test` transpiles the code and runs JSHint and Mocha
* `coverage` runs Istanbul code coverage on the Mocha tests
* Karma has a number of tasks that allow you to run Mocha tests on different browsers (via [Browserify](http://browserify.org/))
* `karma` runs tests on the [PhantomJS](http://phantomjs.org/) headless browser
* `karma-chrome` runs tests on [Google Chrome](http://www.google.com/chrome/)
* `karma-ci` (or `test-ci`) runs Sauce Labs cross-browser tests (Sauce Labs environment configuration required)

### Building plugins

**Caution:** The plugin development API is in its very early stages and only supports very basic plugins. Updated features, APIs, and docs are in the works.

Check out the sample [Hashtag plugin](https://github.com/SoapBox/jQuery-linkify/blob/2.0/src/linkify/plugins/hashtag.js) for an idea of how plugins are made. You have access to all the previously described tokens from the `linkify` variable. And should be able to extend them as necessary.

If you decide that your plugin can be used by many people, you can add them to `src/linkify/plugins/`. Make sure you also create build templates for your plugin inside `templates/linkify/plugins/`. Follow the format of the existing files.

Any plugin you add to `src/linkify/plugins/` will automatically be added to the build system.
181 changes: 0 additions & 181 deletions Gruntfile.js

This file was deleted.