Skip to content

Commit ac01255

Browse files
committed
Merge pull request #109 from RocketChat/master
Create official package for Meteor.com
2 parents 4336972 + 546a0e1 commit ac01255

File tree

4 files changed

+118
-0
lines changed

4 files changed

+118
-0
lines changed

meteor/export.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/*global Autolinker:true*/ // Meteor creates a file-scope global for exporting. This comment prevents a potential JSHint warning.
2+
Autolinker = window.Autolinker;
3+
delete window.Autolinker;

meteor/helpers.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
if (Package.templating) {
2+
var Template = Package.templating.Template;
3+
var Blaze = Package.blaze.Blaze; // implied by `templating`
4+
var HTML = Package.htmljs.HTML; // implied by `blaze`
5+
6+
Blaze.Template.registerHelper("autolinker", new Template('autolinker', function() {
7+
var view = this;
8+
var content = '';
9+
var linkerOptions = {};
10+
var linker;
11+
12+
if (view.templateContentBlock) {
13+
content = Blaze._toText(view.templateContentBlock, HTML.TEXTMODE.STRING);
14+
}
15+
16+
linker = new Autolinker(linkerOptions);
17+
return HTML.Raw(linker.link(content));
18+
}));
19+
}

meteor/package.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// package metadata file for Meteor.js
2+
'use strict';
3+
4+
var packageName = 'autolinker:autolinker'; // https://atmospherejs.com/autolinker/autolinker
5+
var where = 'client'; // where to install: 'client' or 'server'. For both, pass nothing.
6+
7+
var packageJson = JSON.parse(Npm.require("fs").readFileSync('package.json'));
8+
9+
Package.describe({
10+
name: packageName,
11+
summary: "Autolinker.js (official) - Automatically Link URLs, Email Addresses, Phone Numbers, Twitter handles, and Hashtags in a given block of text/HTML",
12+
version: packageJson.version,
13+
git: "https://github.com/gregjacobs/Autolinker.js.git"
14+
});
15+
16+
Package.onUse(function(api) {
17+
api.versionsFrom(['[email protected]', '[email protected]']);
18+
api.addFiles(['dist/Autolinker.js', 'meteor/export.js']);
19+
api.addFiles('meteor/helpers.js', ['client']);
20+
api.export('Autolinker');
21+
});
22+
23+
Package.onTest(function(api) {
24+
api.use(packageName, where);
25+
api.use('tinytest');
26+
api.addFiles('meteor/test.js');
27+
});

meteor/test.js

Lines changed: 69 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)