More debugging

This commit is contained in:
Robin Ward 2016-08-10 12:14:42 -04:00
parent d1754ab2c7
commit 46b925f02b
3 changed files with 9 additions and 3 deletions
app/assets/javascripts/pretty-text/engines
lib

View file

@ -40,6 +40,7 @@ class DialectHelper {
registerInlineFeature(featureName, start, fn) {
this._dialect.inline[start] = function() {
console.log(`reginl: ${start} ${featureName}`);
if (!currentOpts.features[featureName]) { return; }
return fn.apply(this, arguments);
};

View file

@ -5,6 +5,8 @@
**/
export function setup(helper) {
console.log('initialize mention lookup!');
// We have to prune @mentions that are within links.
helper.onParseNode(event => {
const node = event.node,
@ -36,6 +38,11 @@ export function setup(helper) {
const opts = helper.getOptions();
const mentionLookup = opts.mentionLookup;
console.log(`mh0: ${name}`);
console.log(`mh1: ${mentionLookup}`);
if (mentionLookup) {
console.log(`mh2: ${mentionLookup(name)}`);
}
const type = mentionLookup && mentionLookup(name);
if (type === "user") {
return ['a', {'class': 'mention', href: opts.getURL("/users/") + name.toLowerCase()}, mention];

View file

@ -68,7 +68,7 @@ module PrettyText
apply_es6_file(ctx, root_path, Regexp.last_match[2])
elsif l =~ /\/\/= require_tree (\.\/)?(.*)$/
path = Regexp.last_match[2]
Dir["#{root_path}/#{path}/**"].each do |f|
Dir["#{root_path}/#{path}/**"].sort.each do |f|
apply_es6_file(ctx, root_path, f.sub(root_path, '')[1..-1].sub(/\.js.es6$/, ''))
end
end
@ -202,8 +202,6 @@ module PrettyText
working_text = text.dup
puts "options: #{options.inspect}"
sanitized = markdown(working_text, options)
puts "sanitized: #{sanitized}"