id stringlengths 34 124 | type stringclasses 4
values | prompt stringlengths 0 4.95k | response stringlengths 21 4.89k | source_lang stringclasses 3
values | target_lang stringclasses 2
values | repo stringclasses 75
values | path stringlengths 10 88 | license stringclasses 1
value | commit stringlengths 40 40 | stars int64 431 18.7k | source_url stringlengths 86 176 | line_start int64 1 214 | line_end int64 3 253 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jianliaoim/talk-os:talk-web/client/updater/user.coffee:1:completion | completion | exports.me = (store, userData) ->
if userData?
store
.set 'user', userData
.set 'prefs', userData.get('preference')
else
store.set 'user', null
# user object: http://talk.ci/doc/restful/user.update.html
exports.update = (store, contactData) ->
_contactId = contactData.get('_id')
store
.upda... | user.merge contactData
else user
.update 'contacts', (cursor) ->
cursor.map (contacts) ->
contacts.map (contact) ->
if contact.get('_id') is _contactId
contactData
else contact
.update 'members', (cursor) ->
cursor.map (innerCursor) ->
innerCursor.map (members) ->
... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/user.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/user.coffee | 1 | 32 |
jianliaoim/talk-os:talk-web/client/module/upload-circle.coffee:1:raw_corpus | raw_corpus | React = require 'react'
assign = require 'object-assign'
{ div, svg, circle } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'upload-cicle'
propTypes:
size: T.number
progress: T.number
strokeWidth: T.number
getDefaultProps: ->
size: 72
progress: 0
strok... | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/upload-circle.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/upload-circle.coffee | 1 | 38 | ||
jianliaoim/talk-os:talk-web/client/module/upload-circle.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
React = require 'react'
assign = require 'object-assign'
{ div, svg, circle } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'upload-cicle'
propTypes:
size: T.number
progress: T.number
strokeWidth: T.number
g... | var React, T, assign, circle, div, svg;
React = require('react');
assign = require('object-assign');
({div, svg, circle} = React.DOM);
T = React.PropTypes;
module.exports = React.createClass({
displayName: 'upload-cicle',
propTypes: {
size: T.number,
progress: T.number,
strokeWidth: T.number
},
... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/module/upload-circle.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/upload-circle.coffee | 1 | 38 |
jianliaoim/talk-os:talk-web/client/module/upload-circle.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var React, T, assign, circle, div, svg;
React = require('react');
assign = require('object-assign');
({div, svg, circle} = React.DOM);
T = React.PropTypes;
module.exports = React.createClass({
displayName: 'upload-cicle',
propTypes: {
size: T.number,
... | React = require 'react'
assign = require 'object-assign'
{ div, svg, circle } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'upload-cicle'
propTypes:
size: T.number
progress: T.number
strokeWidth: T.number
getDefaultProps: ->
size: 72
progress: 0
strok... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/upload-circle.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/upload-circle.coffee | 1 | 38 |
jianliaoim/talk-os:talk-web/client/module/upload-circle.coffee:1:completion | completion | React = require 'react'
assign = require 'object-assign'
{ div, svg, circle } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'upload-cicle'
propTypes:
size: T.number
progress: T.number
strokeWidth: T.number
getDefaultProps: ->
size: 72
progress: 0
strok... | getInitialState: ->
fill: 0
perimeter: Math.ceil (@props.size - 2 * @props.strokeWidth) * Math.PI
componentWillReceiveProps: (nextProps) ->
@setState fill: @state.perimeter * nextProps.progress
render: ->
commonProps =
r: (@props.size / 2) - @props.strokeWidth
cx: (@props.size / 2)
... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/upload-circle.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/upload-circle.coffee | 1 | 38 |
gss/engine:src/document/types/URL.coffee:1:raw_corpus | raw_corpus | Command = require('../../engine/Command')
class URL extends Command
type: 'URL'
constructor: (obj) ->
switch typeof obj
when 'object'
if URL[obj[0]]
return obj
@define
'url': ->
'src': ->
'canvas': ->
module.exports = URL | CoffeeScript | gss/engine | src/document/types/URL.coffee | MIT | be430ea249f8030e11c8e03a8e170dcc8b8cf5fb | 2,854 | https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/document/types/URL.coffee | 1 | 18 | ||
gss/engine:src/document/types/URL.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Command = require('../../engine/Command')
class URL extends Command
type: 'URL'
constructor: (obj) ->
switch typeof obj
when 'object'
if URL[obj[0]]
return obj
@define
'url': ->
'src': ->
'canvas': ->
module.expo... | var Command, URL;
Command = require('../../engine/Command');
URL = (function() {
class URL extends Command {
constructor(obj) {
switch (typeof obj) {
case 'object':
if (URL[obj[0]]) {
return obj;
}
}
}
};
URL.prototype.type = 'URL';
URL.define({
... | CoffeeScript | JavaScript | gss/engine | src/document/types/URL.coffee | MIT | be430ea249f8030e11c8e03a8e170dcc8b8cf5fb | 2,854 | https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/document/types/URL.coffee | 1 | 18 |
gss/engine:src/document/types/URL.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Command, URL;
Command = require('../../engine/Command');
URL = (function() {
class URL extends Command {
constructor(obj) {
switch (typeof obj) {
case 'object':
if (URL[obj[0]]) {
return obj;
}
}
}... | Command = require('../../engine/Command')
class URL extends Command
type: 'URL'
constructor: (obj) ->
switch typeof obj
when 'object'
if URL[obj[0]]
return obj
@define
'url': ->
'src': ->
'canvas': ->
module.exports = URL | JavaScript | CoffeeScript | gss/engine | src/document/types/URL.coffee | MIT | be430ea249f8030e11c8e03a8e170dcc8b8cf5fb | 2,854 | https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/document/types/URL.coffee | 1 | 18 |
gss/engine:src/document/types/URL.coffee:1:completion | completion | Command = require('../../engine/Command')
class URL extends Command
type: 'URL'
constructor: (obj) ->
switch typeof obj
when 'object'
if URL[obj[0]] | return obj
@define
'url': ->
'src': ->
'canvas': ->
module.exports = URL | CoffeeScript | CoffeeScript | gss/engine | src/document/types/URL.coffee | MIT | be430ea249f8030e11c8e03a8e170dcc8b8cf5fb | 2,854 | https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/document/types/URL.coffee | 1 | 18 |
abe33/atom-pigments:lib/renderers/outline.coffee:1:raw_corpus | raw_corpus | RegionRenderer = require './region-renderer'
module.exports =
class OutlineRenderer extends RegionRenderer
render: (colorMarker) ->
range = colorMarker.getScreenRange()
color = colorMarker.color
return {} if range.isEmpty() or not color?
rowSpan = range.end.row - range.start.row
regions = @rende... | CoffeeScript | abe33/atom-pigments | lib/renderers/outline.coffee | MIT | d6118d9596f4973ce0fae7a02e9e44ef02c92650 | 518 | https://github.com/abe33/atom-pigments/blob/d6118d9596f4973ce0fae7a02e9e44ef02c92650/lib/renderers/outline.coffee | 1 | 18 | ||
abe33/atom-pigments:lib/renderers/outline.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
RegionRenderer = require './region-renderer'
module.exports =
class OutlineRenderer extends RegionRenderer
render: (colorMarker) ->
range = colorMarker.getScreenRange()
color = colorMarker.color
return {} if range.isEmpty() or not color?
rowSp... | var OutlineRenderer, RegionRenderer;
RegionRenderer = require('./region-renderer');
module.exports = OutlineRenderer = class OutlineRenderer extends RegionRenderer {
render(colorMarker) {
var color, i, len, range, region, regions, rowSpan;
range = colorMarker.getScreenRange();
color = colorMarker.color;... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/renderers/outline.coffee | MIT | d6118d9596f4973ce0fae7a02e9e44ef02c92650 | 518 | https://github.com/abe33/atom-pigments/blob/d6118d9596f4973ce0fae7a02e9e44ef02c92650/lib/renderers/outline.coffee | 1 | 18 |
abe33/atom-pigments:lib/renderers/outline.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var OutlineRenderer, RegionRenderer;
RegionRenderer = require('./region-renderer');
module.exports = OutlineRenderer = class OutlineRenderer extends RegionRenderer {
render(colorMarker) {
var color, i, len, range, region, regions, rowSpan;
range = color... | RegionRenderer = require './region-renderer'
module.exports =
class OutlineRenderer extends RegionRenderer
render: (colorMarker) ->
range = colorMarker.getScreenRange()
color = colorMarker.color
return {} if range.isEmpty() or not color?
rowSpan = range.end.row - range.start.row
regions = @rende... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/renderers/outline.coffee | MIT | d6118d9596f4973ce0fae7a02e9e44ef02c92650 | 518 | https://github.com/abe33/atom-pigments/blob/d6118d9596f4973ce0fae7a02e9e44ef02c92650/lib/renderers/outline.coffee | 1 | 18 |
abe33/atom-pigments:lib/renderers/outline.coffee:1:completion | completion | RegionRenderer = require './region-renderer'
module.exports =
class OutlineRenderer extends RegionRenderer
render: (colorMarker) ->
range = colorMarker.getScreenRange()
color = colorMarker.color
return {} if range.isEmpty() or not color? | rowSpan = range.end.row - range.start.row
regions = @renderRegions(colorMarker)
@styleRegion(region, color.toCSS()) for region in regions when region?
{regions}
styleRegion: (region, color) ->
region.classList.add('outline')
region.style.borderColor = color | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/renderers/outline.coffee | MIT | d6118d9596f4973ce0fae7a02e9e44ef02c92650 | 518 | https://github.com/abe33/atom-pigments/blob/d6118d9596f4973ce0fae7a02e9e44ef02c92650/lib/renderers/outline.coffee | 1 | 18 |
abe33/atom-pigments:lib/renderers/outline.coffee:1:raw_corpus | raw_corpus | RegionRenderer = require './region-renderer'
module.exports =
class OutlineRenderer extends RegionRenderer
render: (colorMarker) ->
range = colorMarker.getScreenRange()
color = colorMarker.color
return {} if range.isEmpty() or not color?
rowSpan = range.end.row - range.start.row
regions = @rende... | CoffeeScript | abe33/atom-pigments | lib/renderers/outline.coffee | MIT | dce55ab5ded2033385a81ecd0f556ce5aafd3842 | 518 | https://github.com/abe33/atom-pigments/blob/dce55ab5ded2033385a81ecd0f556ce5aafd3842/lib/renderers/outline.coffee | 1 | 18 | ||
abe33/atom-pigments:lib/renderers/outline.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
RegionRenderer = require './region-renderer'
module.exports =
class OutlineRenderer extends RegionRenderer
render: (colorMarker) ->
range = colorMarker.getScreenRange()
color = colorMarker.color
return {} if range.isEmpty() or not color?
rowSp... | var OutlineRenderer, RegionRenderer;
RegionRenderer = require('./region-renderer');
module.exports = OutlineRenderer = class OutlineRenderer extends RegionRenderer {
render(colorMarker) {
var color, i, len, range, region, regions, rowSpan;
range = colorMarker.getScreenRange();
color = colorMarker.color;... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/renderers/outline.coffee | MIT | dce55ab5ded2033385a81ecd0f556ce5aafd3842 | 518 | https://github.com/abe33/atom-pigments/blob/dce55ab5ded2033385a81ecd0f556ce5aafd3842/lib/renderers/outline.coffee | 1 | 18 |
abe33/atom-pigments:lib/renderers/outline.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var OutlineRenderer, RegionRenderer;
RegionRenderer = require('./region-renderer');
module.exports = OutlineRenderer = class OutlineRenderer extends RegionRenderer {
render(colorMarker) {
var color, i, len, range, region, regions, rowSpan;
range = color... | RegionRenderer = require './region-renderer'
module.exports =
class OutlineRenderer extends RegionRenderer
render: (colorMarker) ->
range = colorMarker.getScreenRange()
color = colorMarker.color
return {} if range.isEmpty() or not color?
rowSpan = range.end.row - range.start.row
regions = @rende... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/renderers/outline.coffee | MIT | dce55ab5ded2033385a81ecd0f556ce5aafd3842 | 518 | https://github.com/abe33/atom-pigments/blob/dce55ab5ded2033385a81ecd0f556ce5aafd3842/lib/renderers/outline.coffee | 1 | 18 |
abe33/atom-pigments:lib/renderers/outline.coffee:1:completion | completion | RegionRenderer = require './region-renderer'
module.exports =
class OutlineRenderer extends RegionRenderer
render: (colorMarker) ->
range = colorMarker.getScreenRange()
color = colorMarker.color
return {} if range.isEmpty() or not color? | rowSpan = range.end.row - range.start.row
regions = @renderRegions(colorMarker)
@styleRegion(region, color.toCSS()) for region in regions
{regions}
styleRegion: (region, color) ->
region.classList.add('outline')
region.style.borderColor = color | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/renderers/outline.coffee | MIT | dce55ab5ded2033385a81ecd0f556ce5aafd3842 | 518 | https://github.com/abe33/atom-pigments/blob/dce55ab5ded2033385a81ecd0f556ce5aafd3842/lib/renderers/outline.coffee | 1 | 18 |
abe33/atom-pigments:lib/renderers/outline.coffee:1:raw_corpus | raw_corpus | RegionRenderer = require './region-renderer'
module.exports =
class OutlineRenderer extends RegionRenderer
render: (colorMarker) ->
range = colorMarker.getScreenRange()
return {} if range.isEmpty()
return {} unless colorMarker.color?
color = colorMarker.color.toCSS()
rowSpan = range.end.row - r... | CoffeeScript | abe33/atom-pigments | lib/renderers/outline.coffee | MIT | 65f3d8666d81a5256731c3f62472695f15c6c4bf | 518 | https://github.com/abe33/atom-pigments/blob/65f3d8666d81a5256731c3f62472695f15c6c4bf/lib/renderers/outline.coffee | 1 | 20 | ||
abe33/atom-pigments:lib/renderers/outline.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
RegionRenderer = require './region-renderer'
module.exports =
class OutlineRenderer extends RegionRenderer
render: (colorMarker) ->
range = colorMarker.getScreenRange()
return {} if range.isEmpty()
return {} unless colorMarker.color?
color = c... | var OutlineRenderer, RegionRenderer;
RegionRenderer = require('./region-renderer');
module.exports = OutlineRenderer = class OutlineRenderer extends RegionRenderer {
render(colorMarker) {
var color, i, len, range, region, regions, rowSpan;
range = colorMarker.getScreenRange();
if (range.isEmpty()) {
... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/renderers/outline.coffee | MIT | 65f3d8666d81a5256731c3f62472695f15c6c4bf | 518 | https://github.com/abe33/atom-pigments/blob/65f3d8666d81a5256731c3f62472695f15c6c4bf/lib/renderers/outline.coffee | 1 | 20 |
abe33/atom-pigments:lib/renderers/outline.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var OutlineRenderer, RegionRenderer;
RegionRenderer = require('./region-renderer');
module.exports = OutlineRenderer = class OutlineRenderer extends RegionRenderer {
render(colorMarker) {
var color, i, len, range, region, regions, rowSpan;
range = color... | RegionRenderer = require './region-renderer'
module.exports =
class OutlineRenderer extends RegionRenderer
render: (colorMarker) ->
range = colorMarker.getScreenRange()
return {} if range.isEmpty()
return {} unless colorMarker.color?
color = colorMarker.color.toCSS()
rowSpan = range.end.row - r... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/renderers/outline.coffee | MIT | 65f3d8666d81a5256731c3f62472695f15c6c4bf | 518 | https://github.com/abe33/atom-pigments/blob/65f3d8666d81a5256731c3f62472695f15c6c4bf/lib/renderers/outline.coffee | 1 | 20 |
abe33/atom-pigments:lib/renderers/outline.coffee:1:completion | completion | RegionRenderer = require './region-renderer'
module.exports =
class OutlineRenderer extends RegionRenderer
render: (colorMarker) ->
range = colorMarker.getScreenRange()
return {} if range.isEmpty()
return {} unless colorMarker.color?
color = colorMarker.color.toCSS() | rowSpan = range.end.row - range.start.row
regions = @renderRegions(colorMarker)
@styleRegion(region, color) for region in regions
{regions}
styleRegion: (region, color) ->
region.classList.add('outline')
region.style.borderColor = color | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/renderers/outline.coffee | MIT | 65f3d8666d81a5256731c3f62472695f15c6c4bf | 518 | https://github.com/abe33/atom-pigments/blob/65f3d8666d81a5256731c3f62472695f15c6c4bf/lib/renderers/outline.coffee | 1 | 20 |
abe33/atom-pigments:lib/renderers/outline.coffee:1:raw_corpus | raw_corpus | RegionRenderer = require './region-renderer'
module.exports =
class OutlineRenderer extends RegionRenderer
render: (colorMarker) ->
range = colorMarker.getScreenRange()
return [] if range.isEmpty()
color = colorMarker.color.toCSS()
rowSpan = range.end.row - range.start.row
regions = @renderRegi... | CoffeeScript | abe33/atom-pigments | lib/renderers/outline.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/renderers/outline.coffee | 1 | 19 | ||
abe33/atom-pigments:lib/renderers/outline.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
RegionRenderer = require './region-renderer'
module.exports =
class OutlineRenderer extends RegionRenderer
render: (colorMarker) ->
range = colorMarker.getScreenRange()
return [] if range.isEmpty()
color = colorMarker.color.toCSS()
rowSpan = ... | var OutlineRenderer, RegionRenderer;
RegionRenderer = require('./region-renderer');
module.exports = OutlineRenderer = class OutlineRenderer extends RegionRenderer {
render(colorMarker) {
var color, i, len, range, region, regions, rowSpan;
range = colorMarker.getScreenRange();
if (range.isEmpty()) {
... | CoffeeScript | JavaScript | abe33/atom-pigments | lib/renderers/outline.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/renderers/outline.coffee | 1 | 19 |
abe33/atom-pigments:lib/renderers/outline.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var OutlineRenderer, RegionRenderer;
RegionRenderer = require('./region-renderer');
module.exports = OutlineRenderer = class OutlineRenderer extends RegionRenderer {
render(colorMarker) {
var color, i, len, range, region, regions, rowSpan;
range = color... | RegionRenderer = require './region-renderer'
module.exports =
class OutlineRenderer extends RegionRenderer
render: (colorMarker) ->
range = colorMarker.getScreenRange()
return [] if range.isEmpty()
color = colorMarker.color.toCSS()
rowSpan = range.end.row - range.start.row
regions = @renderRegi... | JavaScript | CoffeeScript | abe33/atom-pigments | lib/renderers/outline.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/renderers/outline.coffee | 1 | 19 |
abe33/atom-pigments:lib/renderers/outline.coffee:1:completion | completion | RegionRenderer = require './region-renderer'
module.exports =
class OutlineRenderer extends RegionRenderer
render: (colorMarker) ->
range = colorMarker.getScreenRange()
return [] if range.isEmpty()
color = colorMarker.color.toCSS() | rowSpan = range.end.row - range.start.row
regions = @renderRegions(colorMarker)
@styleRegion(region, color) for region in regions
{regions}
styleRegion: (region, color) ->
region.classList.add('outline')
region.style.borderColor = color | CoffeeScript | CoffeeScript | abe33/atom-pigments | lib/renderers/outline.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/renderers/outline.coffee | 1 | 19 |
mauricemach/coffeekup:lib/coffeekup.coffee:1:raw_corpus | raw_corpus | skeleton = (ck_options = {}) ->
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.format ?= off
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck_esc(v)}\""
str
ck_doctypes =
'5': '<!DOCTYPE html>'
'xm... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 3237cdac1cbf957861613f92c9597c2b3ba993d6 | 1,245 | https://github.com/mauricemach/coffeekup/blob/3237cdac1cbf957861613f92c9597c2b3ba993d6/lib/coffeekup.coffee | 10 | 59 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
skeleton = (ck_options = {}) ->
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.format ?= off
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck_esc(v)}\""
... | var skeleton;
skeleton = function(ck_options = {}) {
var ck_buffer, ck_doctypes, ck_esc, ck_indent, ck_render_attrs, ck_repeat, ck_self_closing, ck_tabs, comment, doctype, h, text;
if (ck_options.context == null) {
ck_options.context = {};
}
if (ck_options.locals == null) {
ck_options.locals = {};
}
... | CoffeeScript | JavaScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 3237cdac1cbf957861613f92c9597c2b3ba993d6 | 1,245 | https://github.com/mauricemach/coffeekup/blob/3237cdac1cbf957861613f92c9597c2b3ba993d6/lib/coffeekup.coffee | 10 | 59 |
mauricemach/coffeekup:lib/coffeekup.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var skeleton;
skeleton = function(ck_options = {}) {
var ck_buffer, ck_doctypes, ck_esc, ck_indent, ck_render_attrs, ck_repeat, ck_self_closing, ck_tabs, comment, doctype, h, text;
if (ck_options.context == null) {
ck_options.context = {};
}
if (ck_opt... | skeleton = (ck_options = {}) ->
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.format ?= off
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck_esc(v)}\""
str
ck_doctypes =
'5': '<!DOCTYPE html>'
'xm... | JavaScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 3237cdac1cbf957861613f92c9597c2b3ba993d6 | 1,245 | https://github.com/mauricemach/coffeekup/blob/3237cdac1cbf957861613f92c9597c2b3ba993d6/lib/coffeekup.coffee | 10 | 59 |
mauricemach/coffeekup:lib/coffeekup.coffee:1:completion | completion | skeleton = (ck_options = {}) ->
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.format ?= off
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck_esc(v)}\""
str
ck_doctypes =
'5': '<!DOCTYPE html>'
'xm... | ck_self_closing = ['area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input', 'link', 'meta', 'param']
ck_esc = (txt) ->
if ck_options.autoescape then h(txt) else String(txt)
ck_tabs = 0
ck_repeat = (string, count) -> Array(count + 1).join string
ck_indent = -> text ck_repeat(' ', ck_tabs)... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 3237cdac1cbf957861613f92c9597c2b3ba993d6 | 1,245 | https://github.com/mauricemach/coffeekup/blob/3237cdac1cbf957861613f92c9597c2b3ba993d6/lib/coffeekup.coffee | 10 | 59 |
mauricemach/coffeekup:lib/coffeekup.coffee:2:raw_corpus | raw_corpus | tag = -> name = arguments[0]; delete arguments[0]; ck_tag(name, arguments)
ck_tag = (name, opts) ->
ck_indent()
text "<#{name}"
for o in opts
text ck_render_attrs(o) if typeof o is 'object'
if name in ck_self_closing
text ' />'
text '\n' if ck_options.format
else
text '>... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 3237cdac1cbf957861613f92c9597c2b3ba993d6 | 1,245 | https://github.com/mauricemach/coffeekup/blob/3237cdac1cbf957861613f92c9597c2b3ba993d6/lib/coffeekup.coffee | 60 | 109 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:2:completion | completion | tag = -> name = arguments[0]; delete arguments[0]; ck_tag(name, arguments)
ck_tag = (name, opts) ->
ck_indent()
text "<#{name}"
for o in opts
text ck_render_attrs(o) if typeof o is 'object'
if name in ck_self_closing
text ' />'
text '\n' if ck_options.format
else
text '>... | text ck_esc(result)
text '\n' if ck_options.format
ck_tabs--
ck_indent()
text "</#{name}>"
text '\n' if ck_options.format
null
coffeescript = (code) ->
script ";(#{code})();"
null
support = '''
var __slice = Array.prototype.slice;
var __hasProp = Obj... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 3237cdac1cbf957861613f92c9597c2b3ba993d6 | 1,245 | https://github.com/mauricemach/coffeekup/blob/3237cdac1cbf957861613f92c9597c2b3ba993d6/lib/coffeekup.coffee | 60 | 109 |
mauricemach/coffeekup:lib/coffeekup.coffee:3:raw_corpus | raw_corpus | for (var i = 0, l = this.length; i < l; i++) {
if (this[i] === item) return i;
}
return -1;
};
'''
skeleton = String(skeleton).replace(/function\s*\(ck_options\)\s*\{/, '').replace /return null;\s*\}$/, ''
skeleton = support + skeleton
tags = 'a|abbr|acronym|address|applet|area|article|aside|audio|b|b... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 3237cdac1cbf957861613f92c9597c2b3ba993d6 | 1,245 | https://github.com/mauricemach/coffeekup/blob/3237cdac1cbf957861613f92c9597c2b3ba993d6/lib/coffeekup.coffee | 110 | 120 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:3:completion | completion | for (var i = 0, l = this.length; i < l; i++) {
if (this[i] === item) return i;
}
return -1;
}; | '''
skeleton = String(skeleton).replace(/function\s*\(ck_options\)\s*\{/, '').replace /return null;\s*\}$/, ''
skeleton = support + skeleton
tags = 'a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command|datalist|dd... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 3237cdac1cbf957861613f92c9597c2b3ba993d6 | 1,245 | https://github.com/mauricemach/coffeekup/blob/3237cdac1cbf957861613f92c9597c2b3ba993d6/lib/coffeekup.coffee | 110 | 120 |
mauricemach/coffeekup:lib/coffeekup.coffee:4:raw_corpus | raw_corpus | coffeekup.compile = (template, options = {}) ->
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, bare: yes
template = "function(){#{template}}"
tags_here = []
for t in tags
i... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | c1376f1b6bd2ce2826140d5175357d614d8732db | 1,245 | https://github.com/mauricemach/coffeekup/blob/c1376f1b6bd2ce2826140d5175357d614d8732db/lib/coffeekup.coffee | 122 | 150 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
coffeekup.compile = (template, options = {}) ->
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, bare: yes
template = "functio... | var cache;
coffeekup.compile = function(template, options = {}) {
var code, i, j, k, len, len1, ref, t, tags_here, v;
if (options.locals == null) {
options.locals = {};
}
if (typeof template === 'function') {
template = String(template);
} else if (typeof template === 'string' && (typeof coffee !== "... | CoffeeScript | JavaScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | c1376f1b6bd2ce2826140d5175357d614d8732db | 1,245 | https://github.com/mauricemach/coffeekup/blob/c1376f1b6bd2ce2826140d5175357d614d8732db/lib/coffeekup.coffee | 122 | 150 |
mauricemach/coffeekup:lib/coffeekup.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var cache;
coffeekup.compile = function(template, options = {}) {
var code, i, j, k, len, len1, ref, t, tags_here, v;
if (options.locals == null) {
options.locals = {};
}
if (typeof template === 'function') {
template = String(template);
} else i... | coffeekup.compile = (template, options = {}) ->
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, bare: yes
template = "function(){#{template}}"
tags_here = []
for t in tags
i... | JavaScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | c1376f1b6bd2ce2826140d5175357d614d8732db | 1,245 | https://github.com/mauricemach/coffeekup/blob/c1376f1b6bd2ce2826140d5175357d614d8732db/lib/coffeekup.coffee | 122 | 150 |
mauricemach/coffeekup:lib/coffeekup.coffee:4:completion | completion | coffeekup.compile = (template, options = {}) ->
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, bare: yes
template = "function(){#{template}}"
tags_here = []
for t in tags
i... | for t in tags_here
code += "#{t} = function(){return ck_tag('#{t}', arguments)};"
for k, v of options.locals
if typeof v is 'function' then code += "var #{k} = #{v};"
else code += "var #{k} = #{JSON.stringify v};"
code += 'with(ck_options.locals){' if options.dynamic_locals
code += "(#{template}).ca... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | c1376f1b6bd2ce2826140d5175357d614d8732db | 1,245 | https://github.com/mauricemach/coffeekup/blob/c1376f1b6bd2ce2826140d5175357d614d8732db/lib/coffeekup.coffee | 122 | 150 |
mauricemach/coffeekup:lib/coffeekup.coffee:5:raw_corpus | raw_corpus | coffeekup.render = (template, options = {}) ->
options.context ?= {}
options.locals ?= {}
options.cache ?= on
# Shim for express.
if options.locals.body?
options.context.body = options.locals.body
delete options.locals.body
if options.cache and cache[template]? then tpl = cache[template]
else if... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | c1376f1b6bd2ce2826140d5175357d614d8732db | 1,245 | https://github.com/mauricemach/coffeekup/blob/c1376f1b6bd2ce2826140d5175357d614d8732db/lib/coffeekup.coffee | 152 | 170 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
coffeekup.render = (template, options = {}) ->
options.context ?= {}
options.locals ?= {}
options.cache ?= on
# Shim for express.
if options.locals.body?
options.context.body = options.locals.body
delete options.locals.body
if options.cache ... | coffeekup.render = function(template, options = {}) {
var tpl;
if (options.context == null) {
options.context = {};
}
if (options.locals == null) {
options.locals = {};
}
if (options.cache == null) {
options.cache = true;
}
// Shim for express.
if (options.locals.body != null) {
option... | CoffeeScript | JavaScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | c1376f1b6bd2ce2826140d5175357d614d8732db | 1,245 | https://github.com/mauricemach/coffeekup/blob/c1376f1b6bd2ce2826140d5175357d614d8732db/lib/coffeekup.coffee | 152 | 170 |
mauricemach/coffeekup:lib/coffeekup.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
coffeekup.render = function(template, options = {}) {
var tpl;
if (options.context == null) {
options.context = {};
}
if (options.locals == null) {
options.locals = {};
}
if (options.cache == null) {
options.cache = true;
}
// Shim for e... | coffeekup.render = (template, options = {}) ->
options.context ?= {}
options.locals ?= {}
options.cache ?= on
# Shim for express.
if options.locals.body?
options.context.body = options.locals.body
delete options.locals.body
if options.cache and cache[template]? then tpl = cache[template]
else if... | JavaScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | c1376f1b6bd2ce2826140d5175357d614d8732db | 1,245 | https://github.com/mauricemach/coffeekup/blob/c1376f1b6bd2ce2826140d5175357d614d8732db/lib/coffeekup.coffee | 152 | 170 |
mauricemach/coffeekup:lib/coffeekup.coffee:5:completion | completion | coffeekup.render = (template, options = {}) ->
options.context ?= {}
options.locals ?= {}
options.cache ?= on
# Shim for express.
if options.locals.body?
options.context.body = options.locals.body
delete options.locals.body | if options.cache and cache[template]? then tpl = cache[template]
else if options.cache then tpl = cache[template] = coffeekup.compile(template, options)
else tpl = coffeekup.compile(template, options)
tpl(options)
unless window?
coffeekup.adapters =
simple: (template, data) -> coffeekup.render template, co... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | c1376f1b6bd2ce2826140d5175357d614d8732db | 1,245 | https://github.com/mauricemach/coffeekup/blob/c1376f1b6bd2ce2826140d5175357d614d8732db/lib/coffeekup.coffee | 152 | 170 |
mauricemach/coffeekup:lib/coffeekup.coffee:1:raw_corpus | raw_corpus | skeleton = (ck_options = {}) ->
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.format ?= off
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck_esc(v)}\""
str
ck_doctypes =
'5': '<!DOCTYPE html>'
'xm... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 9994747a4bd7768c002bc22572f96dbb0812106f | 1,245 | https://github.com/mauricemach/coffeekup/blob/9994747a4bd7768c002bc22572f96dbb0812106f/lib/coffeekup.coffee | 10 | 59 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
skeleton = (ck_options = {}) ->
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.format ?= off
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck_esc(v)}\""
... | var skeleton;
skeleton = function(ck_options = {}) {
var ck_buffer, ck_doctypes, ck_esc, ck_indent, ck_render_attrs, ck_repeat, ck_self_closing, ck_tabs, comment, doctype, h, text;
if (ck_options.context == null) {
ck_options.context = {};
}
if (ck_options.locals == null) {
ck_options.locals = {};
}
... | CoffeeScript | JavaScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 9994747a4bd7768c002bc22572f96dbb0812106f | 1,245 | https://github.com/mauricemach/coffeekup/blob/9994747a4bd7768c002bc22572f96dbb0812106f/lib/coffeekup.coffee | 10 | 59 |
mauricemach/coffeekup:lib/coffeekup.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var skeleton;
skeleton = function(ck_options = {}) {
var ck_buffer, ck_doctypes, ck_esc, ck_indent, ck_render_attrs, ck_repeat, ck_self_closing, ck_tabs, comment, doctype, h, text;
if (ck_options.context == null) {
ck_options.context = {};
}
if (ck_opt... | skeleton = (ck_options = {}) ->
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.format ?= off
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck_esc(v)}\""
str
ck_doctypes =
'5': '<!DOCTYPE html>'
'xm... | JavaScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 9994747a4bd7768c002bc22572f96dbb0812106f | 1,245 | https://github.com/mauricemach/coffeekup/blob/9994747a4bd7768c002bc22572f96dbb0812106f/lib/coffeekup.coffee | 10 | 59 |
mauricemach/coffeekup:lib/coffeekup.coffee:1:completion | completion | skeleton = (ck_options = {}) ->
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.format ?= off
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck_esc(v)}\""
str
ck_doctypes =
'5': '<!DOCTYPE html>'
'xm... | ck_self_closing = ['area', 'base', 'basefont', 'br', 'hr', 'img', 'input', 'link', 'meta']
ck_esc = (txt) ->
if ck_options.autoescape then h(txt) else String(txt)
ck_tabs = 0
ck_repeat = (string, count) -> Array(count + 1).join string
ck_indent = -> text ck_repeat(' ', ck_tabs) if ck_options.format
... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 9994747a4bd7768c002bc22572f96dbb0812106f | 1,245 | https://github.com/mauricemach/coffeekup/blob/9994747a4bd7768c002bc22572f96dbb0812106f/lib/coffeekup.coffee | 10 | 59 |
mauricemach/coffeekup:lib/coffeekup.coffee:1:raw_corpus | raw_corpus | skeleton = (ck_options) ->
ck_options ?= {}
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.format ?= off
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck_esc(v)}\""
str
ck_doctypes =
'5': '<!DOCTYPE ... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | db1055a03f0189493cc4df461d0cbb0752a2e161 | 1,245 | https://github.com/mauricemach/coffeekup/blob/db1055a03f0189493cc4df461d0cbb0752a2e161/lib/coffeekup.coffee | 10 | 59 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
skeleton = (ck_options) ->
ck_options ?= {}
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.format ?= off
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck... | var skeleton;
skeleton = function(ck_options) {
var ck_buffer, ck_doctypes, ck_esc, ck_indent, ck_render_attrs, ck_repeat, ck_self_closing, ck_tabs, comment, doctype, h, text;
if (ck_options == null) {
ck_options = {};
}
if (ck_options.context == null) {
ck_options.context = {};
}
if (ck_options.lo... | CoffeeScript | JavaScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | db1055a03f0189493cc4df461d0cbb0752a2e161 | 1,245 | https://github.com/mauricemach/coffeekup/blob/db1055a03f0189493cc4df461d0cbb0752a2e161/lib/coffeekup.coffee | 10 | 59 |
mauricemach/coffeekup:lib/coffeekup.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var skeleton;
skeleton = function(ck_options) {
var ck_buffer, ck_doctypes, ck_esc, ck_indent, ck_render_attrs, ck_repeat, ck_self_closing, ck_tabs, comment, doctype, h, text;
if (ck_options == null) {
ck_options = {};
}
if (ck_options.context == null)... | skeleton = (ck_options) ->
ck_options ?= {}
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.format ?= off
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck_esc(v)}\""
str
ck_doctypes =
'5': '<!DOCTYPE ... | JavaScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | db1055a03f0189493cc4df461d0cbb0752a2e161 | 1,245 | https://github.com/mauricemach/coffeekup/blob/db1055a03f0189493cc4df461d0cbb0752a2e161/lib/coffeekup.coffee | 10 | 59 |
mauricemach/coffeekup:lib/coffeekup.coffee:1:completion | completion | skeleton = (ck_options) ->
ck_options ?= {}
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.format ?= off
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck_esc(v)}\""
str
ck_doctypes =
'5': '<!DOCTYPE ... | ck_self_closing = ['area', 'base', 'basefont', 'br', 'hr', 'img', 'input', 'link', 'meta']
ck_esc = (txt) ->
if ck_options.autoescape then h(txt) else String(txt)
ck_tabs = 0
ck_repeat = (string, count) -> Array(count + 1).join string
ck_indent = -> text ck_repeat(' ', ck_tabs) if ck_options.format
... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | db1055a03f0189493cc4df461d0cbb0752a2e161 | 1,245 | https://github.com/mauricemach/coffeekup/blob/db1055a03f0189493cc4df461d0cbb0752a2e161/lib/coffeekup.coffee | 10 | 59 |
mauricemach/coffeekup:lib/coffeekup.coffee:2:raw_corpus | raw_corpus | text '\n' if ck_options.format
tag = -> name = arguments[0]; delete arguments[0]; ck_tag(name, arguments)
ck_tag = (name, opts) ->
ck_indent()
text "<#{name}"
for o in opts
text ck_render_attrs(o) if typeof o is 'object'
if name in ck_self_closing
text ' />'
text '\n' if ck_opt... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | db1055a03f0189493cc4df461d0cbb0752a2e161 | 1,245 | https://github.com/mauricemach/coffeekup/blob/db1055a03f0189493cc4df461d0cbb0752a2e161/lib/coffeekup.coffee | 60 | 109 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:2:completion | completion | text '\n' if ck_options.format
tag = -> name = arguments[0]; delete arguments[0]; ck_tag(name, arguments)
ck_tag = (name, opts) ->
ck_indent()
text "<#{name}"
for o in opts
text ck_render_attrs(o) if typeof o is 'object'
if name in ck_self_closing
text ' />'
text '\n' if ck_opt... | if typeof result is 'string'
ck_indent()
text ck_esc(result)
text '\n' if ck_options.format
ck_tabs--
ck_indent()
text "</#{name}>"
text '\n' if ck_options.format
null
coffeescript = (code) ->
script ";(#{code})();"
null
suppo... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | db1055a03f0189493cc4df461d0cbb0752a2e161 | 1,245 | https://github.com/mauricemach/coffeekup/blob/db1055a03f0189493cc4df461d0cbb0752a2e161/lib/coffeekup.coffee | 60 | 109 |
mauricemach/coffeekup:lib/coffeekup.coffee:3:raw_corpus | raw_corpus | };
var __indexOf = Array.prototype.indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
if (this[i] === item) return i;
}
return -1;
};
'''
skeleton = String(skeleton).replace(/function\s*\(ck_options\)\s*\{/, '').replace /return null;\s*\}$/, ''
skeleton = support + skeleto... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | db1055a03f0189493cc4df461d0cbb0752a2e161 | 1,245 | https://github.com/mauricemach/coffeekup/blob/db1055a03f0189493cc4df461d0cbb0752a2e161/lib/coffeekup.coffee | 110 | 122 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:3:completion | completion | };
var __indexOf = Array.prototype.indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
if (this[i] === item) return i;
}
return -1; | };
'''
skeleton = String(skeleton).replace(/function\s*\(ck_options\)\s*\{/, '').replace /return null;\s*\}$/, ''
skeleton = support + skeleton
tags = 'a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command|datalist... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | db1055a03f0189493cc4df461d0cbb0752a2e161 | 1,245 | https://github.com/mauricemach/coffeekup/blob/db1055a03f0189493cc4df461d0cbb0752a2e161/lib/coffeekup.coffee | 110 | 122 |
mauricemach/coffeekup:lib/coffeekup.coffee:4:raw_corpus | raw_corpus | coffeekup.compile = (template, options) ->
options ?= {}
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, bare: yes
template = "function(){#{template}}"
tags_here = []
for t in... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | db1055a03f0189493cc4df461d0cbb0752a2e161 | 1,245 | https://github.com/mauricemach/coffeekup/blob/db1055a03f0189493cc4df461d0cbb0752a2e161/lib/coffeekup.coffee | 124 | 153 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
coffeekup.compile = (template, options) ->
options ?= {}
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, bare: yes
template... | var cache;
coffeekup.compile = function(template, options) {
var code, i, j, k, len, len1, ref, t, tags_here, v;
if (options == null) {
options = {};
}
if (options.locals == null) {
options.locals = {};
}
if (typeof template === 'function') {
template = String(template);
} else if (typeof tem... | CoffeeScript | JavaScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | db1055a03f0189493cc4df461d0cbb0752a2e161 | 1,245 | https://github.com/mauricemach/coffeekup/blob/db1055a03f0189493cc4df461d0cbb0752a2e161/lib/coffeekup.coffee | 124 | 153 |
mauricemach/coffeekup:lib/coffeekup.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var cache;
coffeekup.compile = function(template, options) {
var code, i, j, k, len, len1, ref, t, tags_here, v;
if (options == null) {
options = {};
}
if (options.locals == null) {
options.locals = {};
}
if (typeof template === 'function') {
... | coffeekup.compile = (template, options) ->
options ?= {}
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, bare: yes
template = "function(){#{template}}"
tags_here = []
for t in... | JavaScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | db1055a03f0189493cc4df461d0cbb0752a2e161 | 1,245 | https://github.com/mauricemach/coffeekup/blob/db1055a03f0189493cc4df461d0cbb0752a2e161/lib/coffeekup.coffee | 124 | 153 |
mauricemach/coffeekup:lib/coffeekup.coffee:4:completion | completion | coffeekup.compile = (template, options) ->
options ?= {}
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, bare: yes
template = "function(){#{template}}"
tags_here = []
for t in... | for t in tags_here
code += "#{t} = function(){return ck_tag('#{t}', arguments)};"
for k, v of options.locals
if typeof v is 'function' then code += "var #{k} = #{v};"
else code += "var #{k} = #{JSON.stringify v};"
code += 'with(ck_options.locals){' if options.dynamic_locals
code += "(#{template}).ca... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | db1055a03f0189493cc4df461d0cbb0752a2e161 | 1,245 | https://github.com/mauricemach/coffeekup/blob/db1055a03f0189493cc4df461d0cbb0752a2e161/lib/coffeekup.coffee | 124 | 153 |
mauricemach/coffeekup:lib/coffeekup.coffee:5:raw_corpus | raw_corpus | coffeekup.render = (template, options) ->
options ?= {}
options.context ?= {}
options.locals ?= {}
options.cache ?= on
# Shim for express.
if options.locals.body?
options.context.body = options.locals.body
delete options.locals.body
if options.cache and cache[template]? then tpl = cache[template... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | db1055a03f0189493cc4df461d0cbb0752a2e161 | 1,245 | https://github.com/mauricemach/coffeekup/blob/db1055a03f0189493cc4df461d0cbb0752a2e161/lib/coffeekup.coffee | 155 | 174 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
coffeekup.render = (template, options) ->
options ?= {}
options.context ?= {}
options.locals ?= {}
options.cache ?= on
# Shim for express.
if options.locals.body?
options.context.body = options.locals.body
delete options.locals.body
if opt... | coffeekup.render = function(template, options) {
var tpl;
if (options == null) {
options = {};
}
if (options.context == null) {
options.context = {};
}
if (options.locals == null) {
options.locals = {};
}
if (options.cache == null) {
options.cache = true;
}
// Shim for express.
if ... | CoffeeScript | JavaScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | db1055a03f0189493cc4df461d0cbb0752a2e161 | 1,245 | https://github.com/mauricemach/coffeekup/blob/db1055a03f0189493cc4df461d0cbb0752a2e161/lib/coffeekup.coffee | 155 | 174 |
mauricemach/coffeekup:lib/coffeekup.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
coffeekup.render = function(template, options) {
var tpl;
if (options == null) {
options = {};
}
if (options.context == null) {
options.context = {};
}
if (options.locals == null) {
options.locals = {};
}
if (options.cache == null) {
... | coffeekup.render = (template, options) ->
options ?= {}
options.context ?= {}
options.locals ?= {}
options.cache ?= on
# Shim for express.
if options.locals.body?
options.context.body = options.locals.body
delete options.locals.body
if options.cache and cache[template]? then tpl = cache[template... | JavaScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | db1055a03f0189493cc4df461d0cbb0752a2e161 | 1,245 | https://github.com/mauricemach/coffeekup/blob/db1055a03f0189493cc4df461d0cbb0752a2e161/lib/coffeekup.coffee | 155 | 174 |
mauricemach/coffeekup:lib/coffeekup.coffee:5:completion | completion | coffeekup.render = (template, options) ->
options ?= {}
options.context ?= {}
options.locals ?= {}
options.cache ?= on
# Shim for express.
if options.locals.body?
options.context.body = options.locals.body
delete options.locals.body | if options.cache and cache[template]? then tpl = cache[template]
else if options.cache then tpl = cache[template] = coffeekup.compile(template, options)
else tpl = coffeekup.compile(template, options)
tpl(options)
unless window?
coffeekup.adapters =
simple: (template, data) -> coffeekup.render template, co... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | db1055a03f0189493cc4df461d0cbb0752a2e161 | 1,245 | https://github.com/mauricemach/coffeekup/blob/db1055a03f0189493cc4df461d0cbb0752a2e161/lib/coffeekup.coffee | 155 | 174 |
mauricemach/coffeekup:lib/coffeekup.coffee:1:raw_corpus | raw_corpus | skeleton = (ck_options) ->
ck_options ?= {}
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.format ?= off
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck_esc(v)}\""
str
ck_doctypes =
'5': '<!DOCTYPE ... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | b260befd8f617463f263364134328ebd6ff72b20 | 1,245 | https://github.com/mauricemach/coffeekup/blob/b260befd8f617463f263364134328ebd6ff72b20/lib/coffeekup.coffee | 10 | 59 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
skeleton = (ck_options) ->
ck_options ?= {}
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.format ?= off
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck... | var skeleton;
skeleton = function(ck_options) {
var ck_buffer, ck_doctypes, ck_esc, ck_indent, ck_render_attrs, ck_repeat, ck_self_closing, ck_tabs, comment, doctype, h, text;
if (ck_options == null) {
ck_options = {};
}
if (ck_options.context == null) {
ck_options.context = {};
}
if (ck_options.lo... | CoffeeScript | JavaScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | b260befd8f617463f263364134328ebd6ff72b20 | 1,245 | https://github.com/mauricemach/coffeekup/blob/b260befd8f617463f263364134328ebd6ff72b20/lib/coffeekup.coffee | 10 | 59 |
mauricemach/coffeekup:lib/coffeekup.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var skeleton;
skeleton = function(ck_options) {
var ck_buffer, ck_doctypes, ck_esc, ck_indent, ck_render_attrs, ck_repeat, ck_self_closing, ck_tabs, comment, doctype, h, text;
if (ck_options == null) {
ck_options = {};
}
if (ck_options.context == null)... | skeleton = (ck_options) ->
ck_options ?= {}
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.format ?= off
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck_esc(v)}\""
str
ck_doctypes =
'5': '<!DOCTYPE ... | JavaScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | b260befd8f617463f263364134328ebd6ff72b20 | 1,245 | https://github.com/mauricemach/coffeekup/blob/b260befd8f617463f263364134328ebd6ff72b20/lib/coffeekup.coffee | 10 | 59 |
mauricemach/coffeekup:lib/coffeekup.coffee:1:completion | completion | skeleton = (ck_options) ->
ck_options ?= {}
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.format ?= off
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck_esc(v)}\""
str
ck_doctypes =
'5': '<!DOCTYPE ... | ck_self_closing = ['area', 'base', 'basefont', 'br', 'hr', 'img', 'input', 'link', 'meta']
ck_esc = (txt) ->
if ck_options.autoescape then h(txt) else String(txt)
ck_tabs = 0
ck_repeat = (string, count) -> Array(count + 1).join string
ck_indent = -> text ck_repeat(' ', ck_tabs) if ck_options.format
... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | b260befd8f617463f263364134328ebd6ff72b20 | 1,245 | https://github.com/mauricemach/coffeekup/blob/b260befd8f617463f263364134328ebd6ff72b20/lib/coffeekup.coffee | 10 | 59 |
mauricemach/coffeekup:lib/coffeekup.coffee:2:raw_corpus | raw_corpus | text '\n' if ck_options.format
tag = -> name = arguments[0]; delete arguments[0]; ck_tag(name, arguments)
ck_tag = (name, opts) ->
ck_indent()
text "<#{name}"
for o in opts
text ck_render_attrs(o) if typeof o is 'object'
if name in ck_self_closing
text ' />'
text '\n' if ck_opt... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | c514d9b26bdc6e44709f624df00aff2275e60882 | 1,245 | https://github.com/mauricemach/coffeekup/blob/c514d9b26bdc6e44709f624df00aff2275e60882/lib/coffeekup.coffee | 60 | 109 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:2:completion | completion | text '\n' if ck_options.format
tag = -> name = arguments[0]; delete arguments[0]; ck_tag(name, arguments)
ck_tag = (name, opts) ->
ck_indent()
text "<#{name}"
for o in opts
text ck_render_attrs(o) if typeof o is 'object'
if name in ck_self_closing
text ' />'
text '\n' if ck_opt... | if typeof result is 'string'
ck_indent()
text ck_esc(result)
text '\n' if ck_options.format
ck_tabs--
ck_indent()
text "</#{name}>"
text '\n' if ck_options.format
null
coffeescript = (code) ->
script ";(#{code})();"
null
suppo... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | c514d9b26bdc6e44709f624df00aff2275e60882 | 1,245 | https://github.com/mauricemach/coffeekup/blob/c514d9b26bdc6e44709f624df00aff2275e60882/lib/coffeekup.coffee | 60 | 109 |
mauricemach/coffeekup:lib/coffeekup.coffee:3:raw_corpus | raw_corpus | ctor.prototype = parent.prototype; child.prototype = new ctor;
child.__super__ = parent.prototype; return child;
};
'''
skeleton = String(skeleton).replace(/function\s*\(ck_options\)\s*\{/, '').replace /return null;\s*\}$/, ''
skeleton = support + skeleton
tags = 'a|abbr|acronym|address|applet|area|article|asid... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | c514d9b26bdc6e44709f624df00aff2275e60882 | 1,245 | https://github.com/mauricemach/coffeekup/blob/c514d9b26bdc6e44709f624df00aff2275e60882/lib/coffeekup.coffee | 110 | 118 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:3:completion | completion | ctor.prototype = parent.prototype; child.prototype = new ctor;
child.__super__ = parent.prototype; return child;
};
''' | skeleton = String(skeleton).replace(/function\s*\(ck_options\)\s*\{/, '').replace /return null;\s*\}$/, ''
skeleton = support + skeleton
tags = 'a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command|datalist|dd|del|... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | c514d9b26bdc6e44709f624df00aff2275e60882 | 1,245 | https://github.com/mauricemach/coffeekup/blob/c514d9b26bdc6e44709f624df00aff2275e60882/lib/coffeekup.coffee | 110 | 118 |
mauricemach/coffeekup:lib/coffeekup.coffee:4:raw_corpus | raw_corpus | coffeekup.compile = (template, options) ->
options ?= {}
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, {'bare'}
template = "function(){#{template}}"
tags_here = []
for t in ... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 1f7100c9005a1549e23693a99e5a60551c93464d | 1,245 | https://github.com/mauricemach/coffeekup/blob/1f7100c9005a1549e23693a99e5a60551c93464d/lib/coffeekup.coffee | 120 | 150 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
coffeekup.compile = (template, options) ->
options ?= {}
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, {'bare'}
template ... | var cache;
coffeekup.compile = function(template, options) {
var code, i, j, k, len, len1, ref, t, tags_here, v;
if (options == null) {
options = {};
}
if (options.locals == null) {
options.locals = {};
}
if (typeof template === 'function') {
template = String(template);
} else if (typeof tem... | CoffeeScript | JavaScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 1f7100c9005a1549e23693a99e5a60551c93464d | 1,245 | https://github.com/mauricemach/coffeekup/blob/1f7100c9005a1549e23693a99e5a60551c93464d/lib/coffeekup.coffee | 120 | 150 |
mauricemach/coffeekup:lib/coffeekup.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var cache;
coffeekup.compile = function(template, options) {
var code, i, j, k, len, len1, ref, t, tags_here, v;
if (options == null) {
options = {};
}
if (options.locals == null) {
options.locals = {};
}
if (typeof template === 'function') {
... | coffeekup.compile = (template, options) ->
options ?= {}
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, {'bare'}
template = "function(){#{template}}"
tags_here = []
for t in ... | JavaScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 1f7100c9005a1549e23693a99e5a60551c93464d | 1,245 | https://github.com/mauricemach/coffeekup/blob/1f7100c9005a1549e23693a99e5a60551c93464d/lib/coffeekup.coffee | 120 | 150 |
mauricemach/coffeekup:lib/coffeekup.coffee:4:completion | completion | coffeekup.compile = (template, options) ->
options ?= {}
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, {'bare'}
template = "function(){#{template}}"
tags_here = []
for t in ... | code += 'var arrayCreator = Array;'
for t in tags_here
code += "#{t} = function(){return ck_tag('#{t}', arguments)};"
for k, v of options.locals
if typeof v is 'function' then code += "var #{k} = #{v};"
else code += "var #{k} = #{JSON.stringify v};"
code += 'with(ck_options.locals){' if options.dyna... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 1f7100c9005a1549e23693a99e5a60551c93464d | 1,245 | https://github.com/mauricemach/coffeekup/blob/1f7100c9005a1549e23693a99e5a60551c93464d/lib/coffeekup.coffee | 120 | 150 |
mauricemach/coffeekup:lib/coffeekup.coffee:2:raw_corpus | raw_corpus | text '\n' if ck_options.format
tag = -> name = arguments[0]; delete arguments[0]; ck_tag(name, arguments)
ck_tag = (name, opts) ->
ck_indent()
text "<#{name}"
for o in opts
text ck_render_attrs(o) if typeof o is 'object'
if name in ck_self_closing
text ' />'
text '\n' if ck_opt... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | f237cd150f7d04f76b015223cf56ee84c9f866b6 | 1,245 | https://github.com/mauricemach/coffeekup/blob/f237cd150f7d04f76b015223cf56ee84c9f866b6/lib/coffeekup.coffee | 60 | 109 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:2:completion | completion | text '\n' if ck_options.format
tag = -> name = arguments[0]; delete arguments[0]; ck_tag(name, arguments)
ck_tag = (name, opts) ->
ck_indent()
text "<#{name}"
for o in opts
text ck_render_attrs(o) if typeof o is 'object'
if name in ck_self_closing
text ' />'
text '\n' if ck_opt... | result = o.call ck_options.context
if typeof result is 'string'
ck_indent()
text ck_esc(result)
text '\n' if ck_options.format
ck_tabs--
ck_indent()
text "</#{name}>"
text '\n' if ck_options.format
null
coffeescript = (cod... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | f237cd150f7d04f76b015223cf56ee84c9f866b6 | 1,245 | https://github.com/mauricemach/coffeekup/blob/f237cd150f7d04f76b015223cf56ee84c9f866b6/lib/coffeekup.coffee | 60 | 109 |
mauricemach/coffeekup:lib/coffeekup.coffee:4:raw_corpus | raw_corpus | coffeekup.compile = (template, options) ->
options ?= {}
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, {'noWrap'}
template = "function(){#{template}}"
tags_here = []
for t i... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | f237cd150f7d04f76b015223cf56ee84c9f866b6 | 1,245 | https://github.com/mauricemach/coffeekup/blob/f237cd150f7d04f76b015223cf56ee84c9f866b6/lib/coffeekup.coffee | 112 | 142 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
coffeekup.compile = (template, options) ->
options ?= {}
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, {'noWrap'}
templat... | var cache;
coffeekup.compile = function(template, options) {
var code, i, j, k, len, len1, ref, t, tags_here, v;
if (options == null) {
options = {};
}
if (options.locals == null) {
options.locals = {};
}
if (typeof template === 'function') {
template = String(template);
} else if (typeof tem... | CoffeeScript | JavaScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | f237cd150f7d04f76b015223cf56ee84c9f866b6 | 1,245 | https://github.com/mauricemach/coffeekup/blob/f237cd150f7d04f76b015223cf56ee84c9f866b6/lib/coffeekup.coffee | 112 | 142 |
mauricemach/coffeekup:lib/coffeekup.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var cache;
coffeekup.compile = function(template, options) {
var code, i, j, k, len, len1, ref, t, tags_here, v;
if (options == null) {
options = {};
}
if (options.locals == null) {
options.locals = {};
}
if (typeof template === 'function') {
... | coffeekup.compile = (template, options) ->
options ?= {}
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, {'noWrap'}
template = "function(){#{template}}"
tags_here = []
for t i... | JavaScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | f237cd150f7d04f76b015223cf56ee84c9f866b6 | 1,245 | https://github.com/mauricemach/coffeekup/blob/f237cd150f7d04f76b015223cf56ee84c9f866b6/lib/coffeekup.coffee | 112 | 142 |
mauricemach/coffeekup:lib/coffeekup.coffee:4:completion | completion | coffeekup.compile = (template, options) ->
options ?= {}
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, {'noWrap'}
template = "function(){#{template}}"
tags_here = []
for t i... | code += 'var arrayCreator = Array;'
for t in tags_here
code += "#{t} = function(){return ck_tag('#{t}', arguments)};"
for k, v of options.locals
if typeof v is 'function' then code += "var #{k} = #{v};"
else code += "var #{k} = #{JSON.stringify v};"
code += 'with(ck_options.locals){' if options.dyna... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | f237cd150f7d04f76b015223cf56ee84c9f866b6 | 1,245 | https://github.com/mauricemach/coffeekup/blob/f237cd150f7d04f76b015223cf56ee84c9f866b6/lib/coffeekup.coffee | 112 | 142 |
mauricemach/coffeekup:lib/coffeekup.coffee:2:raw_corpus | raw_corpus | text '\n' if ck_options.format
tag = -> name = arguments[0]; delete arguments[0]; ck_tag(name, arguments)
ck_tag = (name, opts) ->
ck_indent()
text "<#{name}"
for o in opts
text ck_render_attrs(o) if typeof o is 'object'
if name in ck_self_closing
text ' />'
text '\n' if ck_opt... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 9ece2ae49328fe1e8faebffd8ddf08ca067ded3d | 1,245 | https://github.com/mauricemach/coffeekup/blob/9ece2ae49328fe1e8faebffd8ddf08ca067ded3d/lib/coffeekup.coffee | 60 | 109 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:2:completion | completion | text '\n' if ck_options.format
tag = -> name = arguments[0]; delete arguments[0]; ck_tag(name, arguments)
ck_tag = (name, opts) ->
ck_indent()
text "<#{name}"
for o in opts
text ck_render_attrs(o) if typeof o is 'object'
if name in ck_self_closing
text ' />'
text '\n' if ck_opt... | result = o.call ck_options.context
if typeof result is 'string'
ck_indent()
text ck_esc(result)
text '\n' if ck_options.format
ck_tabs--
ck_indent()
text "</#{name}>"
text '\n' if ck_options.format
null
coffeescript = (cod... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 9ece2ae49328fe1e8faebffd8ddf08ca067ded3d | 1,245 | https://github.com/mauricemach/coffeekup/blob/9ece2ae49328fe1e8faebffd8ddf08ca067ded3d/lib/coffeekup.coffee | 60 | 109 |
mauricemach/coffeekup:lib/coffeekup.coffee:2:raw_corpus | raw_corpus | text '\n' if ck_options.format
tag = (name, opts) ->
ck_indent()
text "<#{name}"
for o in opts
text ck_render_attrs(o) if typeof o is 'object'
if name in ck_self_closing
text ' />'
text '\n' if ck_options.format
else
text '>'
for o in opts
switch typeof o
... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | d74e4814221d6f4be6fc85c98584e7c0c754ee85 | 1,245 | https://github.com/mauricemach/coffeekup/blob/d74e4814221d6f4be6fc85c98584e7c0c754ee85/lib/coffeekup.coffee | 60 | 108 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:2:completion | completion | text '\n' if ck_options.format
tag = (name, opts) ->
ck_indent()
text "<#{name}"
for o in opts
text ck_render_attrs(o) if typeof o is 'object'
if name in ck_self_closing
text ' />'
text '\n' if ck_options.format
else
text '>'
for o in opts
switch typeof o
... | ck_indent()
text ck_esc(result)
text '\n' if ck_options.format
ck_tabs--
ck_indent()
text "</#{name}>"
text '\n' if ck_options.format
null
coffeescript = (code) ->
script ";(#{code})();"
null
support = '''
var __slice = Array.prototype.sl... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | d74e4814221d6f4be6fc85c98584e7c0c754ee85 | 1,245 | https://github.com/mauricemach/coffeekup/blob/d74e4814221d6f4be6fc85c98584e7c0c754ee85/lib/coffeekup.coffee | 60 | 108 |
mauricemach/coffeekup:lib/coffeekup.coffee:3:raw_corpus | raw_corpus | coffeekup.compile = (template, options) ->
options ?= {}
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, {'noWrap'}
template = "function(){#{template}}"
tags_here = []
for t i... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | d74e4814221d6f4be6fc85c98584e7c0c754ee85 | 1,245 | https://github.com/mauricemach/coffeekup/blob/d74e4814221d6f4be6fc85c98584e7c0c754ee85/lib/coffeekup.coffee | 110 | 139 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
coffeekup.compile = (template, options) ->
options ?= {}
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, {'noWrap'}
templat... | var cache;
coffeekup.compile = function(template, options) {
var code, i, j, k, len, len1, ref, t, tags_here, v;
if (options == null) {
options = {};
}
if (options.locals == null) {
options.locals = {};
}
if (typeof template === 'function') {
template = String(template);
} else if (typeof tem... | CoffeeScript | JavaScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | d74e4814221d6f4be6fc85c98584e7c0c754ee85 | 1,245 | https://github.com/mauricemach/coffeekup/blob/d74e4814221d6f4be6fc85c98584e7c0c754ee85/lib/coffeekup.coffee | 110 | 139 |
mauricemach/coffeekup:lib/coffeekup.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var cache;
coffeekup.compile = function(template, options) {
var code, i, j, k, len, len1, ref, t, tags_here, v;
if (options == null) {
options = {};
}
if (options.locals == null) {
options.locals = {};
}
if (typeof template === 'function') {
... | coffeekup.compile = (template, options) ->
options ?= {}
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, {'noWrap'}
template = "function(){#{template}}"
tags_here = []
for t i... | JavaScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | d74e4814221d6f4be6fc85c98584e7c0c754ee85 | 1,245 | https://github.com/mauricemach/coffeekup/blob/d74e4814221d6f4be6fc85c98584e7c0c754ee85/lib/coffeekup.coffee | 110 | 139 |
mauricemach/coffeekup:lib/coffeekup.coffee:3:completion | completion | coffeekup.compile = (template, options) ->
options ?= {}
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, {'noWrap'}
template = "function(){#{template}}"
tags_here = []
for t i... | for t in tags_here
code += "#{t} = function(){return tag('#{t}', arguments)};"
for k, v of options.locals
if typeof v is 'function' then code += "var #{k} = #{v};"
else code += "var #{k} = #{JSON.stringify v};"
code += 'with(ck_options.locals){' if options.dynamic_locals
code += "(#{template}).call(... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | d74e4814221d6f4be6fc85c98584e7c0c754ee85 | 1,245 | https://github.com/mauricemach/coffeekup/blob/d74e4814221d6f4be6fc85c98584e7c0c754ee85/lib/coffeekup.coffee | 110 | 139 |
mauricemach/coffeekup:lib/coffeekup.coffee:1:raw_corpus | raw_corpus | skeleton = (ck_options) ->
ck_options ?= {}
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck_esc(v)}\""
str
ck_doctypes =
'5': '<!DOCTYPE html>'
'xml': '<?xml ve... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | e33f8581362a40c67a351c76ad3ab8a9767ef44b | 1,245 | https://github.com/mauricemach/coffeekup/blob/e33f8581362a40c67a351c76ad3ab8a9767ef44b/lib/coffeekup.coffee | 10 | 59 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
skeleton = (ck_options) ->
ck_options ?= {}
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck_esc(v)}\""
str
ck_d... | var skeleton;
skeleton = function(ck_options) {
var ck_buffer, ck_doctypes, ck_esc, ck_render_attrs, ck_self_closing, comment, doctype, h, tag, text;
if (ck_options == null) {
ck_options = {};
}
if (ck_options.context == null) {
ck_options.context = {};
}
if (ck_options.locals == null) {
ck_opt... | CoffeeScript | JavaScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | e33f8581362a40c67a351c76ad3ab8a9767ef44b | 1,245 | https://github.com/mauricemach/coffeekup/blob/e33f8581362a40c67a351c76ad3ab8a9767ef44b/lib/coffeekup.coffee | 10 | 59 |
mauricemach/coffeekup:lib/coffeekup.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var skeleton;
skeleton = function(ck_options) {
var ck_buffer, ck_doctypes, ck_esc, ck_render_attrs, ck_self_closing, comment, doctype, h, tag, text;
if (ck_options == null) {
ck_options = {};
}
if (ck_options.context == null) {
ck_options.context ... | skeleton = (ck_options) ->
ck_options ?= {}
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck_esc(v)}\""
str
ck_doctypes =
'5': '<!DOCTYPE html>'
'xml': '<?xml ve... | JavaScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | e33f8581362a40c67a351c76ad3ab8a9767ef44b | 1,245 | https://github.com/mauricemach/coffeekup/blob/e33f8581362a40c67a351c76ad3ab8a9767ef44b/lib/coffeekup.coffee | 10 | 59 |
mauricemach/coffeekup:lib/coffeekup.coffee:1:completion | completion | skeleton = (ck_options) ->
ck_options ?= {}
ck_options.context ?= {}
ck_options.locals ?= {}
ck_options.autoescape ?= off
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{ck_esc(v)}\""
str
ck_doctypes =
'5': '<!DOCTYPE html>'
'xml': '<?xml ve... | ck_esc = (txt) ->
if ck_options.autoescape then h(txt) else String(txt)
h = (txt) ->
String(txt).replace(/&(?!\w+;)/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"')
doctype = (type) ->
type ?= 5
text ck_doctypes[type]
text '\n' if ck_options.format
text = (txt... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | e33f8581362a40c67a351c76ad3ab8a9767ef44b | 1,245 | https://github.com/mauricemach/coffeekup/blob/e33f8581362a40c67a351c76ad3ab8a9767ef44b/lib/coffeekup.coffee | 10 | 59 |
mauricemach/coffeekup:lib/coffeekup.coffee:2:raw_corpus | raw_corpus | if name in ck_self_closing
text ' />'
text '\n' if ck_options.format
else
text '>'
text '\n' if ck_options.format
for o in opts
switch typeof o
when 'string', 'number'
text ck_esc(o)
text '\n' if ck_options.format
when 'function'
... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | e33f8581362a40c67a351c76ad3ab8a9767ef44b | 1,245 | https://github.com/mauricemach/coffeekup/blob/e33f8581362a40c67a351c76ad3ab8a9767ef44b/lib/coffeekup.coffee | 60 | 97 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if name in ck_self_closing
text ' />'
text '\n' if ck_options.format
else
text '>'
text '\n' if ck_options.format
for o in opts
switch typeof o
when 'string', 'number'
text ck_esc(o)
tex... | var coffeescript, i, len, o, result, skeleton, support, tags,
indexOf = [].indexOf;
if (indexOf.call(ck_self_closing, name) >= 0) {
text(' />');
if (ck_options.format) {
text('\n');
}
} else {
text('>');
if (ck_options.format) {
text('\n');
}
for (i = 0, len = opts.length; i < len; i++) {
o... | CoffeeScript | JavaScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | e33f8581362a40c67a351c76ad3ab8a9767ef44b | 1,245 | https://github.com/mauricemach/coffeekup/blob/e33f8581362a40c67a351c76ad3ab8a9767ef44b/lib/coffeekup.coffee | 60 | 97 |
mauricemach/coffeekup:lib/coffeekup.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var coffeescript, i, len, o, result, skeleton, support, tags,
indexOf = [].indexOf;
if (indexOf.call(ck_self_closing, name) >= 0) {
text(' />');
if (ck_options.format) {
text('\n');
}
} else {
text('>');
if (ck_options.format) {
text('\n');
}... | if name in ck_self_closing
text ' />'
text '\n' if ck_options.format
else
text '>'
text '\n' if ck_options.format
for o in opts
switch typeof o
when 'string', 'number'
text ck_esc(o)
text '\n' if ck_options.format
when 'function'
... | JavaScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | e33f8581362a40c67a351c76ad3ab8a9767ef44b | 1,245 | https://github.com/mauricemach/coffeekup/blob/e33f8581362a40c67a351c76ad3ab8a9767ef44b/lib/coffeekup.coffee | 60 | 97 |
mauricemach/coffeekup:lib/coffeekup.coffee:2:completion | completion | if name in ck_self_closing
text ' />'
text '\n' if ck_options.format
else
text '>'
text '\n' if ck_options.format
for o in opts
switch typeof o
when 'string', 'number'
text ck_esc(o)
text '\n' if ck_options.format
when 'function'
... | text '\n' if ck_options.format
null
coffeescript = (code) ->
script ";(#{code})();"
null
support = '''
var __slice = Array.prototype.slice;
var __hasProp = Object.prototype.hasOwnProperty;
var __bind = function(func, context) {return function(){ return func.apply(context, arguments); };};
'''
ske... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | e33f8581362a40c67a351c76ad3ab8a9767ef44b | 1,245 | https://github.com/mauricemach/coffeekup/blob/e33f8581362a40c67a351c76ad3ab8a9767ef44b/lib/coffeekup.coffee | 60 | 97 |
mauricemach/coffeekup:lib/coffeekup.coffee:1:raw_corpus | raw_corpus | skeleton = (ck_options) ->
ck_options ?= {}
ck_options.context ?= {}
ck_options.locals ?= {}
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{v}\""
str
ck_doctypes =
'5': '<!DOCTYPE html>'
'xml': '<?xml version="1.0" encoding="utf-8" ?>'
'd... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 7d4cf462ca748e6a28f6c03838cd73de37fad5de | 1,245 | https://github.com/mauricemach/coffeekup/blob/7d4cf462ca748e6a28f6c03838cd73de37fad5de/lib/coffeekup.coffee | 10 | 59 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:1:completion | completion | skeleton = (ck_options) ->
ck_options ?= {}
ck_options.context ?= {}
ck_options.locals ?= {}
ck_buffer = []
ck_render_attrs = (obj) ->
str = ''
for k, v of obj
str += " #{k}=\"#{v}\""
str
ck_doctypes =
'5': '<!DOCTYPE html>'
'xml': '<?xml version="1.0" encoding="utf-8" ?>'
'd... | type ?= 5
text ck_doctypes[type]
text '\n' if ck_options.format
text = (txt) -> ck_buffer.push String(txt); null
comment = (cmt) ->
text "<!--#{cmt}-->"
text '\n' if ck_options.format
tag = (name, opts) ->
text "<#{name}"
for o in opts
text ck_render_attrs(o) if typeof o is 'obje... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 7d4cf462ca748e6a28f6c03838cd73de37fad5de | 1,245 | https://github.com/mauricemach/coffeekup/blob/7d4cf462ca748e6a28f6c03838cd73de37fad5de/lib/coffeekup.coffee | 10 | 59 |
mauricemach/coffeekup:lib/coffeekup.coffee:2:raw_corpus | raw_corpus | when 'string', 'number'
text o
text '\n' if ck_options.format
when 'function'
result = o.call ck_options.context
if typeof result is 'string'
text result
text '\n' if ck_options.format
text "</#{name}>"
text '\n' if ck_opt... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 7d4cf462ca748e6a28f6c03838cd73de37fad5de | 1,245 | https://github.com/mauricemach/coffeekup/blob/7d4cf462ca748e6a28f6c03838cd73de37fad5de/lib/coffeekup.coffee | 60 | 87 | ||
mauricemach/coffeekup:lib/coffeekup.coffee:2:completion | completion | when 'string', 'number'
text o
text '\n' if ck_options.format
when 'function'
result = o.call ck_options.context
if typeof result is 'string'
text result
text '\n' if ck_options.format
text "</#{name}>"
text '\n' if ck_opt... | script ";(#{code})();"
null
support = '''
var __slice = Array.prototype.slice;
var __hasProp = Object.prototype.hasOwnProperty;
var __bind = function(func, context) {return function(){ return func.apply(context, arguments); };};
'''
skeleton = String(skeleton).replace('function (ck_options) {', '').replace /... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 7d4cf462ca748e6a28f6c03838cd73de37fad5de | 1,245 | https://github.com/mauricemach/coffeekup/blob/7d4cf462ca748e6a28f6c03838cd73de37fad5de/lib/coffeekup.coffee | 60 | 87 |
mauricemach/coffeekup:lib/coffeekup.coffee:3:raw_corpus | raw_corpus | coffeekup.compile = (template, options) ->
options ?= {}
options.locals ?= {}
if typeof template is 'function' then template = String(template)
else if typeof template is 'string' and coffee?
template = coffee.compile template, {'noWrap'}
template = "function(){#{template}}"
tags_here = []
for t i... | CoffeeScript | mauricemach/coffeekup | lib/coffeekup.coffee | MIT | 8262487772fd8853cd835ec41f19a7f3daa25472 | 1,245 | https://github.com/mauricemach/coffeekup/blob/8262487772fd8853cd835ec41f19a7f3daa25472/lib/coffeekup.coffee | 89 | 118 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.