Comparing version 0.1.4 to 0.1.5
@@ -31,2 +31,4 @@ // ----------------------------------------------------------------------- | ||
// [q]inline quote[/q] | ||
// [quote=http://blogs.stonesteps.ca/showpost.asp?pid=33]inline quote[/quote] | ||
// [quote]inline quote[/quote] | ||
// [blockquote=http://blogs.stonesteps.ca/showpost.asp?pid=33]block quote[/blockquote] | ||
@@ -55,3 +57,3 @@ // [blockquote]block quote[/blockquote] | ||
// aceptable BBcode tags, optionally prefixed with a slash | ||
var tagname_re = /^\/?(?:b|i|u|pre|samp|code|colou?r|size|noparse|url|link|s|q|blockquote|img|u?list|li)$/i; | ||
var tagname_re = /^\/?(?:b|i|u|pre|center|samp|code|colou?r|size|noparse|url|link|s|q|(block)?quote|img|u?list|li)$/i; | ||
@@ -136,2 +138,7 @@ // color names or hex color | ||
case "center": | ||
opentags.push(new taginfo_t(m2l, "</center>")); | ||
crlf2br = false; | ||
return "<center>"; | ||
case "color": | ||
@@ -185,5 +192,7 @@ case "colour": | ||
case "q": | ||
case "quote": | ||
case "blockquote": | ||
opentags.push(new taginfo_t(m2l, "</" + m2l + ">")); | ||
return m3 && m3.length && uri_re.test(m3) ? "<" + m2l + " cite=\"" + m3 + "\">" : "<" + m2l + ">"; | ||
var tag = (m2l === "q") ? "q" : "blockquote"; | ||
opentags.push(new taginfo_t(m2l, "</" + tag + ">")); | ||
return m3 && m3.length && uri_re.test(m3) ? "<" + tag + " cite=\"" + m3 + "\">" : "<" + tag + ">"; | ||
@@ -190,0 +199,0 @@ case "list": |
@@ -5,3 +5,3 @@ { | ||
"main": "./lib/bbcode", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"author": "Nick Campbell (http://github.com/ncb000gt)", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -37,2 +37,8 @@ var bbcode = require('../lib/bbcode'); | ||
it('should parse [center] to <center>', function() { | ||
bbcode.parse('[center]Center[/center]', function(parse) { | ||
parse.should.equal('<center>Center</center>'); | ||
}); | ||
}); | ||
it('should parse [color] to <span style="color:<color>"> for all colors', function() { | ||
@@ -137,2 +143,8 @@ var colors = ['black', 'silver', 'gray', 'maroon', 'white', 'red', 'purple', 'fuchsia', 'green', 'lime', 'olive', 'yellow', 'navy', 'blue', 'teal', 'aqua', '#fff', '#ffffff', '#ff34ff']; | ||
it('should parse [quote] as <blockquote>', function() { | ||
bbcode.parse('[quote=person]quoted[/quote]', function(parse) { | ||
parse.should.equal('<blockquote cite="person">quoted</blockquote>'); | ||
}); | ||
}); | ||
it('should try to fix broken markup', function() { | ||
@@ -139,0 +151,0 @@ bbcode.parse('[b]test', function(parse) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18644
442