Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions meteor/export.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/*global Autolinker:true*/ // Meteor creates a file-scope global for exporting. This comment prevents a potential JSHint warning.
Autolinker = window.Autolinker;
delete window.Autolinker;
19 changes: 19 additions & 0 deletions meteor/helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
if (Package.templating) {
var Template = Package.templating.Template;
var Blaze = Package.blaze.Blaze; // implied by `templating`
var HTML = Package.htmljs.HTML; // implied by `blaze`

Blaze.Template.registerHelper("autolinker", new Template('autolinker', function() {
var view = this;
var content = '';
var linkerOptions = {};
var linker;

if (view.templateContentBlock) {
content = Blaze._toText(view.templateContentBlock, HTML.TEXTMODE.STRING);
}

linker = new Autolinker(linkerOptions);
return HTML.Raw(linker.link(content));
}));
}
27 changes: 27 additions & 0 deletions meteor/package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// package metadata file for Meteor.js
'use strict';

var packageName = 'autolinker:autolinker'; // https://atmospherejs.com/autolinker/autolinker
var where = 'client'; // where to install: 'client' or 'server'. For both, pass nothing.

var packageJson = JSON.parse(Npm.require("fs").readFileSync('package.json'));

Package.describe({
name: packageName,
summary: "Autolinker.js (official) - Automatically Link URLs, Email Addresses, Phone Numbers, Twitter handles, and Hashtags in a given block of text/HTML",
version: packageJson.version,
git: "https://github.com/gregjacobs/Autolinker.js.git"
});

Package.onUse(function(api) {
api.versionsFrom(['[email protected]', '[email protected]']);
api.addFiles(['dist/Autolinker.js', 'meteor/export.js']);
api.addFiles('meteor/helpers.js', ['client']);
api.export('Autolinker');
});

Package.onTest(function(api) {
api.use(packageName, where);
api.use('tinytest');
api.addFiles('meteor/test.js');
});
69 changes: 69 additions & 0 deletions meteor/test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.