mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 18:24:52 -06:00
FIX: Bold, italic should not expect a space boundary
This commit is contained in:
parent
7a65ee3282
commit
24ddb6cfad
@ -7,14 +7,12 @@
|
|||||||
Discourse.Dialect.inlineBetween({
|
Discourse.Dialect.inlineBetween({
|
||||||
between: '***',
|
between: '***',
|
||||||
wordBoundary: true,
|
wordBoundary: true,
|
||||||
spaceBoundary: true,
|
|
||||||
emitter: function(contents) { return ['strong', ['em'].concat(contents)]; }
|
emitter: function(contents) { return ['strong', ['em'].concat(contents)]; }
|
||||||
});
|
});
|
||||||
|
|
||||||
Discourse.Dialect.inlineBetween({
|
Discourse.Dialect.inlineBetween({
|
||||||
between: '___',
|
between: '___',
|
||||||
wordBoundary: true,
|
wordBoundary: true,
|
||||||
spaceBoundary: true,
|
|
||||||
emitter: function(contents) { return ['strong', ['em'].concat(contents)]; }
|
emitter: function(contents) { return ['strong', ['em'].concat(contents)]; }
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -23,7 +21,6 @@ var replaceMarkdown = function(match, tag) {
|
|||||||
Discourse.Dialect.inlineBetween({
|
Discourse.Dialect.inlineBetween({
|
||||||
between: match,
|
between: match,
|
||||||
wordBoundary: true,
|
wordBoundary: true,
|
||||||
spaceBoundary: true,
|
|
||||||
emitter: function(contents) { return [tag].concat(contents) }
|
emitter: function(contents) { return [tag].concat(contents) }
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -254,7 +254,7 @@ Discourse.Dialect = {
|
|||||||
@param {String} [opts.between] A shortcut for when the `start` and `stop` are the same.
|
@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.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.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) {
|
inlineBetween: function(args) {
|
||||||
var start = args.start || args.between,
|
var start = args.start || args.between,
|
||||||
|
@ -242,6 +242,11 @@ describe PrettyText do
|
|||||||
|
|
||||||
|
|
||||||
describe "markdown quirks" do
|
describe "markdown quirks" do
|
||||||
|
it "bolds stuff in parens" do
|
||||||
|
PrettyText.cook("a \"**hello**\"").should match_html "<p>a "<strong>hello</strong>"</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
|
it "allows for newline after bold" do
|
||||||
PrettyText.cook("**hello**\nworld").should match_html "<p><strong>hello</strong><br />world</p>"
|
PrettyText.cook("**hello**\nworld").should match_html "<p><strong>hello</strong><br />world</p>"
|
||||||
end
|
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>"
|
PrettyText.cook("**hello**\n**world**").should match_html "<p><strong>hello</strong><br /><strong>world</strong></p>"
|
||||||
end
|
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
|
pending "does not break a streak for mentions" do
|
||||||
Fabricate(:user, username: 'sam')
|
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>"
|
PrettyText.cook("<small>a @sam c</small>").should match_html "<p><small>a <a class='mention' href='/users/sam'>@sam</a> c</small></p>"
|
||||||
|
Loading…
Reference in New Issue
Block a user