From 63f2187d72356dedc26d5e1d727580f2ba87b132 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Fri, 30 Aug 2013 10:56:41 -0400 Subject: [PATCH] FIX: Don't do intraword italics when prefixed by a forward slash --- app/assets/javascripts/discourse/dialects/dialect.js | 2 +- test/javascripts/components/markdown_test.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/dialects/dialect.js b/app/assets/javascripts/discourse/dialects/dialect.js index 302597b66f2..58bb55f7a17 100644 --- a/app/assets/javascripts/discourse/dialects/dialect.js +++ b/app/assets/javascripts/discourse/dialects/dialect.js @@ -64,7 +64,7 @@ function invalidBoundary(args, prev) { var last = prev[prev.length - 1]; if (typeof last !== "string") { return; } - if (args.wordBoundary && (!last.match(/\W$/))) { return true; } + if (args.wordBoundary && (last.match(/(\w|\/)$/))) { return true; } if (args.spaceBoundary && (!last.match(/\s$/))) { return true; } } diff --git a/test/javascripts/components/markdown_test.js b/test/javascripts/components/markdown_test.js index ef2d5e9dbfe..9f53d070582 100644 --- a/test/javascripts/components/markdown_test.js +++ b/test/javascripts/components/markdown_test.js @@ -23,6 +23,7 @@ test("basic cooking", function() { cooked("_trout_", "

trout

", "it italicizes text."); cooked("***hello***", "

hello

", "it can do bold and italics at once."); cooked("word_with_underscores", "

word_with_underscores

", "it doesn't do intraword italics"); + cooked("common/_special_font_face.html.erb", "

common/_special_font_face.html.erb

", "it doesn't intraword with a slash"); cooked("hello \\*evil\\*", "

hello *evil*

", "it supports escaping of asterisks"); cooked("hello \\_evil\\_", "

hello _evil_

", "it supports escaping of italics"); cooked("brussel sproutes are *awful*.", "

brussel sproutes are awful.

", "it doesn't swallow periods.");