Skip to content

Commit

Permalink
Renamed to marko
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-steele-idem committed Sep 19, 2014
1 parent e5f7e7c commit 36a51b0
Show file tree
Hide file tree
Showing 313 changed files with 391 additions and 476 deletions.
196 changes: 98 additions & 98 deletions README.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions bin/markoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env node
require('./markoc.js');
14 changes: 7 additions & 7 deletions bin/rhtmlc.js → bin/markoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ var args = require('raptor-args').createParser({
},
'--clean -c': {
type: 'boolean',
description: 'Clean all of the *.rhtml.js files'
description: 'Clean all of the *.marko.js files'
}
})
.usage('Usage: $0 <pattern> [options]')
.example('Compile a single template', '$0 template.rhtml')
.example('Compile a single template', '$0 template.marko')
.example('Compile all templates in the current directory', '$0 .')
.example('Compile multiple templates', '$0 template.rhtml src/ foo/')
.example('Delete all *.rhtml.js files in the current directory', '$0 . --clean')
.example('Compile multiple templates', '$0 template.marko src/ foo/')
.example('Delete all *.marko.js files in the current directory', '$0 . --clean')
.validate(function(result) {
if (result.help) {
this.printUsage();
Expand Down Expand Up @@ -210,7 +210,7 @@ if (args.clean) {
file: function(file, context) {
var basename = nodePath.basename(file);

if (basename.endsWith('.rhtml.js') || basename.endsWith('.rxml.js')) {
if (basename.endsWith('.marko.js') || basename.endsWith('.marko.xml.js')) {
context.beginAsync();
fs.unlink(file, function(err) {
if (err) {
Expand All @@ -227,7 +227,7 @@ if (args.clean) {
},
function(err) {
if (deleteCount === 0) {
console.log('No *.rhtml.js files were found. Already clean.');
console.log('No *.marko.js files were found. Already clean.');
} else {
console.log('Deleted ' + deleteCount + ' file(s)');
}
Expand Down Expand Up @@ -282,7 +282,7 @@ if (args.clean) {
file: function(file, context) {
var basename = nodePath.basename(file);

if (basename.endsWith('.rhtml') || basename.endsWith('.rxml')) {
if (basename.endsWith('.marko') || basename.endsWith('.marko.xml')) {
compile(file, context);
}
}
Expand Down
2 changes: 0 additions & 2 deletions bin/rhtmlc

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ exports.TemplateCompiler = require('./TemplateCompiler');
exports.taglibs = require('./taglibs');
exports.taglibs.excludeDir(nodePath.join(__dirname, '../'));

exports.taglibs.registerTaglib(require.resolve('../taglibs/core/raptor-taglib.json'));
exports.taglibs.registerTaglib(require.resolve('../taglibs/html/raptor-taglib.json'));
exports.taglibs.registerTaglib(require.resolve('../taglibs/caching/raptor-taglib.json'));
exports.taglibs.registerTaglib(require.resolve('raptor-taglib-layout/raptor-taglib.json'));
exports.taglibs.registerTaglib(require.resolve('raptor-taglib-async/raptor-taglib.json'));
exports.taglibs.registerTaglib(require.resolve('../taglibs/core/marko-taglib.json'));
exports.taglibs.registerTaglib(require.resolve('../taglibs/html/marko-taglib.json'));
exports.taglibs.registerTaglib(require.resolve('../taglibs/caching/marko-taglib.json'));
exports.taglibs.registerTaglib(require.resolve('marko-taglib-layout/marko-taglib.json'));
exports.taglibs.registerTaglib(require.resolve('marko-taglib-async/marko-taglib.json'));
2 changes: 1 addition & 1 deletion compiler/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"main": "./raptor-templates-compiler.js"
"main": "./marko-compiler.js"
}
2 changes: 1 addition & 1 deletion compiler/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var ParseTreeBuilderHtml = require('./ParseTreeBuilderHtml');
var ParseTreeBuilderXml = require('./ParseTreeBuilderXml');

function parse(src, filePath, taglibs) {
var ParseTreeBuilder = filePath.endsWith('.rxml') ?
var ParseTreeBuilder = filePath.endsWith('.marko.xml') ?
ParseTreeBuilderXml :
ParseTreeBuilderHtml;

Expand Down
8 changes: 4 additions & 4 deletions compiler/taglibs/taglib-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,18 +251,18 @@ function scanTagsDir(tagsConfigPath, tagsConfigDirname, dir, taglib) {
continue;
}
var tagDirname = nodePath.join(dir, childFilename);
var tagFile = nodePath.join(dir, childFilename, 'raptor-tag.json');
var tagFile = nodePath.join(dir, childFilename, 'marko-tag.json');
var tag = null;
var rendererFile = nodePath.join(dir, childFilename, 'renderer.js');
var templateFile = nodePath.join(dir, childFilename, 'template.rhtml');
var templateFile = nodePath.join(dir, childFilename, 'template.marko');
var tagDef = null;

// Record dependencies so that we can check if a template is up-to-date
taglib.addInputFile(tagFile);
taglib.addInputFile(rendererFile);

if (fs.existsSync(tagFile)) {
// raptor-tag.json exists in the directory, use that as the tag definition
// marko-tag.json exists in the directory, use that as the tag definition
tagDef = JSON.parse(fs.readFileSync(tagFile, {encoding: 'utf8'}));
if (!tagDef.renderer || !tagDef.template) {
if (fs.existsSync(rendererFile)) {
Expand All @@ -278,7 +278,7 @@ function scanTagsDir(tagsConfigPath, tagsConfigDirname, dir, taglib) {
tag.name = childFilename;
taglib.addTag(tag);
} else {
// raptor-tag.json does *not* exist... checking for a 'renderer.js'
// marko-tag.json does *not* exist... checking for a 'renderer.js'


if (fs.existsSync(rendererFile)) {
Expand Down
4 changes: 2 additions & 2 deletions compiler/taglibs/taglib-lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function existsCached(path) {
}

function tryDir(dirname, discovered) {
var taglibPath = nodePath.join(dirname, 'raptor-taglib.json');
var taglibPath = nodePath.join(dirname, 'marko-taglib.json');
if (existsCached(taglibPath)) {
var taglib = taglibLoader.load(taglibPath);

Expand Down Expand Up @@ -51,7 +51,7 @@ function tryNodeModules(parent, discovered) {
var children = fs.readdirSync(nodeModulesDir);
children.forEach(function(moduleDirBasename) {
var moduleDir = nodePath.join(nodeModulesDir, moduleDirBasename);
var taglibPath = nodePath.join(moduleDir, 'raptor-taglib.json');
var taglibPath = nodePath.join(moduleDir, 'marko-taglib.json');


if (existsCached(taglibPath)) {
Expand Down
4 changes: 2 additions & 2 deletions migration.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Raptor Templates Migration Guide
Marko Migration Guide
================================

# Migration from XML-based Raptor Templates
# Migration from XML-based Marko


# Migration from Dust
Expand Down
19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "raptor-templates",
"description": "Raptor Templates",
"name": "marko",
"description": "Marko is an extensible, streaming, asynchronous, high performance, HTML-based templating language that can be used in Node.js or in the browser.",
"keywords": [
"templating",
"template",
Expand All @@ -9,7 +9,7 @@
],
"repository": {
"type": "git",
"url": "https://github.com/raptorjs3/raptor-templates.git"
"url": "https://github.com/raptorjs3/marko.git"
},
"scripts": {
"test": "node_modules/.bin/mocha --ui bdd --reporter spec ./test && node_modules/.bin/jshint compiler/ runtime/ taglibs/"
Expand All @@ -33,8 +33,8 @@
"raptor-regexp": "^1.0.0-beta",
"raptor-render-context": "^1.0.0-beta",
"raptor-strings": "^1.0.0-beta",
"raptor-taglib-async": "^1.0.0-beta",
"raptor-taglib-layout": "^1.0.0-beta",
"marko-taglib-async": "^1.0.0-beta",
"marko-taglib-layout": "^1.0.0-beta",
"raptor-util": "^1.0.0-beta",
"sax": "^0.6.0"
},
Expand All @@ -49,12 +49,11 @@
},
"license": "Apache License v2.0",
"bin": {
"rhtmlc": "bin/rhtmlc"
"markoc": "bin/markoc"
},
"main": "runtime/raptor-templates-runtime.js",
"main": "runtime/marko-runtime.js",
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"ebay": {},
"version": "1.1.26-beta"
}
"version": "1.2.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* This module provides the runtime for rendering compiled templates.
*
*
* <p>The code for the Raptor Templates compiler is kept separately
* <p>The code for the Marko compiler is kept separately
* in the {@link raptor/templating/compiler} module.
*/
var renderContext = require('raptor-render-context');
Expand Down
2 changes: 1 addition & 1 deletion runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"main": "./raptor-templates-runtime.js",
"main": "./marko-runtime.js",
"browser": {
"./loader.js": "./loader_browser.js"
}
Expand Down
6 changes: 3 additions & 3 deletions taglibs/caching/cached-fragment-tag.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
var raptorCache;
var defaultCacheManager;
var req = require; // Fool the raptor-optimizer
var req = require; // Fool the optimizer


module.exports = {
Expand All @@ -17,7 +17,7 @@ module.exports = {
defaultCacheManager = raptorCache.createCacheManager({
profiles: {
'*': {
'raptor-templates/cached-fragment': {
'marko/cached-fragment': {
store: 'memory',
encoding: 'utf8'
}
Expand All @@ -33,7 +33,7 @@ module.exports = {

var cacheManager = input.cacheManager || defaultCacheManager;

var cache = cacheManager.getCache(input.cacheName || 'raptor-templates/cached-fragment');
var cache = cacheManager.getCache(input.cacheName || 'marko/cached-fragment');

var asyncContext = context.beginAsync();

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test-render-rhtml.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
node_modules/.bin/mocha --ui bdd --reporter spec ./test/render-rhtml-tests.js
node_modules/.bin/mocha --ui bdd --reporter spec ./test/render-marko-tests.js
2 changes: 1 addition & 1 deletion test-render-rxml.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
node_modules/.bin/mocha --ui bdd --reporter spec ./test/render-rxml-tests.js
node_modules/.bin/mocha --ui bdd --reporter spec ./test/render-xml-tests.js
4 changes: 2 additions & 2 deletions test/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*.rhtml.js
*.rxml.js
*.marko.js
*.marko.xml.js
*.actual.js
*.actual.html
24 changes: 12 additions & 12 deletions test/api-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var nodePath = require('path');
var raptorTemplates = require('../');
var through = require('through');

describe('raptor-templates/api' , function() {
describe('marko/api' , function() {

before(function() {
require('../compiler').defaultOptions.checkUpToDate = false;
Expand All @@ -20,7 +20,7 @@ describe('raptor-templates/api' , function() {

it('should allow a template to be rendered using a callback', function(done) {
raptorTemplates.render(
nodePath.join(__dirname, 'test-project/hello.rhtml'),
nodePath.join(__dirname, 'test-project/hello.marko'),
{
name: 'John'
},
Expand All @@ -46,7 +46,7 @@ describe('raptor-templates/api' , function() {
});

raptorTemplates.render(
nodePath.join(__dirname, 'test-project/hello.rhtml'),
nodePath.join(__dirname, 'test-project/hello.marko'),
{
name: 'John'
},
Expand All @@ -73,7 +73,7 @@ describe('raptor-templates/api' , function() {
});

raptorTemplates.render(
nodePath.join(__dirname, 'test-project/hello.rhtml'),
nodePath.join(__dirname, 'test-project/hello.marko'),
{
name: 'John'
},
Expand All @@ -92,7 +92,7 @@ describe('raptor-templates/api' , function() {


raptorTemplates.stream(
nodePath.join(__dirname, 'test-project/hello.rhtml'),
nodePath.join(__dirname, 'test-project/hello.marko'),
{
name: 'John'
})
Expand All @@ -110,7 +110,7 @@ describe('raptor-templates/api' , function() {
/// TEMPLATE LOADING:

it('should allow a template to be loaded and rendered using a callback', function(done) {
var template = raptorTemplates.load(nodePath.join(__dirname, 'test-project/hello.rhtml'));
var template = raptorTemplates.load(nodePath.join(__dirname, 'test-project/hello.marko'));
template.render({
name: 'John'
},
Expand All @@ -135,7 +135,7 @@ describe('raptor-templates/api' , function() {
done(e);
});

var template = raptorTemplates.load(nodePath.join(__dirname, 'test-project/hello.rhtml'));
var template = raptorTemplates.load(nodePath.join(__dirname, 'test-project/hello.marko'));
template.render({
name: 'John'
},
Expand All @@ -162,7 +162,7 @@ describe('raptor-templates/api' , function() {
done(e);
});

var template = raptorTemplates.load(nodePath.join(__dirname, 'test-project/hello.rhtml'));
var template = raptorTemplates.load(nodePath.join(__dirname, 'test-project/hello.marko'));
template.render({
name: 'John'
},
Expand All @@ -172,7 +172,7 @@ describe('raptor-templates/api' , function() {
});

it('should allow a template to be loaded and rendered to a stream', function(done) {
var template = raptorTemplates.load(nodePath.join(__dirname, 'test-project/hello.rhtml'));
var template = raptorTemplates.load(nodePath.join(__dirname, 'test-project/hello.marko'));

var output = '';
var outStream = through(function write(data) {
Expand All @@ -194,13 +194,13 @@ describe('raptor-templates/api' , function() {
});

it('should allow a template to be rendered to a string synchronously using renderSync', function() {
var template = raptorTemplates.load(nodePath.join(__dirname, 'test-project/hello.rhtml'));
var template = raptorTemplates.load(nodePath.join(__dirname, 'test-project/hello.marko'));
var output = template.renderSync({ name: 'John' });
expect(output).to.equal('Hello John!');
});

it('should throw an error if beginAsync is used with renderSync', function() {
var template = raptorTemplates.load(nodePath.join(__dirname, 'test-project/hello-async.rhtml'));
var template = raptorTemplates.load(nodePath.join(__dirname, 'test-project/hello-async.marko'));
var output;
var e;

Expand All @@ -221,7 +221,7 @@ describe('raptor-templates/api' , function() {
});

it('should throw errors correctly with renderSync', function() {
var template = raptorTemplates.load(nodePath.join(__dirname, 'test-project/hello-error.rhtml'));
var template = raptorTemplates.load(nodePath.join(__dirname, 'test-project/hello-error.marko'));
var output;
var e;

Expand Down
14 changes: 7 additions & 7 deletions test/compiler-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function testCompiler(path) {
}
}

describe('raptor-templates/compiler' , function() {
describe('marko/compiler' , function() {

beforeEach(function(done) {
for (var k in require.cache) {
Expand All @@ -43,30 +43,30 @@ describe('raptor-templates/compiler' , function() {
}

require('raptor-logging').configureLoggers({
'raptor-templates': 'INFO'
'marko': 'INFO'
});

done();
});

it('should compile a simple template', function() {
testCompiler('test-project/simple.rhtml');
testCompiler('test-project/simple.marko');
});

it('should compile a simple template with custom tag', function() {
testCompiler('test-project/custom-tag.rhtml');
testCompiler('test-project/custom-tag.marko');
});

it('should compile a simple template with expressions', function() {
testCompiler('test-project/hello-dynamic.rhtml');
testCompiler('test-project/hello-dynamic.marko');
});

// it.only('should compile a template with <c:invoke>', function() {
// testCompiler('test-project/tabs.rhtml');
// testCompiler('test-project/tabs.marko');
// });

// it('should compile a template with <c:include>', function() {
// testCompiler('test-project/test-templates/include.rhtml');
// testCompiler('test-project/test-templates/include.marko');
// });


Expand Down
Loading

0 comments on commit 36a51b0

Please sign in to comment.