if (global.jasmine) return; require.paths.push(__dirname + "/../../lib"); require.paths.push(__dirname + '/../src'); var jasmine = require('jasmine-1.0.1'); var sys = require('util'); for(var key in jasmine) { global[key] = jasmine[key]; } //Patch Jasmine for proper stack traces jasmine.Spec.prototype.fail = function (e) { var expectationResult = new jasmine.ExpectationResult({ passed: false, message: e ? jasmine.util.formatException(e) : 'Exception' }); // PATCH if (e) { expectationResult.trace = e; } this.results_.addResult(expectationResult); }; var isVerbose = false; var showColors = true; process.argv.forEach(function(arg){ switch(arg) { case '--color': showColors = true; break; case '--noColor': showColors = false; break; case '--verbose': isVerbose = true; break; } }); jasmine.executeSpecsInFolder(__dirname, function(runner, log){ process.exit(runner.results().failedCount); }, isVerbose, showColors); docs-at-symbol-HTML-entity-to-character'>nganimate-docs-at-symbol-HTML-entity-to-character
aboutsummaryrefslogtreecommitdiffstats
path: root/docs/src/SiteMap.js
blob: c2b1ec92a9f5e7f0e69a31e4182dc92c73e17632 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
exports.SiteMap = SiteMap;

/**
 * @see http://www.sitemaps.org/protocol.php
 *
 * @param docs
 * @returns {SiteMap}
 */
function SiteMap(docs){
  this.render = function(){
    var map = [];
    map.push('<?xml version="1.0" encoding="UTF-8"?>');
    map.push('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
    docs.forEach(function(doc){
      map.push(' <url><loc>http://docs.angularjs.org/#!' +
          encode(doc.name) + '</loc><changefreq>weekly</changefreq></url>');
    });
    map.push('</urlset>');
    map.push('');
    return map.join('\n');
  };

  function encode(text){
    return text
      .replace(/&/mg, '&amp;')
      .replace(/</mg, '&lt;')
      .replace(/>/mg, '&gt;')
      .replace(/'/mg, '&apos;')
      .replace(/"/mg, '&quot;');
  }
}