Skip to content

Commit

Permalink
Issue adamschwartz#12 Regex changes
Browse files Browse the repository at this point in the history
Confirmed working with Firefox 20 + Firebug & Chrome 26. Couldn't get
it to run properly on Webkit nightly.

Regex isn't escaping the ) parenthesis or the bracket which is why it
wouldn't match.  After thinking about it and submitting a req for an
altered regex I realized that for these functions they don't care
what's in the backreference we just want to style it all.
  • Loading branch information
Marcus Wilson committed May 1, 2013
1 parent 4b1f5fc commit e5cde5e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions log.coffee
Expand Up @@ -20,22 +20,22 @@ makeArray = (arrayLikeThing) ->

formats = [{
# Italic
regex: /\*([^\*\)\(]+)\*/
regex: /\*(.*)\*/
replacer: (m, p1) -> "%c#{p1}%c"
styles: -> ['font-style: italic', '']
}, {
# Bold
regex: /\_([^\_\)\(]+)\_/
regex: /\_(.*)\_/
replacer: (m, p1) -> "%c#{p1}%c"
styles: -> ['font-weight: bold', '']
}, {
# Code
regex: /\`([^\`\)\(]+)\`/
regex: /\`(.*)\`/
replacer: (m, p1) -> "%c#{p1}%c"
styles: -> ['background: rgb(255, 255, 219); padding: 1px 5px; border: 1px solid rgba(0, 0, 0, 0.1)', '']
}, {
# Custom syntax: [c="color: red"]red[c]
regex: /\[c\=\"([^\"\)\(]+)\"\]([^\[\)\(]+)\[c\]/
regex: /\[c\=\"(.*)\"\](.*)\[c\]/
replacer: (m, p1, p2) -> "%c#{p2}%c"
styles: (match) -> [match[1], '']
}]
Expand Down
8 changes: 4 additions & 4 deletions log.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e5cde5e

Please sign in to comment.