More debugging
This commit is contained in:
parent
d1754ab2c7
commit
46b925f02b
3 changed files with 9 additions and 3 deletions
app/assets/javascripts/pretty-text/engines
lib
|
@ -40,6 +40,7 @@ class DialectHelper {
|
||||||
|
|
||||||
registerInlineFeature(featureName, start, fn) {
|
registerInlineFeature(featureName, start, fn) {
|
||||||
this._dialect.inline[start] = function() {
|
this._dialect.inline[start] = function() {
|
||||||
|
console.log(`reginl: ${start} ${featureName}`);
|
||||||
if (!currentOpts.features[featureName]) { return; }
|
if (!currentOpts.features[featureName]) { return; }
|
||||||
return fn.apply(this, arguments);
|
return fn.apply(this, arguments);
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
**/
|
**/
|
||||||
export function setup(helper) {
|
export function setup(helper) {
|
||||||
|
|
||||||
|
console.log('initialize mention lookup!');
|
||||||
|
|
||||||
// We have to prune @mentions that are within links.
|
// We have to prune @mentions that are within links.
|
||||||
helper.onParseNode(event => {
|
helper.onParseNode(event => {
|
||||||
const node = event.node,
|
const node = event.node,
|
||||||
|
@ -36,6 +38,11 @@ export function setup(helper) {
|
||||||
const opts = helper.getOptions();
|
const opts = helper.getOptions();
|
||||||
const mentionLookup = opts.mentionLookup;
|
const mentionLookup = opts.mentionLookup;
|
||||||
|
|
||||||
|
console.log(`mh0: ${name}`);
|
||||||
|
console.log(`mh1: ${mentionLookup}`);
|
||||||
|
if (mentionLookup) {
|
||||||
|
console.log(`mh2: ${mentionLookup(name)}`);
|
||||||
|
}
|
||||||
const type = mentionLookup && mentionLookup(name);
|
const type = mentionLookup && mentionLookup(name);
|
||||||
if (type === "user") {
|
if (type === "user") {
|
||||||
return ['a', {'class': 'mention', href: opts.getURL("/users/") + name.toLowerCase()}, mention];
|
return ['a', {'class': 'mention', href: opts.getURL("/users/") + name.toLowerCase()}, mention];
|
||||||
|
|
|
@ -68,7 +68,7 @@ module PrettyText
|
||||||
apply_es6_file(ctx, root_path, Regexp.last_match[2])
|
apply_es6_file(ctx, root_path, Regexp.last_match[2])
|
||||||
elsif l =~ /\/\/= require_tree (\.\/)?(.*)$/
|
elsif l =~ /\/\/= require_tree (\.\/)?(.*)$/
|
||||||
path = Regexp.last_match[2]
|
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$/, ''))
|
apply_es6_file(ctx, root_path, f.sub(root_path, '')[1..-1].sub(/\.js.es6$/, ''))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -202,8 +202,6 @@ module PrettyText
|
||||||
|
|
||||||
working_text = text.dup
|
working_text = text.dup
|
||||||
|
|
||||||
puts "options: #{options.inspect}"
|
|
||||||
|
|
||||||
sanitized = markdown(working_text, options)
|
sanitized = markdown(working_text, options)
|
||||||
puts "sanitized: #{sanitized}"
|
puts "sanitized: #{sanitized}"
|
||||||
|
|
||||||
|
|
Reference in a new issue