rails-assets-markdown-it-hashtag-0.4.0/0000755000004100000410000000000012613727255020036 5ustar www-datawww-datarails-assets-markdown-it-hashtag-0.4.0/rails-assets-markdown-it-hashtag.gemspec0000644000004100000410000000143112613727255027663 0ustar www-datawww-data# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'rails-assets-markdown-it-hashtag/version' Gem::Specification.new do |spec| spec.name = "rails-assets-markdown-it-hashtag" spec.version = RailsAssetsMarkdownItHashtag::VERSION spec.authors = ["rails-assets.org"] spec.description = "hashtag for markdown-it markdown parser" spec.summary = "hashtag for markdown-it markdown parser" spec.homepage = "https://github.com/svbergerem/markdown-it-hashtag" spec.license = "MIT" spec.files = `find ./* -type f | cut -b 3-`.split($/) spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" end rails-assets-markdown-it-hashtag-0.4.0/Rakefile0000644000004100000410000000003412613727255021500 0ustar www-datawww-datarequire "bundler/gem_tasks" rails-assets-markdown-it-hashtag-0.4.0/Gemfile0000644000004100000410000000011112613727255021322 0ustar www-datawww-datasource 'https://rubygems.org' source 'https://rails-assets.org' gemspec rails-assets-markdown-it-hashtag-0.4.0/lib/0000755000004100000410000000000012613727255020604 5ustar www-datawww-datarails-assets-markdown-it-hashtag-0.4.0/lib/rails-assets-markdown-it-hashtag/0000755000004100000410000000000012613727255027065 5ustar www-datawww-datarails-assets-markdown-it-hashtag-0.4.0/lib/rails-assets-markdown-it-hashtag/version.rb0000644000004100000410000000007412613727255031100 0ustar www-datawww-datamodule RailsAssetsMarkdownItHashtag VERSION = "0.4.0" end rails-assets-markdown-it-hashtag-0.4.0/lib/rails-assets-markdown-it-hashtag.rb0000644000004100000410000000137712613727255027422 0ustar www-datawww-datarequire "rails-assets-markdown-it-hashtag/version" module RailsAssetsMarkdownItHashtag def self.gem_path Pathname(File.realpath(__FILE__)).join('../..') end def self.gem_spec Gem::Specification::load( gem_path.join("rails-assets-markdown-it-hashtag.gemspec").to_s ) end def self.load_paths gem_path.join('app/assets').each_child.to_a end def self.dependencies [ ] end if defined?(Rails) class Engine < ::Rails::Engine # Rails -> use app/assets directory. end end end class RailsAssets @components ||= [] class << self attr_accessor :components def load_paths components.flat_map(&:load_paths) end end end RailsAssets.components << RailsAssetsMarkdownItHashtag rails-assets-markdown-it-hashtag-0.4.0/metadata.yml0000644000004100000410000000365212613727255022347 0ustar www-datawww-data--- !ruby/object:Gem::Specification name: rails-assets-markdown-it-hashtag version: !ruby/object:Gem::Version version: 0.4.0 platform: ruby authors: - rails-assets.org autorequire: bindir: bin cert_chain: [] date: 2015-10-06 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: bundler requirement: !ruby/object:Gem::Requirement requirements: - - ~> - !ruby/object:Gem::Version version: '1.3' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ~> - !ruby/object:Gem::Version version: '1.3' - !ruby/object:Gem::Dependency name: rake requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' description: hashtag for markdown-it markdown parser email: executables: [] extensions: [] extra_rdoc_files: [] files: - Gemfile - README.md - Rakefile - app/assets/javascripts/markdown-it-hashtag.js - app/assets/javascripts/markdown-it-hashtag/markdown-it-hashtag.js - lib/rails-assets-markdown-it-hashtag.rb - lib/rails-assets-markdown-it-hashtag/version.rb - rails-assets-markdown-it-hashtag.gemspec homepage: https://github.com/svbergerem/markdown-it-hashtag licenses: - MIT metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: rubygems_version: 2.4.8 signing_key: specification_version: 4 summary: hashtag for markdown-it markdown parser test_files: [] rails-assets-markdown-it-hashtag-0.4.0/app/0000755000004100000410000000000012613727255020616 5ustar www-datawww-datarails-assets-markdown-it-hashtag-0.4.0/app/assets/0000755000004100000410000000000012613727255022120 5ustar www-datawww-datarails-assets-markdown-it-hashtag-0.4.0/app/assets/javascripts/0000755000004100000410000000000012613727255024451 5ustar www-datawww-datarails-assets-markdown-it-hashtag-0.4.0/app/assets/javascripts/markdown-it-hashtag/0000755000004100000410000000000012613727255030322 5ustar www-datawww-data././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootrails-assets-markdown-it-hashtag-0.4.0/app/assets/javascripts/markdown-it-hashtag/markdown-it-hashtag.jsrails-assets-markdown-it-hashtag-0.4.0/app/assets/javascripts/markdown-it-hashtag/markdown-it-hashta0000644000004100000410000001177612613727255033763 0ustar www-datawww-data/*! markdown-it-hashtag 0.4.0 https://github.com/svbergerem/markdown-it-hashtag @license MIT */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.markdownitHashtag = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o'; } function hashtag_close() { return ''; } function hashtag_text(tokens, idx) { return '#' + tokens[idx].content; } ////////////////////////////////////////////////////////////////////////// function isLinkOpen(str) { return /^\s]/i.test(str); } function isLinkClose(str) { return /^<\/a\s*>/i.test(str); } module.exports = function hashtag_plugin(md, options) { var arrayReplaceAt = md.utils.arrayReplaceAt, escapeHtml = md.utils.escapeHtml, regex, hashtagRegExp = '\\w+', preceding = '^|\\s'; if (options) { if (typeof options.preceding !== 'undefined') { preceding = options.preceding; } if (typeof options.hashtagRegExp !== 'undefined') { hashtagRegExp = options.hashtagRegExp; } } regex = new RegExp('(' + preceding + ')#(' + hashtagRegExp + ')', 'g'); function hashtag(state) { var i, j, l, m, tagName, currentToken, token, tokens, Token = state.Token, blockTokens = state.tokens, htmlLinkLevel, matches, text, nodes, pos, level; for (j = 0, l = blockTokens.length; j < l; j++) { if (blockTokens[j].type !== 'inline') { continue; } tokens = blockTokens[j].children; htmlLinkLevel = 0; for (i = tokens.length - 1; i >= 0; i--) { currentToken = tokens[i]; // skip content of markdown links if (currentToken.type === 'link_close') { i--; while (tokens[i].level !== currentToken.level && tokens[i].type !== 'link_open') { i--; } continue; } // skip content of html links if (currentToken.type === 'html_inline') { // we are going backwards, so isLinkOpen shows end of link if (isLinkOpen(currentToken.content) && htmlLinkLevel > 0) { htmlLinkLevel--; } if (isLinkClose(currentToken.content)) { htmlLinkLevel++; } } if (htmlLinkLevel > 0) { continue; } if (currentToken.type !== 'text') { continue; } // find hashtags text = currentToken.content; matches = text.match(regex); if (matches === null) { continue; } nodes = []; level = currentToken.level; for (m = 0; m < matches.length; m++) { tagName = matches[m].split('#', 2)[1]; // find the beginning of the matched text pos = text.indexOf(matches[m]); // find the beginning of the hashtag pos = text.indexOf('#' + tagName, pos); if (pos > 0) { token = new Token('text', '', 0); token.content = text.slice(0, pos); token.level = level; nodes.push(token); } token = new Token('hashtag_open', '', 1); token.content = tagName; token.level = level++; nodes.push(token); token = new Token('hashtag_text', '', 0); token.content = escapeHtml(tagName); token.level = level; nodes.push(token); token = new Token('hashtag_close', '', -1); token.level = --level; nodes.push(token); text = text.slice(pos + 1 + tagName.length); } if (text.length > 0) { token = new Token('text', '', 0); token.content = text; token.level = level; nodes.push(token); } // replace current node blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes); } } } md.core.ruler.after('inline', 'hashtag', hashtag); md.renderer.rules.hashtag_open = hashtag_open; md.renderer.rules.hashtag_text = hashtag_text; md.renderer.rules.hashtag_close = hashtag_close; }; },{}]},{},[1])(1) });rails-assets-markdown-it-hashtag-0.4.0/app/assets/javascripts/markdown-it-hashtag.js0000644000004100000410000000006712613727255030663 0ustar www-datawww-data//= require markdown-it-hashtag/markdown-it-hashtag.js rails-assets-markdown-it-hashtag-0.4.0/README.md0000644000004100000410000000070612613727255021320 0ustar www-datawww-data# rails-assets-markdown-it-hashtag > The Bower package inside a gem This gem was automatically generated. You can visit [rails-assets.org](https://rails-assets.org) for more information. ## Usage Add rails-assets source block to your `Gemfile`: ```ruby source "https://rails-assets.org" do gem "rails-assets-markdown-it-hashtag" end ``` Then, import the asset using Sprockets’ `require` directive: ```js //= require "markdown-it-hashtag" ```