FIX: Bold, italic should not expect a space boundary

This commit is contained in:
Sam 2014-06-26 17:44:41 +10:00
parent 7a65ee3282
commit 24ddb6cfad
3 changed files with 10 additions and 4 deletions

View File

@ -7,14 +7,12 @@
Discourse.Dialect.inlineBetween({
between: '***',
wordBoundary: true,
spaceBoundary: true,
emitter: function(contents) { return ['strong', ['em'].concat(contents)]; }
});
Discourse.Dialect.inlineBetween({
between: '___',
wordBoundary: true,
spaceBoundary: true,
emitter: function(contents) { return ['strong', ['em'].concat(contents)]; }
});
@ -23,7 +21,6 @@ var replaceMarkdown = function(match, tag) {
Discourse.Dialect.inlineBetween({
between: match,
wordBoundary: true,
spaceBoundary: true,
emitter: function(contents) { return [tag].concat(contents) }
});
};

View File

@ -254,7 +254,7 @@ Discourse.Dialect = {
@param {String} [opts.between] A shortcut for when the `start` and `stop` are the same.
@param {Boolean} [opts.rawContents] If true, the contents between the tokens will not be parsed.
@param {Boolean} [opts.wordBoundary] If true, the match must be on a word boundary
@param {Boolean} [opts.spaceBoundary] If true, the match must be on a sppace boundary
@param {Boolean} [opts.spaceBoundary] If true, the match must be on a space boundary
**/
inlineBetween: function(args) {
var start = args.start || args.between,

View File

@ -242,6 +242,11 @@ describe PrettyText do
describe "markdown quirks" do
it "bolds stuff in parens" do
PrettyText.cook("a \"**hello**\"").should match_html "<p>a &quot;<strong>hello</strong>&quot;</p>"
PrettyText.cook("(**hello**)").should match_html "<p>(<strong>hello</strong>)</p>"
# is it me your looking for?
end
it "allows for newline after bold" do
PrettyText.cook("**hello**\nworld").should match_html "<p><strong>hello</strong><br />world</p>"
end
@ -249,6 +254,10 @@ describe PrettyText do
PrettyText.cook("**hello**\n**world**").should match_html "<p><strong>hello</strong><br /><strong>world</strong></p>"
end
pending "allows does not bold chinese intra word" do
PrettyText.cook("你**hello**").should match_html "<p>你**hello**</p>"
end
pending "does not break a streak for mentions" do
Fabricate(:user, username: 'sam')
PrettyText.cook("<small>a @sam c</small>").should match_html "<p><small>a <a class='mention' href='/users/sam'>@sam</a> c</small></p>"