mirror of
https://github.com/atom/atom.git
synced 2026-01-23 22:08:08 -05:00
Merge branch 'master' into editor
This commit is contained in:
@@ -44,6 +44,11 @@ describe "Builder", ->
|
||||
builder.tag 'br', id: 'foo'
|
||||
expect(builder.toHtml()).toBe '<br id="foo">'
|
||||
|
||||
describe ".raw(text)", ->
|
||||
it "does not escape html entities", ->
|
||||
builder.raw ' '
|
||||
expect(builder.toHtml()).toBe ' '
|
||||
|
||||
describe ".subview(name, template, attrs)", ->
|
||||
template = null
|
||||
|
||||
|
||||
@@ -66,6 +66,9 @@ class Builder
|
||||
text: (string) ->
|
||||
@document.push(new Text(string))
|
||||
|
||||
raw: (string) ->
|
||||
@document.push(new Text(string, true))
|
||||
|
||||
wireOutlets: (view) ->
|
||||
view.find('[outlet]').each ->
|
||||
elt = $(this)
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
module.exports =
|
||||
class Text
|
||||
constructor: (@string) ->
|
||||
constructor: (@string, @raw=false) ->
|
||||
|
||||
toHtml: ->
|
||||
@string
|
||||
.replace(/&/g, '&')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
if @raw
|
||||
@string
|
||||
else
|
||||
@string
|
||||
.replace(/&/g, '&')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user