Browse files

trying to update with something that works

  • Loading branch information...
1 parent 81db48e commit 5481c6c510d1103ae28b1268dd27f59f903649d8 @martypdx committed Nov 1, 2012
Showing with 0 additions and 3,969 deletions.
  1. 0 .monitor
  2. 0 .nodemonignore
  3. 0 index2.html
  4. +0 −137 lib/template-service.js
  5. +0 −249 public/index.html
  6. +0 −2,645 public/js/3rdParty/jade/jade.js
  7. +0 −16 public/js/3rdParty/jquery/jquery.js
  8. +0 −52 public/js/3rdParty/microevent/microevent.js
  9. +0 −90 public/js/templates.js
  10. 0 repl.js
  11. +0 −49 sample-app/features/demo/bowling/bowling.css
  12. +0 −3 sample-app/features/demo/bowling/bowling.fn
  13. +0 −1 sample-app/features/demo/bowling/bowling.html
  14. +0 −50 sample-app/features/demo/bowling/bowling.jade
  15. +0 −9 sample-app/features/demo/bowling/bowling.js
  16. 0 sample-app/features/demo/bowling/bowling.json
  17. +0 −49 sample-app/features/demo/bowling2/bowling2.css
  18. +0 −3 sample-app/features/demo/bowling2/bowling2.fn
  19. +0 −1 sample-app/features/demo/bowling2/bowling2.html
  20. +0 −35 sample-app/features/demo/bowling2/bowling2.jade
  21. +0 −9 sample-app/features/demo/bowling2/bowling2.js
  22. +0 −14 sample-app/features/demo/bowling2/bowling2.json
  23. +0 −49 sample-app/features/demo/bowling3/bowling3.css
  24. +0 −3 sample-app/features/demo/bowling3/bowling3.fn
  25. +0 −1 sample-app/features/demo/bowling3/bowling3.html
  26. +0 −35 sample-app/features/demo/bowling3/bowling3.jade
  27. +0 −9 sample-app/features/demo/bowling3/bowling3.js
  28. +0 −14 sample-app/features/demo/bowling3/bowling3.json
  29. +0 −78 sample-app/features/demo/hello-world/hello-world.css
  30. +0 −3 sample-app/features/demo/hello-world/hello-world.fn
  31. +0 −114 sample-app/features/demo/hello-world/hello-world.html
  32. +0 −38 sample-app/features/demo/hello-world/hello-world.jade
  33. 0 sample-app/features/demo/hello-world/hello-world.js
  34. +0 −36 sample-app/features/demo/hello-world/hello-world.json
  35. 0 sample-app/features/demo/mixin-return-test/mixin-return-test.css
  36. +0 −3 sample-app/features/demo/mixin-return-test/mixin-return-test.fn
  37. +0 −1 sample-app/features/demo/mixin-return-test/mixin-return-test.html
  38. +0 −4 sample-app/features/demo/mixin-return-test/mixin-return-test.jade
  39. 0 sample-app/features/demo/mixin-return-test/mixin-return-test.js
  40. 0 sample-app/features/demo/mixin-return-test/mixin-return-test.json
  41. +0 −5 sample-app/features/demo/movejs/movejs.css
  42. +0 −3 sample-app/features/demo/movejs/movejs.fn
  43. +0 −1 sample-app/features/demo/movejs/movejs.html
  44. +0 −2 sample-app/features/demo/movejs/movejs.jade
  45. +0 −13 sample-app/features/demo/movejs/movejs.js
  46. 0 sample-app/features/demo/movejs/movejs.json
  47. 0 sample-app/features/demo/scope-test/scope-test.css
  48. +0 −3 sample-app/features/demo/scope-test/scope-test.fn
  49. +0 −1 sample-app/features/demo/scope-test/scope-test.html
  50. +0 −4 sample-app/features/demo/scope-test/scope-test.jade
  51. 0 sample-app/features/demo/scope-test/scope-test.js
  52. +0 −10 sample-app/features/demo/scope-test/scope-test.json
  53. +0 −37 sample-app/features/template-selector/feature-list/feature-list.css
  54. +0 −3 sample-app/features/template-selector/feature-list/feature-list.fn
  55. +0 −1 sample-app/features/template-selector/feature-list/feature-list.html
  56. +0 −5 sample-app/features/template-selector/feature-list/feature-list.jade
  57. +0 −30 sample-app/features/template-selector/feature-list/feature-list.js
  58. +0 −1 sample-app/features/template-selector/feature-list/feature-list.json
  59. 0 sample-app/features/template-selector/features-mixin/features-mixin.css
  60. +0 −1 sample-app/features/template-selector/features-mixin/features-mixin.html
  61. +0 −12 sample-app/features/template-selector/features-mixin/features-mixin.jade
  62. 0 sample-app/features/template-selector/features-mixin/features-mixin.js
  63. +0 −1 sample-app/features/template-selector/features-mixin/features-mixin.json
  64. 0 sample-app/features/template-selector/features/features.css
  65. +0 −1 sample-app/features/template-selector/features/features.html
  66. +0 −2 sample-app/features/template-selector/features/features.jade
  67. 0 sample-app/features/template-selector/features/features.js
  68. +0 −1 sample-app/features/template-selector/features/features.json
  69. 0 sample-app/features/template-selector/template-mixin/template-mixin.css
  70. 0 sample-app/features/template-selector/template-mixin/template-mixin.fn
  71. +0 −1 sample-app/features/template-selector/template-mixin/template-mixin.html
  72. +0 −8 sample-app/features/template-selector/template-mixin/template-mixin.jade
  73. 0 sample-app/features/template-selector/template-mixin/template-mixin.js
  74. +0 −1 sample-app/features/template-selector/template-mixin/template-mixin.json
  75. 0 sample-app/features/template-selector/templates-mixin/templates-mixin.css
  76. +0 −3 sample-app/features/template-selector/templates-mixin/templates-mixin.fn
  77. +0 −1 sample-app/features/template-selector/templates-mixin/templates-mixin.html
  78. +0 −10 sample-app/features/template-selector/templates-mixin/templates-mixin.jade
  79. 0 sample-app/features/template-selector/templates-mixin/templates-mixin.js
  80. +0 −4 sample-app/features/template-selector/templates-mixin/templates-mixin.json
  81. 0 sample-app/features/template-selector/templates/templates.css
  82. 0 sample-app/features/template-selector/templates/templates.fn
  83. +0 −1 sample-app/features/template-selector/templates/templates.html
  84. +0 −2 sample-app/features/template-selector/templates/templates.jade
  85. 0 sample-app/features/template-selector/templates/templates.js
  86. +0 −1 sample-app/features/template-selector/templates/templates.json
  87. 0 test/panes-test.js
  88. 0 test/sizer-test.js
  89. 0 test/test-feature-nodeunit.js
  90. 0 test/test-feature-sink.js
View
0 .monitor
No changes.
View
0 .nodemonignore 100755 → 100644
File mode changed.
View
0 index2.html 100755 → 100644
File mode changed.
View
137 lib/template-service.js
@@ -1,137 +0,0 @@
-var fs = require('fs')
- , path = require('path')
- , mkdirp = require('mkdirp')
-
-
-function Service(app) {
-
- this.app = app
- var service = this
-
- var ensureDirExists = function(path, cb) {
- mkdirp(path, 0755, function(err) {
- err ? cb(err) : cb(null, path)
- })
- }
- var getFeaturesDir = function(cb) {
- ensureDirExists(path.join(app, 'features'), cb)
- }
- var getFeatureNames = function(cb) {
- getFeaturesDir(function(err, featuresDir){
- fs.readdir(featuresDir, cb)
- })
- }
- var getFeatureDir = function(feature, cb) {
- getFeaturesDir(function(err, featuresDir){
- ensureDirExists(path.join(featuresDir, feature), cb)
- })
- }
- var getTemplateDir = function(feature, template, cb) {
- getFeatureDir(feature, function(err, featureDir){
- ensureDirExists(path.join(featureDir, template), cb)
- })
- }
- var getTemplateNames = function(feature, cb) {
- getFeatureDir(feature, function(err, featureDir){
- fs.readdir(featureDir, cb)
- })
- }
-
- //hierarchical list of all features and templates
- this.listAll = function(cb) {
- getFeatureNames(function(err, features){
- var results = { features: [] }
- if(features.length === 0) { return cb(null, results) }
-
- var gotFeature = function(feature) {
- if(results.features.push(feature) === features.length) {
- results.features.sort(function(a, b) {
- return a.name < b.name ? -1 : 1
- })
- cb(null, results)
- }
- }
-
- features.forEach(function(feature) {
- getTemplateNames(feature, function(err, templates) {
- gotFeature({ name: feature, templates: templates.sort() })
- })
- })
- })
- }
-
- var templateParts = ['css', 'fn', 'html', 'jade', 'js', 'json']
-
- var templateRoot = function(templateDir, template){
- return path.join(templateDir, template + '.')
- }
-
- //get full template
- var getTemplate = this.getTemplate = function(feature, template, cb) {
-
- getTemplateDir(feature, template, function(err, templateDir) {
- var parts = 0
- var results = { name: template }
- var root = templateRoot(templateDir, template)
-
- var collect = function(name) {
- fs.readFile(root + name, function(err, data) {
- results[name] = (err) ? "" : data.toString()
- parts++;
- if(parts === templateParts.length) { cb(null, results) }
- })
- }
- templateParts.forEach(collect)
- })
- }
-
- //get all full templates for a feature
- this.getTemplates = function(feature, cb) {
-
- getTemplateNames(feature, function(err, templates) {
- var results = { name: feature, templates: [] }
- if(templates.length === 0) { return cb(null, results) }
-
- var gotTemplate = function(err, template) {
- if(results.templates.push(template) === templates.length) {
- cb(null, results)
- }
- }
- templates.forEach(function(template) {
- getTemplate(feature, template, gotTemplate)
- })
- })
- }
-
- //save full template
- this.saveTemplate = function(feature, template, data, cb) {
-
- getTemplateDir(feature, template, function(err, templateDir) {
- var parts = 0
- var results = {}
- var root = templateRoot(templateDir, template)
-
- var hasError
- var save = function(name) {
- fs.writeFile(root + name, data[name], function(err, data) {
- if (err) {
- hasError = true
- results[name] = err
- }
- parts++;
- if(parts === templateParts.length) { cb((hasError) ? results : null) }
- })
- }
- templateParts.forEach(save)
- })
-
- }
-}
-
-
-var exportObject = {}
-exportObject.getApp = function(appDir) {
- console.log('creating template service for app', appDir)
- return new Service(appDir)
-}
-module.exports = exportObject
View
249 public/index.html
@@ -1,249 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Delight</title>
-
- <link rel="stylesheet" href="css/main.css" type="text/css">
- <link rel="stylesheet" href="css/panes.css" type="text/css">
- <link rel="stylesheet" href="css/editors.css" type="text/css">
-
-
- <!--
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.js" type="text/javascript"></script>
- -->
-
- <script src="js/3rdParty/jquery/jquery.js" type="text/javascript"></script>
-
-
- <script type="text/javascript" src="js/3rdParty/event.drag.touch/jquery.event.drag.js"></script>
- <script src="js/3rdParty/ace/ace-uncompressed.js" type="text/javascript" charset="utf-8"></script>
- <script src="js/3rdParty/ace/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
- <script src="js/3rdParty/ace/mode-css.js" type="text/javascript" charset="utf-8"></script>
- <script src="js/3rdParty/ace/mode-json.js" type="text/javascript" charset="utf-8"></script>
- <script src="js/3rdParty/ace/theme-solarized_light.js" type="text/javascript" charset="utf-8"></script>
-
- <!--
- <script src="js/3rdParty/ace/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
- <script src="js/3rdParty/ace/theme-dawn.js" type="text/javascript" charset="utf-8"></script>
- <script src="js/3rdParty/ace/theme-clouds.js" type="text/javascript" charset="utf-8"></script>
- <script src="js/3rdParty/ace/theme-textmate.js" type="text/javascript" charset="utf-8"></script>
- -->
-
-
- <script src="js/3rdParty/jade/jade.js"></script>
- <script src="js/3rdParty/dpm/diff_match_patch_uncompressed.js"></script>
- <script src="js/templates.js"></script>
- <script src="js/3rdParty/microevent/microevent.js"></script>
- <script src="js/panes.js"></script>
- <script src="js/editors.js"></script>
-
- <script type="text/javascript">
-
- var currentApp = 'sample-app'
- var intervalId, posting
- var loadEditor = function(feature, templateName) {
- if(intervalId) { clearInterval(intervalId) }
-
- var templates = Templates.getApp(currentApp)
- var template = templates[feature][templateName]
- editors.load(templates, template)
-
- intervalId = setInterval(function() {
- if(posting || !editors.template.changed){ return }
-
- posting = true
- donePosting = function() { posting = false}
-
- try {
- var templateParts = ['css', 'fn', 'html', 'jade', 'js', 'json']
- var toPost = {}
- templateParts.forEach(function(part){
- toPost[part] = editors.template[part]
- })
-
- var post = $.post('/applications/' + currentApp + '/features/' + feature + '/templates/' + template.name, { template: toPost })
-
- post.error(function() { console.log('error')})
- post.complete(function() {
- posting = false
- })
-
- }
- catch (er) {
- console.log(er)
- }
-
-
- editors.template.changed = false
-
- }, 1500)
- }
-
- var loadTemplate = function(feature, template) {
- var loadIt = function() { loadEditor(feature, template) }
-
- var templates = Templates.getApp(currentApp)
-
- if(!templates[feature]) {
- templates.loadFeature(feature, loadIt)
- } else if (!templates[feature][template]) {
- templates.loadTemplate(feature, template, loadIt)
- } else {
- loadIt()
- }
- }
- var newTemplate = function(feature, template) {
- var templates = Templates.getApp(currentApp)
- templates.loadTemplate(feature, template, function() {
- loadEditor(feature, template) })
- }
-
- var init = function() {
- var editorTemplates = Templates.getApp('jade-editor')
- editorTemplates.loadFeature('editor', function() {})
-
- var featureList
- var loadFeatureList = function() {
- if(!editorTemplates['template-selector'] || !featureList) { return }
-
- var template = editorTemplates['template-selector']['feature-list']
- var css = $('<style></style>')
- css.text(template.css)
- $('head').append(css)
-
- var html= template.render(featureList)
- $('#side-panel').append(html)
- var fn = new Function(template.js)
- fn()
-
- var toLoad = { feature: 'demo', template: 'hello-world' }
- var loadFunction = newTemplate
- if (featureList.features.length > 0) {
- toLoad.feature = featureList.features[0].name
- if (featureList.features[0].templates.length > 0) {
- toLoad.template = featureList.features[0].templates[0]
- loadFunction = loadTemplate
- }
- }
- loadFunction(toLoad.feature, toLoad.template)
- }
-
- editorTemplates.loadFeature('template-selector', function() { loadFeatureList() })
-
- $.getJSON('/applications/' + currentApp + '/features', function(response) {
- featureList = response
- loadFeatureList()
- })
-
- var $panes = $('#master')
- var panes = Panes.init($panes, { widthRatio: .1, subOptions: { widthRation: .61 }})
-
- editors.setPreviewContainer($panes.find('#preview-container')[0]);
-
- var jade_editor = editors.createJade($panes.find('.jade')[0])
- var css_editor = editors.createCSS($panes.find('.css')[0])
- var json_editor = editors.createJSON($panes.find('.json')[0])
- var javascript_editor = editors.createJavascript($panes.find('.javascript')[0])
-
- editors.showPreview()
-
- panes.onresize(function() {
- jade_editor.resize()
- css_editor.resize()
- json_editor.resize()
- javascript_editor.resize()
- })
-
-
-
- }
-
- $(init)
-
- /*
- window.onblur = function() {
- suspendResize = true
- }
-
- window.onfocus = function() {
- suspendResize = false
- }
- */
- </script>
-
- <script type="text/javascript">
- function test() {
- function getHtml(id) {
- return document.getElementById(id).innerHTML.trim();
- }
- var expected = getHtml('expected');
- var actual = getHtml('actual');
-
- if(expected !== actual) { alert('Actual does not match expected standard') }
- }
- </script>
- <script type="text/javascript">
- function setupJade(jade_editor, preview) {
- var jade = jade_require('jade');
-
- var render = function() {
- preview.open()
- preview.write(jade.render(jade_editor[0].textContent))
- preview.close()
- }
-
- var spaceTabs = function(evt) {
- var isTab = (evt.keyCode === 9);
- if(isTab) {
- evt.preventDefault()
- return false;
- }
- }
-
- render();
-
- jade_editor[0].addEventListener('keydown', spaceTabs, true);
- jade_editor[0].addEventListener('keyup', render, true);
- }
-
- </script>
-</head>
-<body>
-
-
- <div id="master" class="panes">
- <div id="side-panel" class="pane top bottom left shadow">
-
- </div>
- <div id="main-panel" class="pane top bottom right shadow">
- <div class="panes">
- <div class="pane top bottom left shadow">
-
- <div class="panes">
- <div class="pane top left shadow">
- <div class="jade"></div>
- </div>
- <div class="pane top right shadow">
- <div class="css"></div>
- </div>
- <div class="pane bottom left shadow">
- <div class="json"></div>
- </div>
- <div class="pane bottom right shadow">
- <div class="javascript"></div>
- </div>
- <div class="sizer quad-sizer"></div>
- </div>
- </div>
-
- <div id="preview-container" class="pane top bottom right shadow">
- </div>
- <div class="sizer horizontal-sizer"></div>
- </div>
- </div>
- <div class="sizer horizontal-sizer"></div>
- </div>
-
-</body>
-</html>
View
2,645 public/js/3rdParty/jade/jade.js
@@ -1,2645 +0,0 @@
-
-// CommonJS jade_require()
-
-function jade_require(p){
- var path = jade_require.resolve(p)
- , mod = jade_require.modules[path];
- if (!mod) throw new Error('failed to jade_require "' + p + '"');
- if (!mod.exports) {
- mod.exports = {};
- mod.call(mod.exports, mod, mod.exports, jade_require.relative(path));
- }
- return mod.exports;
- }
-
-jade_require.modules = {};
-
-jade_require.resolve = function (path){
- var orig = path
- , reg = path + '.js'
- , index = path + '/index.js';
- return jade_require.modules[reg] && reg
- || jade_require.modules[index] && index
- || orig;
- };
-
-jade_require.register = function (path, fn){
- jade_require.modules[path] = fn;
- };
-
-jade_require.relative = function (parent) {
- return function(p){
- if ('.' != p[0]) return jade_require(p);
-
- var path = parent.split('/')
- , segs = p.split('/');
- path.pop();
-
- for (var i = 0; i < segs.length; i++) {
- var seg = segs[i];
- if ('..' == seg) path.pop();
- else if ('.' != seg) path.push(seg);
- }
-
- return jade_require(path.join('/'));
- };
- };
-
-
-jade_require.register("compiler.js", function(module, exports, jade_require){
-
-/*!
- * Jade - Compiler
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var nodes = jade_require('./nodes')
- , filters = jade_require('./filters')
- , doctypes = jade_require('./doctypes')
- , selfClosing = jade_require('./self-closing')
- , inlineTags = jade_require('./inline-tags')
- , utils = jade_require('./utils');
-
-
- if (!Object.keys) {
- Object.keys = function(obj){
- var arr = [];
- for (var key in obj) {
- if (obj.hasOwnProperty(key)) {
- arr.push(obj);
- }
- }
- return arr;
- }
- }
-
- if (!String.prototype.trimLeft) {
- String.prototype.trimLeft = function(){
- return this.replace(/^\s+/, '');
- }
- }
-
-
-
-/**
- * Initialize `Compiler` with the given `node`.
- *
- * @param {Node} node
- * @param {Object} options
- * @api public
- */
-
-var Compiler = module.exports = function Compiler(node, options) {
- this.options = options = options || {};
- this.node = node;
- this.hasCompiledDoctype = false;
- this.hasCompiledTag = false;
- this.pp = options.pretty || false;
- this.debug = false !== options.compileDebug;
- this.indents = 0;
- if (options.doctype) this.setDoctype(options.doctype);
-};
-
-/**
- * Compiler prototype.
- */
-
-Compiler.prototype = {
-
- /**
- * Compile parse tree to JavaScript.
- *
- * @api public
- */
-
- compile: function(){
- this.buf = ['var interp;'];
- this.lastBufferedIdx = -1
- this.visit(this.node);
- return this.buf.join('\n');
- },
-
- /**
- * Sets the default doctype `name`. Sets terse mode to `true` when
- * html 5 is used, causing self-closing tags to end with ">" vs "/>",
- * and boolean attributes are not mirrored.
- *
- * @param {string} name
- * @api public
- */
-
- setDoctype: function(name){
- var doctype = doctypes[(name || 'default').toLowerCase()];
- if (!doctype) throw new Error('unknown doctype "' + name + '"');
- this.doctype = doctype;
- this.terse = '5' == name || 'html' == name;
- this.xml = 0 == this.doctype.indexOf('<?xml');
- },
-
- /**
- * Buffer the given `str` optionally escaped.
- *
- * @param {String} str
- * @param {Boolean} esc
- * @api public
- */
-
- buffer: function(str, esc){
- if (esc) str = utils.escape(str);
-
- if (this.lastBufferedIdx == this.buf.length) {
- this.lastBuffered += str;
- this.buf[this.lastBufferedIdx - 1] = "buf.push('" + this.lastBuffered + "');"
- } else {
- this.buf.push("buf.push('" + str + "');");
- this.lastBuffered = str;
- this.lastBufferedIdx = this.buf.length;
- }
- },
-
- /**
- * Buffer the given `node`'s lineno.
- *
- * @param {Node} node
- * @api public
- */
-
- line: function(node){
- if (false === node.instrumentLineNumber) return;
- this.buf.push('__.lineno = ' + node.line + ';');
- },
-
- /**
- * Visit `node`.
- *
- * @param {Node} node
- * @api public
- */
-
- visit: function(node){
- if (this.debug) this.line(node);
- return this.visitNode(node);
- },
-
- /**
- * Visit `node`.
- *
- * @param {Node} node
- * @api public
- */
-
- visitNode: function(node){
- var name = node.constructor.name
- || node.constructor.toString().match(/function ([^(\s]+)()/)[1];
- return this['visit' + name](node);
- },
-
- /**
- * Visit literal `node`.
- *
- * @param {Literal} node
- * @api public
- */
-
- visitLiteral: function(node){
- var str = node.str.replace(/\n/g, '\\\\n');
- this.buffer(str);
- },
-
- /**
- * Visit all nodes in `block`.
- *
- * @param {Block} block
- * @api public
- */
-
- visitBlock: function(block){
- var len = block.nodes.length;
- for (var i = 0; i < len; ++i) {
- this.visit(block.nodes[i]);
- }
- },
-
- /**
- * Visit `doctype`. Sets terse mode to `true` when html 5
- * is used, causing self-closing tags to end with ">" vs "/>",
- * and boolean attributes are not mirrored.
- *
- * @param {Doctype} doctype
- * @api public
- */
-
- visitDoctype: function(doctype){
- if (doctype && (doctype.val || !this.doctype)) {
- this.setDoctype(doctype.val || 'default');
- }
-
- if (this.doctype) this.buffer(this.doctype);
- this.hasCompiledDoctype = true;
- },
-
- /**
- * Visit `mixin`, generating a function that
- * may be called within the template.
- *
- * @param {Mixin} mixin
- * @api public
- */
-
- visitMixin: function(mixin){
- var name = mixin.name.replace(/-/g, '_') + '_mixin'
- , args = mixin.args || '';
-
- if (mixin.block) {
- this.buf.push('var ' + name + ' = function(' + args + '){');
- this.visit(mixin.block);
- this.buf.push('}');
- } else {
- this.buf.push(name + '(' + args + ');');
- }
- },
-
- /**
- * Visit `tag` buffering tag markup, generating
- * attributes, visiting the `tag`'s code and block.
- *
- * @param {Tag} tag
- * @api public
- */
-
- visitTag: function(tag){
- this.indents++;
- var name = tag.name;
-
- if (!this.hasCompiledTag) {
- if (!this.hasCompiledDoctype && 'html' == name) {
- this.visitDoctype();
- }
- this.hasCompiledTag = true;
- }
-
- // pretty print
- if (this.pp && inlineTags.indexOf(name) == -1) {
- this.buffer('\\n' + Array(this.indents).join(' '));
- }
-
- if (~selfClosing.indexOf(name) && !this.xml) {
- this.buffer('<' + name);
- this.visitAttributes(tag.attrs);
- this.terse
- ? this.buffer('>')
- : this.buffer('/>');
- } else {
- // Optimize attributes buffering
- if (tag.attrs.length) {
- this.buffer('<' + name);
- if (tag.attrs.length) this.visitAttributes(tag.attrs);
- this.buffer('>');
- } else {
- this.buffer('<' + name + '>');
- }
- if (tag.code) this.visitCode(tag.code);
- if (tag.text) this.buffer(utils.text(tag.text.nodes[0].trimLeft()));
- this.escape = 'pre' == tag.name;
- this.visit(tag.block);
-
- // pretty print
- if (this.pp && !~inlineTags.indexOf(name) && !tag.textOnly) {
- this.buffer('\\n' + Array(this.indents).join(' '));
- }
-
- this.buffer('</' + name + '>');
- }
- this.indents--;
- },
-
- /**
- * Visit `filter`, throwing when the filter does not exist.
- *
- * @param {Filter} filter
- * @api public
- */
-
- visitFilter: function(filter){
- var fn = filters[filter.name];
-
- // unknown filter
- if (!fn) {
- if (filter.isASTFilter) {
- throw new Error('unknown ast filter "' + filter.name + ':"');
- } else {
- throw new Error('unknown filter ":' + filter.name + '"');
- }
- }
- if (filter.isASTFilter) {
- this.buf.push(fn(filter.block, this, filter.attrs));
- } else {
- var text = filter.block.nodes.join('');
- this.buffer(utils.text(fn(text, filter.attrs)));
- }
- },
-
- /**
- * Visit `text` node.
- *
- * @param {Text} text
- * @api public
- */
-
- visitText: function(text){
- text = utils.text(text.nodes.join(''));
- if (this.escape) text = escape(text);
- this.buffer(text);
- this.buffer('\\n');
- },
-
- /**
- * Visit a `comment`, only buffering when the buffer flag is set.
- *
- * @param {Comment} comment
- * @api public
- */
-
- visitComment: function(comment){
- if (!comment.buffer) return;
- if (this.pp) this.buffer('\\n' + Array(this.indents + 1).join(' '));
- this.buffer('<!--' + utils.escape(comment.val) + '-->');
- },
-
- /**
- * Visit a `BlockComment`.
- *
- * @param {Comment} comment
- * @api public
- */
-
- visitBlockComment: function(comment){
- if (!comment.buffer) return;
- if (0 == comment.val.indexOf('if')) {
- this.buffer('<!--[' + comment.val + ']>');
- this.visit(comment.block);
- this.buffer('<![endif]-->');
- } else {
- this.buffer('<!--' + comment.val);
- this.visit(comment.block);
- this.buffer('-->');
- }
- },
-
- /**
- * Visit `code`, respecting buffer / escape flags.
- * If the code is followed by a block, wrap it in
- * a self-calling function.
- *
- * @param {Code} code
- * @api public
- */
-
- visitCode: function(code){
- // Wrap code blocks with {}.
- // we only wrap unbuffered code blocks ATM
- // since they are usually flow control
-
- // Buffer code
- if (code.buffer) {
- var val = code.val.trimLeft();
- this.buf.push('var __val__ = ' + val);
- val = 'null == __val__ ? "" : __val__';
- if (code.escape) val = 'escape(' + val + ')';
- this.buf.push("buf.push(" + val + ");");
- } else {
- this.buf.push(code.val);
- }
-
- // Block support
- if (code.block) {
- if (!code.buffer) this.buf.push('{');
- this.visit(code.block);
- if (!code.buffer) this.buf.push('}');
- }
- },
-
- /**
- * Visit `each` block.
- *
- * @param {Each} each
- * @api public
- */
-
- visitEach: function(each){
- this.buf.push(''
- + '// iterate ' + each.obj + '\n'
- + '(function(){\n'
- + ' if (\'number\' == typeof ' + each.obj + '.length) {\n'
- + ' for (var ' + each.key + ' = 0, $$l = ' + each.obj + '.length; ' + each.key + ' < $$l; ' + each.key + '++) {\n'
- + ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n');
-
- this.visit(each.block);
-
- this.buf.push(''
- + ' }\n'
- + ' } else {\n'
- + ' for (var ' + each.key + ' in ' + each.obj + ') {\n'
- + ' if (' + each.obj + '.hasOwnProperty(' + each.key + ')){'
- + ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n');
-
- this.visit(each.block);
-
- this.buf.push(' }\n');
-
- this.buf.push(' }\n }\n}).call(this);\n');
- },
-
- /**
- * Visit `attrs`.
- *
- * @param {Array} attrs
- * @api public
- */
-
- visitAttributes: function(attrs){
- var buf = []
- , classes = [];
-
- if (this.terse) buf.push('terse: true');
-
- attrs.forEach(function(attr){
- if (attr.name == 'class') {
- classes.push('(' + attr.val + ')');
- } else {
- var pair = "'" + attr.name + "':(" + attr.val + ')';
- buf.push(pair);
- }
- });
-
- if (classes.length) {
- classes = classes.join(" + ' ' + ");
- buf.push("class: " + classes);
- }
-
- buf = buf.join(', ').replace('class:', '"class":');
-
- this.buf.push("buf.push(attrs({ " + buf + " }));");
- }
-};
-
-/**
- * Escape the given string of `html`.
- *
- * @param {String} html
- * @return {String}
- * @api private
- */
-
-function escape(html){
- return String(html)
- .replace(/&(?!\w+;)/g, '&amp;')
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;')
- .replace(/"/g, '&quot;');
-}
-
-}); // module: compiler.js
-
-jade_require.register("doctypes.js", function(module, exports, jade_require){
-
-/*!
- * Jade - doctypes
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-module.exports = {
- '5': '<!DOCTYPE html>'
- , 'html': '<!DOCTYPE html>'
- , 'xml': '<?xml version="1.0" encoding="utf-8" ?>'
- , 'default': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
- , 'transitional': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
- , 'strict': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
- , 'frameset': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">'
- , '1.1': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'
- , 'basic': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">'
- , 'mobile': '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">'
-};
-}); // module: doctypes.js
-
-jade_require.register("filters.js", function(module, exports, jade_require){
-
-/*!
- * Jade - filters
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-module.exports = {
-
- /**
- * Wrap text with CDATA block.
- */
-
- cdata: function(str){
- return '<![CDATA[\\n' + str + '\\n]]>';
- },
-
- /**
- * Transform sass to css, wrapped in style tags.
- */
-
- sass: function(str){
- str = str.replace(/\\n/g, '\n');
- var sass = jade_require('sass').render(str).replace(/\n/g, '\\n');
- return '<style>' + sass + '</style>';
- },
-
- /**
- * Transform stylus to css, wrapped in style tags.
- */
-
- stylus: function(str, options){
- var ret;
- str = str.replace(/\\n/g, '\n');
- var stylus = jade_require('stylus');
- stylus(str, options).render(function(err, css){
- if (err) throw err;
- ret = css.replace(/\n/g, '\\n');
- });
- return '<style>' + ret + '</style>';
- },
-
- /**
- * Transform sass to css, wrapped in style tags.
- */
-
- less: function(str){
- var ret;
- str = str.replace(/\\n/g, '\n');
- jade_require('less').render(str, function(err, css){
- if (err) throw err;
- ret = '<style>' + css.replace(/\n/g, '\\n') + '</style>';
- });
- return ret;
- },
-
- /**
- * Transform markdown to html.
- */
-
- markdown: function(str){
- var md;
-
- // support markdown / discount
- try {
- md = jade_require('markdown');
- } catch (err){
- try {
- md = jade_require('discount');
- } catch (err) {
- try {
- md = jade_require('markdown-js');
- } catch (err) {
- throw new Error('Cannot find markdown library, install markdown or discount');
- }
- }
- }
-
- str = str.replace(/\\n/g, '\n');
- return md.parse(str).replace(/\n/g, '\\n').replace(/'/g,'&#39;');
- },
-
- /**
- * Transform coffeescript to javascript.
- */
-
- coffeescript: function(str){
- str = str.replace(/\\n/g, '\n');
- var js = jade_require('coffee-script').compile(str).replace(/\n/g, '\\n');
- return '<script type="text/javascript">\\n' + js + '</script>';
- }
-};
-}); // module: filters.js
-
-jade_require.register("inline-tags.js", function(module, exports, jade_require){
-
-/*!
- * Jade - inline tags
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-module.exports = [
- 'a'
- , 'abbr'
- , 'acronym'
- , 'b'
- , 'br'
- , 'code'
- , 'em'
- , 'font'
- , 'i'
- , 'img'
- , 'ins'
- , 'kbd'
- , 'map'
- , 'samp'
- , 'small'
- , 'span'
- , 'strong'
- , 'sub'
- , 'sup'
-];
-}); // module: inline-tags.js
-
-jade_require.register("jade.js", function(module, exports, jade_require){
-
-/*!
- * Jade
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var Parser = jade_require('./parser')
- , Compiler = jade_require('./compiler')
- , runtime = jade_require('./runtime')
-
-/**
- * Library version.
- */
-
-exports.version = '0.15.4';
-
-/**
- * Intermediate JavaScript cache.
- */
-
-var cache = exports.cache = {};
-
-/**
- * Expose self closing tags.
- */
-
-exports.selfClosing = jade_require('./self-closing');
-
-/**
- * Default supported doctypes.
- */
-
-exports.doctypes = jade_require('./doctypes');
-
-/**
- * Text filters.
- */
-
-exports.filters = jade_require('./filters');
-
-/**
- * Utilities.
- */
-
-exports.utils = jade_require('./utils');
-
-/**
- * Expose `Compiler`.
- */
-
-exports.Compiler = Compiler;
-
-/**
- * Expose `Parser`.
- */
-
-exports.Parser = Parser;
-
-/**
- * Nodes.
- */
-
-exports.nodes = jade_require('./nodes');
-
-/**
- * Jade runtime helpers.
- */
-
-exports.runtime = runtime;
-
-/**
- * Parse the given `str` of jade and return a function body.
- *
- * @param {String} str
- * @param {Object} options
- * @return {String}
- * @api private
- */
-
-function parse(str, options){
- var filename = options.filename;
-
- try {
- // Parse
- var parser = new Parser(str, filename, options);
-
- // Compile
- var compiler = new (options.compiler || Compiler)(parser.parse(), options)
- , js = compiler.compile();
-
- // Debug compiler
- if (options.debug) {
- console.log('\n\x1b[1mCompiled Function\x1b[0m:\n\n%s', js.replace(/^/gm, ' '));
- }
-
- try {
- return ''
- + 'var buf = [];\n'
- + (options.self
- ? 'var self = locals || {};\n' + js
- : 'with (locals || {}) {\n' + js + '\n}\n')
- + 'return buf.join("");';
-
- } catch (err) {
- process.compile(js, filename || 'Jade');
- return;
- }
- } catch (err) {
- runtime.rethrow(err, str, filename, parser.lexer.lineno);
- }
-}
-
-/**
- * Compile a `Function` representation of the given jade `str`.
- *
- * Options:
- *
- * - `compileDebug` when `false` debugging code is stripped from the compiled template
- * - `client` when `true` the helper functions `escape()` etc will reference `jade.escape()`
- * for use with the Jade client-side runtime.js
- *
- * @param {String} str
- * @param {Options} options
- * @return {Function}
- * @api public
- */
-
-exports.compile = function(str, options){
- var options = options || {}
- , input = JSON.stringify(str)
- , client = options.client
- , filename = options.filename
- ? JSON.stringify(options.filename)
- : 'undefined'
- , fn;
-
- if (options.compileDebug !== false) {
- fn = [
- 'var __ = { lineno: 1, input: ' + input + ', filename: ' + filename + ' };'
- , 'try {'
- , parse(String(str), options || {})
- , '} catch (err) {'
- , ' rethrow(err, __.input, __.filename, __.lineno);'
- , '}'
- ].join('\n');
- } else {
- fn = parse(String(str), options || {});
- }
-
- if (client) {
- fn = 'var attrs = jade.attrs, escape = jade.escape, rethrow = jade.rethrow;\n' + fn;
- }
-
- fn = new Function('locals, attrs, escape, rethrow', fn);
-
- if (client) return fn;
-
- return function(locals){
- return fn(locals, runtime.attrs, runtime.escape, runtime.rethrow);
- };
-};
-
-}); // module: jade.js
-
-jade_require.register("lexer.js", function(module, exports, jade_require){
-
-/*!
- * Jade - Lexer
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Initialize `Lexer` with the given `str`.
- *
- * Options:
- *
- * - `colons` allow colons for attr delimiters
- *
- * @param {String} str
- * @param {Object} options
- * @api private
- */
-
-var Lexer = module.exports = function Lexer(str, options) {
- options = options || {};
- this.input = str.replace(/\r\n|\r/g, '\n');
- this.colons = options.colons;
- this.deferredTokens = [];
- this.lastIndents = 0;
- this.lineno = 1;
- this.stash = [];
- this.indentStack = [];
- this.indentRe = null;
- this.pipeless = false;
-};
-
-/**
- * Lexer prototype.
- */
-
-Lexer.prototype = {
-
- /**
- * Construct a token with the given `type` and `val`.
- *
- * @param {String} type
- * @param {String} val
- * @return {Object}
- * @api private
- */
-
- tok: function(type, val){
- return {
- type: type
- , line: this.lineno
- , val: val
- }
- },
-
- /**
- * Consume the given `len` of input.
- *
- * @param {Number} len
- * @api private
- */
-
- consume: function(len){
- this.input = this.input.substr(len);
- },
-
- /**
- * Scan for `type` with the given `regexp`.
- *
- * @param {String} type
- * @param {RegExp} regexp
- * @return {Object}
- * @api private
- */
-
- scan: function(regexp, type){
- var captures;
- if (captures = regexp.exec(this.input)) {
- this.consume(captures[0].length);
- return this.tok(type, captures[1]);
- }
- },
-
- /**
- * Defer the given `tok`.
- *
- * @param {Object} tok
- * @api private
- */
-
- defer: function(tok){
- this.deferredTokens.push(tok);
- },
-
- /**
- * Lookahead `n` tokens.
- *
- * @param {Number} n
- * @return {Object}
- * @api private
- */
-
- lookahead: function(n){
- var fetch = n - this.stash.length;
- while (fetch-- > 0) this.stash.push(this.next());
- return this.stash[--n];
- },
-
- /**
- * Return the indexOf `start` / `end` delimiters.
- *
- * @param {String} start
- * @param {String} end
- * @return {Number}
- * @api private
- */
-
- indexOfDelimiters: function(start, end){
- var str = this.input
- , nstart = 0
- , nend = 0
- , pos = 0;
- for (var i = 0, len = str.length; i < len; ++i) {
- if (start == str[i]) {
- ++nstart;
- } else if (end == str[i]) {
- if (++nend == nstart) {
- pos = i;
- break;
- }
- }
- }
- return pos;
- },
-
- /**
- * Stashed token.
- */
-
- stashed: function() {
- return this.stash.length
- && this.stash.shift();
- },
-
- /**
- * Deferred token.
- */
-
- deferred: function() {
- return this.deferredTokens.length
- && this.deferredTokens.shift();
- },
-
- /**
- * end-of-source.
- */
-
- eos: function() {
- if (this.input.length) return;
- if (this.indentStack.length) {
- this.indentStack.shift();
- return this.tok('outdent');
- } else {
- return this.tok('eos');
- }
- },
-
- /**
- * Comment.
- */
-
- comment: function() {
- var captures;
- if (captures = /^ *\/\/(-)?([^\n]*)/.exec(this.input)) {
- this.consume(captures[0].length);
- var tok = this.tok('comment', captures[2]);
- tok.buffer = '-' != captures[1];
- return tok;
- }
- },
-
- /**
- * Tag.
- */
-
- tag: function() {
- var captures;
- if (captures = /^(\w[-:\w]*)/.exec(this.input)) {
- this.consume(captures[0].length);
- var tok, name = captures[1];
- if (':' == name[name.length - 1]) {
- name = name.slice(0, -1);
- tok = this.tok('tag', name);
- this.deferredTokens.push(this.tok(':'));
- while (' ' == this.input[0]) this.input = this.input.substr(1);
- } else {
- tok = this.tok('tag', name);
- }
- return tok;
- }
- },
-
- /**
- * Filter.
- */
-
- filter: function() {
- return this.scan(/^:(\w+)/, 'filter');
- },
-
- /**
- * Doctype.
- */
-
- doctype: function() {
- return this.scan(/^(?:!!!|doctype) *(\w+)?/, 'doctype');
- },
-
- /**
- * Id.
- */
-
- id: function() {
- return this.scan(/^#([\w-]+)/, 'id');
- },
-
- /**
- * Class.
- */
-
- className: function() {
- return this.scan(/^\.([\w-]+)/, 'class');
- },
-
- /**
- * Text.
- */
-
- text: function() {
- return this.scan(/^(?:\| ?)?([^\n]+)/, 'text');
- },
-
- /**
- * Include.
- */
-
- include: function() {
- return this.scan(/^include +([^\n]+)/, 'include');
- },
-
- /**
- * Mixin.
- */
-
- mixin: function(){
- var captures;
- if (captures = /^mixin +([-\w]+)(?:\(([^\)]+)\))?/.exec(this.input)) {
- this.consume(captures[0].length);
- var tok = this.tok('mixin', captures[1]);
- tok.args = captures[2];
- return tok;
- }
- },
-
- /**
- * Conditional.
- */
-
- conditional: function() {
- var captures;
- if (captures = /^(if|unless|else if|else)\b([^\n]*)/.exec(this.input)) {
- this.consume(captures[0].length);
- var type = captures[1]
- , js = captures[2];
-
- switch (type) {
- case 'if': js = 'if (' + js + ')'; break;
- case 'unless': js = 'if (!(' + js + '))'; break;
- case 'else if': js = 'else if (' + js + ')'; break;
- case 'else': js = 'else'; break;
- }
-
- return this.tok('code', js);
- }
- },
-
- /**
- * Each.
- */
-
- each: function() {
- var captures;
- if (captures = /^(?:- *)?(?:each|for) +(\w+)(?: *, *(\w+))? * in *([^\n]+)/.exec(this.input)) {
- this.consume(captures[0].length);
- var tok = this.tok('each', captures[1]);
- tok.key = captures[2] || 'index';
- tok.code = captures[3];
- return tok;
- }
- },
-
- /**
- * Code.
- */
-
- code: function() {
- var captures;
- if (captures = /^(!?=|-)([^\n]+)/.exec(this.input)) {
- this.consume(captures[0].length);
- var flags = captures[1];
- captures[1] = captures[2];
- var tok = this.tok('code', captures[1]);
- tok.escape = flags[0] === '=';
- tok.buffer = flags[0] === '=' || flags[1] === '=';
- return tok;
- }
- },
-
- /**
- * Attributes.
- */
-
- attrs: function() {
- if ('(' == this.input[0]) {
- var index = this.indexOfDelimiters('(', ')')
- , str = this.input.substr(1, index-1)
- , tok = this.tok('attrs')
- , len = str.length
- , colons = this.colons
- , states = ['key']
- , key = ''
- , val = ''
- , quote
- , c;
-
- function state(){
- return states[states.length - 1];
- }
-
- function interpolate(attr) {
- return attr.replace(/#\{([^}]+)\}/g, function(_, expr){
- return quote + " + (" + expr + ") + " + quote;
- });
- }
-
- this.consume(index + 1);
- tok.attrs = {};
-
- function parse(c) {
- var real = c;
- // TODO: remove when people fix ":"
- if (colons && ':' == c) c = '=';
- switch (c) {
- case ',':
- case '\n':
- switch (state()) {
- case 'expr':
- case 'array':
- case 'string':
- case 'object':
- val += c;
- break;
- default:
- states.push('key');
- val = val.trim();
- key = key.trim();
- if ('' == key) return;
- tok.attrs[key.replace(/^['"]|['"]$/g, '')] = '' == val
- ? true
- : interpolate(val);
- key = val = '';
- }
- break;
- case '=':
- switch (state()) {
- case 'key char':
- key += real;
- break;
- case 'val':
- case 'expr':
- case 'array':
- case 'string':
- case 'object':
- val += real;
- break;
- default:
- states.push('val');
- }
- break;
- case '(':
- if ('val' == state()) states.push('expr');
- val += c;
- break;
- case ')':
- if ('expr' == state()) states.pop();
- val += c;
- break;
- case '{':
- if ('val' == state()) states.push('object');
- val += c;
- break;
- case '}':
- if ('object' == state()) states.pop();
- val += c;
- break;
- case '[':
- if ('val' == state()) states.push('array');
- val += c;
- break;
- case ']':
- if ('array' == state()) states.pop();
- val += c;
- break;
- case '"':
- case "'":
- switch (state()) {
- case 'key':
- states.push('key char');
- break;
- case 'key char':
- states.pop();
- break;
- case 'string':
- if (c == quote) states.pop();
- val += c;
- break;
- default:
- states.push('string');
- val += c;
- quote = c;
- }
- break;
- case '':
- break;
- default:
- switch (state()) {
- case 'key':
- case 'key char':
- key += c;
- break;
- default:
- val += c;
- }
- }
- }
-
- for (var i = 0; i < len; ++i) {
- parse(str[i]);
- }
-
- parse(',');
-
- return tok;
- }
- },
-
- /**
- * Indent | Outdent | Newline.
- */
-
- indent: function() {
- var captures, re;
-
- // established regexp
- if (this.indentRe) {
- captures = this.indentRe.exec(this.input);
- // determine regexp
- } else {
- // tabs
- re = /^\n(\t*) */;
- captures = re.exec(this.input);
-
- // spaces
- if (captures && !captures[1].length) {
- re = /^\n( *)/;
- captures = re.exec(this.input);
- }
-
- // established
- if (captures && captures[1].length) this.indentRe = re;
- }
-
- if (captures) {
- var tok
- , indents = captures[1].length;
-
- ++this.lineno;
- this.consume(indents + 1);
-
- if (' ' == this.input[0] || '\t' == this.input[0]) {
- throw new Error('Invalid indentation, you can use tabs or spaces but not both');
- }
-
- // blank line
- if ('\n' == this.input[0]) return this.tok('newline');
-
- // outdent
- if (this.indentStack.length && indents < this.indentStack[0]) {
- while (this.indentStack.length && this.indentStack[0] > indents) {
- this.stash.push(this.tok('outdent'));
- this.indentStack.shift();
- }
- tok = this.stash.pop();
- // indent
- } else if (indents && indents != this.indentStack[0]) {
- this.indentStack.unshift(indents);
- tok = this.tok('indent', indents);
- // newline
- } else {
- tok = this.tok('newline');
- }
-
- return tok;
- }
- },
-
- /**
- * Pipe-less text consumed only when
- * pipeless is true;
- */
-
- pipelessText: function() {
- if (this.pipeless) {
- if ('\n' == this.input[0]) return;
- var i = this.input.indexOf('\n');
- if (-1 == i) i = this.input.length;
- var str = this.input.substr(0, i);
- this.consume(str.length);
- return this.tok('text', str);
- }
- },
-
- /**
- * ':'
- */
-
- colon: function() {
- return this.scan(/^: */, ':');
- },
-
- /**
- * Return the next token object, or those
- * previously stashed by lookahead.
- *
- * @return {Object}
- * @api private
- */
-
- advance: function(){
- return this.stashed()
- || this.next();
- },
-
- /**
- * Return the next token object.
- *
- * @return {Object}
- * @api private
- */
-
- next: function() {
- return this.deferred()
- || this.eos()
- || this.pipelessText()
- || this.doctype()
- || this.include()
- || this.mixin()
- || this.conditional()
- || this.each()
- || this.tag()
- || this.filter()
- || this.code()
- || this.id()
- || this.className()
- || this.attrs()
- || this.indent()
- || this.comment()
- || this.colon()
- || this.text();
- }
-};
-
-}); // module: lexer.js
-
-jade_require.register("nodes/block-comment.js", function(module, exports, jade_require){
-
-/*!
- * Jade - nodes - BlockComment
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var Node = jade_require('./node');
-
-/**
- * Initialize a `BlockComment` with the given `block`.
- *
- * @param {String} val
- * @param {Block} block
- * @param {Boolean} buffer
- * @api public
- */
-
-var BlockComment = module.exports = function BlockComment(val, block, buffer) {
- this.block = block;
- this.val = val;
- this.buffer = buffer;
-};
-
-/**
- * Inherit from `Node`.
- */
-
-BlockComment.prototype = new Node;
-BlockComment.prototype.constructor = BlockComment;
-
-}); // module: nodes/block-comment.js
-
-jade_require.register("nodes/block.js", function(module, exports, jade_require){
-
-/*!
- * Jade - nodes - Block
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var Node = jade_require('./node');
-
-/**
- * Initialize a new `Block` with an optional `node`.
- *
- * @param {Node} node
- * @api public
- */
-
-var Block = module.exports = function Block(node){
- this.nodes = [];
- if (node) this.push(node);
-};
-
-/**
- * Inherit from `Node`.
- */
-
-Block.prototype = new Node;
-Block.prototype.constructor = Block;
-
-
-/**
- * Pust the given `node`.
- *
- * @param {Node} node
- * @return {Number}
- * @api public
- */
-
-Block.prototype.push = function(node){
- return this.nodes.push(node);
-};
-
-/**
- * Unshift the given `node`.
- *
- * @param {Node} node
- * @return {Number}
- * @api public
- */
-
-Block.prototype.unshift = function(node){
- return this.nodes.unshift(node);
-};
-
-}); // module: nodes/block.js
-
-jade_require.register("nodes/code.js", function(module, exports, jade_require){
-
-/*!
- * Jade - nodes - Code
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var Node = jade_require('./node');
-
-/**
- * Initialize a `Code` node with the given code `val`.
- * Code may also be optionally buffered and escaped.
- *
- * @param {String} val
- * @param {Boolean} buffer
- * @param {Boolean} escape
- * @api public
- */
-
-var Code = module.exports = function Code(val, buffer, escape) {
- this.val = val;
- this.buffer = buffer;
- this.escape = escape;
- if (/^ *else/.test(val)) this.instrumentLineNumber = false;
-};
-
-/**
- * Inherit from `Node`.
- */
-
-Code.prototype = new Node;
-Code.prototype.constructor = Code;
-
-}); // module: nodes/code.js
-
-jade_require.register("nodes/comment.js", function(module, exports, jade_require){
-
-/*!
- * Jade - nodes - Comment
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var Node = jade_require('./node');
-
-/**
- * Initialize a `Comment` with the given `val`, optionally `buffer`,
- * otherwise the comment may render in the output.
- *
- * @param {String} val
- * @param {Boolean} buffer
- * @api public
- */
-
-var Comment = module.exports = function Comment(val, buffer) {
- this.val = val;
- this.buffer = buffer;
-};
-
-/**
- * Inherit from `Node`.
- */
-
-Comment.prototype = new Node;
-Comment.prototype.constructor = Comment;
-
-}); // module: nodes/comment.js
-
-jade_require.register("nodes/doctype.js", function(module, exports, jade_require){
-
-/*!
- * Jade - nodes - Doctype
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var Node = jade_require('./node');
-
-/**
- * Initialize a `Doctype` with the given `val`.
- *
- * @param {String} val
- * @api public
- */
-
-var Doctype = module.exports = function Doctype(val) {
- this.val = val;
-};
-
-/**
- * Inherit from `Node`.
- */
-
-Doctype.prototype = new Node;
-Doctype.prototype.constructor = Doctype;
-
-}); // module: nodes/doctype.js
-
-jade_require.register("nodes/each.js", function(module, exports, jade_require){
-
-/*!
- * Jade - nodes - Each
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var Node = jade_require('./node');
-
-/**
- * Initialize an `Each` node, representing iteration
- *
- * @param {String} obj
- * @param {String} val
- * @param {String} key
- * @param {Block} block
- * @api public
- */
-
-var Each = module.exports = function Each(obj, val, key, block) {
- this.obj = obj;
- this.val = val;
- this.key = key;
- this.block = block;
-};
-
-/**
- * Inherit from `Node`.
- */
-
-Each.prototype = new Node;
-Each.prototype.constructor = Each;
-
-}); // module: nodes/each.js
-
-jade_require.register("nodes/filter.js", function(module, exports, jade_require){
-
-/*!
- * Jade - nodes - Filter
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var Node = jade_require('./node')
- , Block = jade_require('./block');
-
-/**
- * Initialize a `Filter` node with the given
- * filter `name` and `block`.
- *
- * @param {String} name
- * @param {Block|Node} block
- * @api public
- */
-
-var Filter = module.exports = function Filter(name, block, attrs) {
- this.name = name;
- this.block = block;
- this.attrs = attrs;
- this.isASTFilter = block instanceof Block;
-};
-
-/**
- * Inherit from `Node`.
- */
-
-Filter.prototype = new Node;
-Filter.prototype.constructor = Filter;
-
-}); // module: nodes/filter.js
-
-jade_require.register("nodes/index.js", function(module, exports, jade_require){
-
-/*!
- * Jade - nodes
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-exports.Node = jade_require('./node');
-exports.Tag = jade_require('./tag');
-exports.Code = jade_require('./code');
-exports.Each = jade_require('./each');
-exports.Text = jade_require('./text');
-exports.Block = jade_require('./block');
-exports.Mixin = jade_require('./mixin');
-exports.Filter = jade_require('./filter');
-exports.Comment = jade_require('./comment');
-exports.Literal = jade_require('./literal');
-exports.BlockComment = jade_require('./block-comment');
-exports.Doctype = jade_require('./doctype');
-
-}); // module: nodes/index.js
-
-jade_require.register("nodes/literal.js", function(module, exports, jade_require){
-
-/*!
- * Jade - nodes - Literal
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var Node = jade_require('./node');
-
-/**
- * Initialize a `Literal` node with the given `str.
- *
- * @param {String} str
- * @api public
- */
-
-var Literal = module.exports = function Literal(str) {
- this.str = str;
-};
-
-/**
- * Inherit from `Node`.
- */
-
-Literal.prototype = new Node;
-Literal.prototype.constructor = Literal;
-
-
-}); // module: nodes/literal.js
-
-jade_require.register("nodes/mixin.js", function(module, exports, jade_require){
-
-/*!
- * Jade - nodes - Mixin
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var Node = jade_require('./node');
-
-/**
- * Initialize a new `Mixin` with `name` and `block`.
- *
- * @param {String} name
- * @param {String} args
- * @param {Block} block
- * @api public
- */
-
-var Mixin = module.exports = function Mixin(name, args, block){
- this.name = name;
- this.args = args;
- this.block = block;
-};
-
-/**
- * Inherit from `Node`.
- */
-