pull/282/head
doertedev 9 years ago
commit 2ddc301eac

@ -3,7 +3,6 @@
DevDocs combines multiple API documentations in a fast, organized, and searchable interface. DevDocs combines multiple API documentations in a fast, organized, and searchable interface.
* Created by [Thibaut Courouble](http://thibaut.me) * Created by [Thibaut Courouble](http://thibaut.me)
* Supported by [JetBrains](http://out.devdocs.io/s/jetbrains) and [Code School](http://out.devdocs.io/s/code-school)
Keep track of development and community news: Keep track of development and community news:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

@ -116,7 +116,6 @@
visitCount = @settings.get('count') visitCount = @settings.get('count')
@settings.set 'count', ++visitCount @settings.set 'count', ++visitCount
new app.views.Notif 'Share', autoHide: null if visitCount is 5 new app.views.Notif 'Share', autoHide: null if visitCount is 5
new app.views.Notif 'Thanks', autoHide: null if visitCount is 10
new app.views.News() new app.views.News()
@updateChecker = new app.UpdateChecker() @updateChecker = new app.UpdateChecker()

@ -1,5 +1,8 @@
[ [
[ [
"2015-11-08",
"New documentations: <a href=\"/elixir/\">Elixir</a> and <a href=\"/vagrant/\">Vagrant</a>"
], [
"2015-10-18", "2015-10-18",
"Added a \"Copy to clipboard\" button inside each code block." "Added a \"Copy to clipboard\" button inside each code block."
], [ ], [

@ -32,15 +32,6 @@ app.templates.notifShare = ->
<a href="http://out.devdocs.io/s/tw" target="_blank">Twitter</a>, <a href="http://out.devdocs.io/s/fb" target="_blank">Facebook</a>, <a href="http://out.devdocs.io/s/tw" target="_blank">Twitter</a>, <a href="http://out.devdocs.io/s/fb" target="_blank">Facebook</a>,
<a href="http://out.devdocs.io/s/re" target="_blank">Reddit</a>, etc.<br>Thanks :) """ <a href="http://out.devdocs.io/s/re" target="_blank">Reddit</a>, etc.<br>Thanks :) """
app.templates.notifThanks = ->
textNotif """ Hi there! """,
""" <p class="_notif-text">Like DevDocs? Check out these awesome companies who are making it possible:
<ul class="_notif-list">
<li><a href="http://out.devdocs.io/s/jetbrains" target="_blank">JetBrains</a> We make software development a more productive and enjoyable experience through smart IDEs and code editors.
<li><a href="http://out.devdocs.io/s/code-school" target="_blank">Code School</a> Learn new skills from the comfort of your own browser. Offering more than 45 courses covering JavaScript, HTML/CSS, Ruby, Git, and iOS for only $29/month.
</ul>
<p class="_notif-text">Have a great day :) """
app.templates.notifUpdateDocs = -> app.templates.notifUpdateDocs = ->
textNotif """ Documentation updates available. """, textNotif """ Documentation updates available. """,
""" <a href="/offline">Install them</a> as soon as possible to avoid broken pages. """ """ <a href="/offline">Install them</a> as soon as possible to avoid broken pages. """

@ -13,7 +13,6 @@ app.templates.aboutPage = -> """
<p>DevDocs combines multiple API documentations in a fast, organized, and searchable interface. <p>DevDocs combines multiple API documentations in a fast, organized, and searchable interface.
<ul> <ul>
<li>Created and maintained by <a href="http://thibaut.me">Thibaut Courouble</a> <li>Created and maintained by <a href="http://thibaut.me">Thibaut Courouble</a>
<li>Supported by <a href="http://out.devdocs.io/s/jetbrains">JetBrains</a> and <a href="http://out.devdocs.io/s/code-school">Code School</a>
<li>Free and <a href="https://github.com/Thibaut/devdocs">open source</a> <li>Free and <a href="https://github.com/Thibaut/devdocs">open source</a>
<iframe class="_github-btn" src="https://ghbtns.com/github-btn.html?user=Thibaut&repo=devdocs&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="100" height="20"></iframe> <iframe class="_github-btn" src="https://ghbtns.com/github-btn.html?user=Thibaut&repo=devdocs&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="100" height="20"></iframe>
</ul> </ul>
@ -31,7 +30,7 @@ app.templates.aboutPage = -> """
<p><strong>Special thanks to:</strong> <p><strong>Special thanks to:</strong>
<ul> <ul>
<li><a href="http://out.devdocs.io/s/maxcdn">MaxCDN</a> and <a href="http://get.gaug.es/?utm_source=devdocs&utm_medium=referral&utm_campaign=sponsorships" title="Real Time Web Analytics">Gauges</a> for offering a free account to DevDocs <li><a href="http://out.devdocs.io/s/maxcdn">MaxCDN</a> and <a href="http://get.gaug.es/?utm_source=devdocs&utm_medium=referral&utm_campaign=sponsorships" title="Real Time Web Analytics">Gauges</a> for offering a free account to DevDocs
<li><a href="http://out.devdocs.io/s/shopify">Shopify</a> for supporting DevDocs in the past <li><a href="http://out.devdocs.io/s/maxcdn">MaxCDN</a>, <a href="http://out.devdocs.io/s/shopify">Shopify</a>, <a href="http://out.devdocs.io/s/jetbrains">JetBrains</a> and <a href="http://out.devdocs.io/s/code-school">Code School</a> for sponsoring DevDocs in the past
<li><a href="https://www.heroku.com">Heroku</a> and <a href="http://newrelic.com">New Relic</a> for providing awesome free service <li><a href="https://www.heroku.com">Heroku</a> and <a href="http://newrelic.com">New Relic</a> for providing awesome free service
<li>Daniel Bruce for the <a href="http://www.entypo.com">Entypo</a> pictograms <li>Daniel Bruce for the <a href="http://www.entypo.com">Entypo</a> pictograms
<li><a href="http://www.jeremykratz.com/">Jeremy Kratz</a> for the C/C++ logo <li><a href="http://www.jeremykratz.com/">Jeremy Kratz</a> for the C/C++ logo
@ -145,6 +144,11 @@ credits = [
'2015 Yehuda Katz, Tom Dale and Ember.js contributors', '2015 Yehuda Katz, Tom Dale and Ember.js contributors',
'MIT', 'MIT',
'https://raw.github.com/emberjs/ember.js/master/LICENSE' 'https://raw.github.com/emberjs/ember.js/master/LICENSE'
], [
'Elixir',
'2012 Plataformatec',
'Apache',
'https://raw.githubusercontent.com/elixir-lang/elixir/master/LICENSE'
], [ ], [
'Express', 'Express',
'2009-2015 TJ Holowaychuk', '2009-2015 TJ Holowaychuk',
@ -264,7 +268,7 @@ credits = [
'Node.js', 'Node.js',
'Joyent, Inc. and other Node contributors<br>Node.js is a trademark of Joyent, Inc.', 'Joyent, Inc. and other Node contributors<br>Node.js is a trademark of Joyent, Inc.',
'MIT', 'MIT',
'https://raw.github.com/joyent/node/master/LICENSE' 'https://raw.githubusercontent.com/nodejs/node/master/LICENSE'
], [ ], [
'Nokogiri', 'Nokogiri',
'2008-2014 2014 Aaron Patterson, Mike Dalessio, Charles Nutter, Sergio Arbeo, Patrick Mahoney, Yoko Harada, Akinori Musha', '2008-2014 2014 Aaron Patterson, Mike Dalessio, Charles Nutter, Sergio Arbeo, Patrick Mahoney, Yoko Harada, Akinori Musha',
@ -375,6 +379,11 @@ credits = [
'2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors', '2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors',
'MIT', 'MIT',
'https://raw.github.com/jashkenas/underscore/master/LICENSE' 'https://raw.github.com/jashkenas/underscore/master/LICENSE'
], [
'Vagrant',
'2010-2015 Mitchell Hashimoto',
'MIT',
'https://raw.githubusercontent.com/mitchellh/vagrant/master/LICENSE'
], [ ], [
'Vue.js', 'Vue.js',
'2013-2015 Evan You, Vue.js contributors', '2013-2015 Evan You, Vue.js contributors',

@ -1,47 +1,4 @@
jetBrainsLink = (className) -> app.templates.splash = """<div class="_splash-title">DevDocs</div>"""
type = jetBrainsType()
path = "/#{type}" if type
"""
<a href="http://out.devdocs.io/s/jetbrains#{path || ''}" class="#{className}">
<span class="_logo-thx _jetbrains-logo">JetBrains</span>
<span class="_logo-info">#{JETBRAINS_INFO[type || 'default']}</span>
</a>
"""
JETBRAINS_INFO =
ruby: 'Developing in Ruby? Boost your productivity with RubyMine, a powerful IDE with smart coding assistance and advanced testing and debugging features.'
python: 'Developing in Python? Enjoy productive development with PyCharm, an intelligent Python IDE offering unique coding experience.'
c: 'Developing in C? Now benefit from CLion, a C/C++ IDE enhancing your productivity with on-thy-fly static analysis and automated refactorings.'
web: 'Doing client-side development? Try WebStorm, an IDE that really understands JavaScript and modern frameworks like AngularJS and boosts your productivity.'
default: 'JetBrains makes software development a more productive and enjoyable experience through smart IDEs and code editors.'
jetBrainsType = ->
docs = if app.settings then app.settings.getDocs() else []
if docs.indexOf('ruby') != -1
'ruby'
else if docs.indexOf('python') != -1 || docs.indexOf('python2') != -1
'python'
else if docs.indexOf('c') != -1 or docs.indexOf('cpp') != -1
'c'
else if docs.indexOf('javascript') != -1 or docs.indexOf('jquery') != -1
'web'
codeSchoolLink = (className) -> """
<a href="http://out.devdocs.io/s/code-school" class="#{className}">
<span class="_logo-thx _code-school-logo">Code School</span>
<span class="_logo-info">With more than 45 courses covering JavaScript, HTML/CSS, Ruby, Git, and iOS, Code School pairs experienced instructors with engaging content. Start learning at codeschool.com.</span>
</a>
"""
app.templates.splash = -> """
<div class="_splash-title">DevDocs</div>
<div class="_splash-sponsors">
#{jetBrainsLink '_splash-sponsor'}
#{codeSchoolLink '_splash-sponsor'}
</div>
"""
<% if App.development? %> <% if App.development? %>
app.templates.intro = """ app.templates.intro = """
@ -63,8 +20,6 @@ app.templates.intro = """
<a href="https://github.com/Thibaut/devdocs/blob/master/LICENSE">LICENSE</a> files. <a href="https://github.com/Thibaut/devdocs/blob/master/LICENSE">LICENSE</a> files.
<li>If you like the app, please consider supporting the project on <a href="https://gratipay.com/devdocs/">Gratipay</a>. Thanks! <li>If you like the app, please consider supporting the project on <a href="https://gratipay.com/devdocs/">Gratipay</a>. Thanks!
</ol> </ol>
<p class="_intro-sponsors">
#{jetBrainsLink '_intro-sponsor'} #{codeSchoolLink '_intro-sponsor'}
<p>Happy coding! <p>Happy coding!
</div></div> </div></div>
""" """
@ -87,8 +42,6 @@ app.templates.intro = """
<iframe class="_github-btn" src="//ghbtns.com/github-btn.html?user=Thibaut&repo=devdocs&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="100" height="20"></iframe> <iframe class="_github-btn" src="//ghbtns.com/github-btn.html?user=Thibaut&repo=devdocs&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="100" height="20"></iframe>
<li>If you like the app, please consider supporting the project on <a href="https://gratipay.com/devdocs/">Gratipay</a>. Thanks! <li>If you like the app, please consider supporting the project on <a href="https://gratipay.com/devdocs/">Gratipay</a>. Thanks!
</ol> </ol>
<p class="_intro-sponsors">
#{jetBrainsLink '_intro-sponsor'} #{codeSchoolLink '_intro-sponsor'}
<p>Happy coding! <p>Happy coding!
</div></div> </div></div>
""" """
@ -116,7 +69,6 @@ app.templates.mobileIntro = """
<li>DevDocs is <a href="https://github.com/Thibaut/devdocs">open source</a> <li>DevDocs is <a href="https://github.com/Thibaut/devdocs">open source</a>
</ol> </ol>
<p>Happy coding! <p>Happy coding!
<p class="_intro-sponsors">#{jetBrainsLink '_intro-sponsor'} #{codeSchoolLink '_intro-sponsor'}</p>
<a class="_intro-hide" data-hide-intro>Stop showing this message</a> <a class="_intro-hide" data-hide-intro>Stop showing this message</a>
</div> </div>
""" """

@ -1,5 +1,5 @@
/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+c+cpp+coffeescript+php+python+ruby+rust */ /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+c+cpp+coffeescript+ruby+elixir+php+python+rust */
self = (typeof window !== 'undefined') var _self = (typeof window !== 'undefined')
? window // if in browser ? window // if in browser
: ( : (
(typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
@ -18,7 +18,7 @@ var Prism = (function(){
// Private helper vars // Private helper vars
var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i; var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i;
var _ = self.Prism = { var _ = _self.Prism = {
util: { util: {
encode: function (tokens) { encode: function (tokens) {
if (tokens instanceof Token) { if (tokens instanceof Token) {
@ -51,7 +51,8 @@ var _ = self.Prism = {
return clone; return clone;
case 'Array': case 'Array':
return o.map(function(v) { return _.util.clone(v); }); // Check for existence for IE8
return o.map && o.map(function(v) { return _.util.clone(v); });
} }
return o; return o;
@ -140,6 +141,7 @@ var _ = self.Prism = {
} }
} }
}, },
plugins: {},
highlightAll: function(async, callback) { highlightAll: function(async, callback) {
var elements = document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'); var elements = document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');
@ -162,10 +164,6 @@ var _ = self.Prism = {
grammar = _.languages[language]; grammar = _.languages[language];
} }
if (!grammar) {
return;
}
// Set language on the element, if not present // Set language on the element, if not present
element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language; element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
@ -178,12 +176,6 @@ var _ = self.Prism = {
var code = element.textContent; var code = element.textContent;
if(!code) {
return;
}
code = code.replace(/^(?:\r?\n|\r)/,'');
var env = { var env = {
element: element, element: element,
language: language, language: language,
@ -191,13 +183,18 @@ var _ = self.Prism = {
code: code code: code
}; };
if (!code || !grammar) {
_.hooks.run('complete', env);
return;
}
_.hooks.run('before-highlight', env); _.hooks.run('before-highlight', env);
// if (async && self.Worker) { // if (async && _self.Worker) {
// var worker = new Worker(_.filename); // var worker = new Worker(_.filename);
// worker.onmessage = function(evt) { // worker.onmessage = function(evt) {
// env.highlightedCode = Token.stringify(JSON.parse(evt.data), language); // env.highlightedCode = evt.data;
// _.hooks.run('before-insert', env); // _.hooks.run('before-insert', env);
@ -205,11 +202,13 @@ var _ = self.Prism = {
// callback && callback.call(env.element); // callback && callback.call(env.element);
// _.hooks.run('after-highlight', env); // _.hooks.run('after-highlight', env);
// _.hooks.run('complete', env);
// }; // };
// worker.postMessage(JSON.stringify({ // worker.postMessage(JSON.stringify({
// language: env.language, // language: env.language,
// code: env.code // code: env.code,
// immediateClose: true
// })); // }));
// } // }
// else { // else {
@ -222,6 +221,7 @@ var _ = self.Prism = {
callback && callback.call(element); callback && callback.call(element);
_.hooks.run('after-highlight', env); _.hooks.run('after-highlight', env);
_.hooks.run('complete', env);
// } // }
}, },
@ -380,29 +380,32 @@ Token.stringify = function(o, language, parent) {
var attributes = ''; var attributes = '';
for (var name in env.attributes) { for (var name in env.attributes) {
attributes += name + '="' + (env.attributes[name] || '') + '"'; attributes += (attributes ? ' ' : '') + name + '="' + (env.attributes[name] || '') + '"';
} }
return '<' + env.tag + ' class="' + env.classes.join(' ') + '" ' + attributes + '>' + env.content + '</' + env.tag + '>'; return '<' + env.tag + ' class="' + env.classes.join(' ') + '" ' + attributes + '>' + env.content + '</' + env.tag + '>';
}; };
// if (!self.document) { // if (!_self.document) {
// if (!self.addEventListener) { // if (!_self.addEventListener) {
// // in Node.js // // in Node.js
// return self.Prism; // return _self.Prism;
// } // }
// // In worker // // In worker
// self.addEventListener('message', function(evt) { // _self.addEventListener('message', function(evt) {
// var message = JSON.parse(evt.data), // var message = JSON.parse(evt.data),
// lang = message.language, // lang = message.language,
// code = message.code; // code = message.code,
// immediateClose = message.immediateClose;
// self.postMessage(JSON.stringify(_.util.encode(_.tokenize(code, _.languages[lang])))); // _self.postMessage(_.highlight(code, _.languages[lang], lang));
// self.close(); // if (immediateClose) {
// _self.close();
// }
// }, false); // }, false);
// return self.Prism; // return _self.Prism;
// } // }
// // Get current script and highlight // // Get current script and highlight
@ -418,40 +421,45 @@ Token.stringify = function(o, language, parent) {
// } // }
// } // }
return self.Prism; return _self.Prism;
})(); })();
if (typeof module !== 'undefined' && module.exports) { if (typeof module !== 'undefined' && module.exports) {
module.exports = Prism; module.exports = Prism;
} }
// hack for components to work correctly in node.js
if (typeof global !== 'undefined') {
global.Prism = Prism;
}
; ;
Prism.languages.markup = { Prism.languages.markup = {
'comment': /<!--[\w\W]*?-->/, 'comment': /<!--[\w\W]*?-->/,
'prolog': /<\?.+?\?>/, 'prolog': /<\?[\w\W]+?\?>/,
'doctype': /<!DOCTYPE.+?>/, 'doctype': /<!DOCTYPE[\w\W]+?>/,
'cdata': /<!\[CDATA\[[\w\W]*?]]>/i, 'cdata': /<!\[CDATA\[[\w\W]*?]]>/i,
'tag': { 'tag': {
pattern: /<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/i, pattern: /<\/?(?!\d)[^\s>\/=.$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,
inside: { inside: {
'tag': { 'tag': {
pattern: /^<\/?[\w:-]+/i, pattern: /^<\/?[^\s>\/]+/i,
inside: { inside: {
'punctuation': /^<\/?/, 'punctuation': /^<\/?/,
'namespace': /^[\w-]+?:/ 'namespace': /^[^\s>\/:]+:/
} }
}, },
'attr-value': { 'attr-value': {
pattern: /=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i, pattern: /=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,
inside: { inside: {
'punctuation': /=|>|"/ 'punctuation': /[=>"']/
} }
}, },
'punctuation': /\/?>/, 'punctuation': /\/?>/,
'attr-name': { 'attr-name': {
pattern: /[\w:-]+/, pattern: /[^\s>\/]+/,
inside: { inside: {
'namespace': /^[\w-]+?:/ 'namespace': /^[^\s>\/:]+:/
} }
} }
@ -467,35 +475,38 @@ Prism.hooks.add('wrap', function(env) {
env.attributes['title'] = env.content.replace(/&amp;/, '&'); env.attributes['title'] = env.content.replace(/&amp;/, '&');
} }
}); });
;
Prism.languages.xml = Prism.languages.markup;
Prism.languages.html = Prism.languages.markup;
Prism.languages.mathml = Prism.languages.markup;
Prism.languages.svg = Prism.languages.markup;
Prism.languages.css = { Prism.languages.css = {
'comment': /\/\*[\w\W]*?\*\//, 'comment': /\/\*[\w\W]*?\*\//,
'atrule': { 'atrule': {
pattern: /@[\w-]+?.*?(;|(?=\s*\{))/i, pattern: /@[\w-]+?.*?(;|(?=\s*\{))/i,
inside: { inside: {
'punctuation': /[;:]/ 'rule': /@[\w-]+/
// See rest below
} }
}, },
'url': /url\((?:(["'])(\\\n|\\?.)*?\1|.*?)\)/i, 'url': /url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,
'selector': /[^\{\}\s][^\{\};]*(?=\s*\{)/, 'selector': /[^\{\}\s][^\{\};]*?(?=\s*\{)/,
'string': /("|')(\\\n|\\?.)*?\1/, 'string': /("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,
'property': /(\b|\B)[\w-]+(?=\s*:)/i, 'property': /(\b|\B)[\w-]+(?=\s*:)/i,
'important': /\B!important\b/i, 'important': /\B!important\b/i,
'punctuation': /[\{\};:]/, 'function': /[-a-z0-9]+(?=\()/i,
'function': /[-a-z0-9]+(?=\()/i 'punctuation': /[(){};:]/
}; };
Prism.languages.css['atrule'].inside.rest = Prism.util.clone(Prism.languages.css);
if (Prism.languages.markup) { if (Prism.languages.markup) {
Prism.languages.insertBefore('markup', 'tag', { Prism.languages.insertBefore('markup', 'tag', {
'style': { 'style': {
pattern: /<style[\w\W]*?>[\w\W]*?<\/style>/i, pattern: /(<style[\w\W]*?>)[\w\W]*?(?=<\/style>)/i,
inside: { lookbehind: true,
'tag': { inside: Prism.languages.css,
pattern: /<style[\w\W]*?>|<\/style>/i,
inside: Prism.languages.markup.tag.inside
},
rest: Prism.languages.css
},
alias: 'language-css' alias: 'language-css'
} }
}); });
@ -529,9 +540,9 @@ Prism.languages.clike = {
lookbehind: true lookbehind: true
} }
], ],
'string': /("|')(\\\n|\\?.)*?\1/, 'string': /(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
'class-name': { 'class-name': {
pattern: /((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i, pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,
lookbehind: true, lookbehind: true,
inside: { inside: {
punctuation: /(\.|\\)/ punctuation: /(\.|\\)/
@ -539,75 +550,93 @@ Prism.languages.clike = {
}, },
'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/, 'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
'boolean': /\b(true|false)\b/, 'boolean': /\b(true|false)\b/,
'function': { 'function': /[a-z0-9_]+(?=\()/i,
pattern: /[a-z0-9_]+\(/i, 'number': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,
inside: { 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,
punctuation: /\(/
}
},
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/,
'operator': /[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|~|\^|%/,
'ignore': /&(lt|gt|amp);/i,
'punctuation': /[{}[\];(),.:]/ 'punctuation': /[{}[\];(),.:]/
}; };
;
Prism.languages.javascript = Prism.languages.extend('clike', { Prism.languages.javascript = Prism.languages.extend('clike', {
'keyword': /\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/, 'keyword': /\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/, 'number': /\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,
'function': /(?!\d)[a-z0-9_$]+(?=\()/i // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i
}); });
Prism.languages.insertBefore('javascript', 'keyword', { Prism.languages.insertBefore('javascript', 'keyword', {
'regex': { 'regex': {
pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/, pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,
lookbehind: true lookbehind: true
} }
}); });
Prism.languages.insertBefore('javascript', 'class-name', {
'template-string': {
pattern: /`(?:\\`|\\?[^`])*`/,
inside: {
'interpolation': {
pattern: /\$\{[^}]+\}/,
inside: {
'interpolation-punctuation': {
pattern: /^\$\{|\}$/,
alias: 'punctuation'
},
rest: Prism.languages.javascript
}
},
'string': /[\s\S]+/
}
}
});
if (Prism.languages.markup) { if (Prism.languages.markup) {
Prism.languages.insertBefore('markup', 'tag', { Prism.languages.insertBefore('markup', 'tag', {
'script': { 'script': {
pattern: /<script[\w\W]*?>[\w\W]*?<\/script>/i, pattern: /(<script[\w\W]*?>)[\w\W]*?(?=<\/script>)/i,
inside: { lookbehind: true,
'tag': { inside: Prism.languages.javascript,
pattern: /<script[\w\W]*?>|<\/script>/i,
inside: Prism.languages.markup.tag.inside
},
rest: Prism.languages.javascript
},
alias: 'language-javascript' alias: 'language-javascript'
} }
}); });
} }
;
Prism.languages.js = Prism.languages.javascript;
Prism.languages.c = Prism.languages.extend('clike', { Prism.languages.c = Prism.languages.extend('clike', {
// allow for c multiline strings
'string': /("|')([^\n\\\1]|\\.|\\\r*\n)*?\1/,
'keyword': /\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/, 'keyword': /\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,
'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\// 'operator': /\-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*\/]/,
'number': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)[ful]*\b/i
}); });
Prism.languages.insertBefore('c', 'string', { Prism.languages.insertBefore('c', 'string', {
// property class reused for macro statements 'macro': {
'property': {
// allow for multiline macro definitions // allow for multiline macro definitions
// spaces after the # character compile fine with gcc // spaces after the # character compile fine with gcc
pattern: /((^|\n)\s*)#\s*[a-z]+([^\n\\]|\\.|\\\r*\n)*/i, pattern: /(^\s*)#\s*[a-z]+([^\r\n\\]|\\.|\\(?:\r\n?|\n))*/im,
lookbehind: true, lookbehind: true,
alias: 'property',
inside: { inside: {
// highlight the path of the include statement as a string // highlight the path of the include statement as a string
'string': { 'string': {
pattern: /(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/, pattern: /(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/,
lookbehind: true lookbehind: true
},
// highlight macro directives as keywords
'directive': {
pattern: /(#\s*)\b(define|elif|else|endif|error|ifdef|ifndef|if|import|include|line|pragma|undef|using)\b/,
lookbehind: true,
alias: 'keyword'
} }
} }
} },
// highlight predefined macros as constants
'constant': /\b(__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|stdin|stdout|stderr)\b/
}); });
delete Prism.languages.c['class-name']; delete Prism.languages.c['class-name'];
delete Prism.languages.c['boolean'];; delete Prism.languages.c['boolean'];
Prism.languages.cpp = Prism.languages.extend('c', { Prism.languages.cpp = Prism.languages.extend('c', {
'keyword': /\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|delete\[\]|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|new\[\]|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/, 'keyword': /\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,
'boolean': /\b(true|false)\b/, 'boolean': /\b(true|false)\b/,
'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/ 'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/
}); });
@ -617,7 +646,7 @@ Prism.languages.insertBefore('cpp', 'keyword', {
pattern: /(class\s+)[a-z0-9_]+/i, pattern: /(class\s+)[a-z0-9_]+/i,
lookbehind: true lookbehind: true
} }
});; });
(function(Prism) { (function(Prism) {
// Ignore comments starting with { to privilege string interpolation highlighting // Ignore comments starting with { to privilege string interpolation highlighting
@ -632,11 +661,11 @@ Prism.languages.coffeescript = Prism.languages.extend('javascript', {
'string': [ 'string': [
// Strings are multiline // Strings are multiline
/'(?:\\?[\s\S])*?'/, /'(?:\\?[^\\])*?'/,
{ {
// Strings are multiline // Strings are multiline
pattern: /"(?:\\?[\s\S])*?"/, pattern: /"(?:\\?[^\\])*?"/,
inside: { inside: {
'interpolation': interpolation 'interpolation': interpolation
} }
@ -700,7 +729,208 @@ Prism.languages.insertBefore('coffeescript', 'keyword', {
'property': /(?!\d)\w+(?=\s*:(?!:))/ 'property': /(?!\d)\w+(?=\s*:(?!:))/
}); });
}(Prism));; }(Prism));
/**
* Original by Samuel Flores
*
* Adds the following new token classes:
* constant, builtin, variable, symbol, regex
*/
(function(Prism) {
Prism.languages.ruby = Prism.languages.extend('clike', {
'comment': /#(?!\{[^\r\n]*?\}).*/,
'keyword': /\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/
});
var interpolation = {
pattern: /#\{[^}]+\}/,
inside: {
'delimiter': {
pattern: /^#\{|\}$/,
alias: 'tag'
},
rest: Prism.util.clone(Prism.languages.ruby)
}
};
Prism.languages.insertBefore('ruby', 'keyword', {
'regex': [
{
pattern: /%r([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[gim]{0,3}/,
inside: {
'interpolation': interpolation
}
},
{
pattern: /%r\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/,
inside: {
'interpolation': interpolation
}
},
{
// Here we need to specifically allow interpolation
pattern: /%r\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/,
inside: {
'interpolation': interpolation
}
},
{
pattern: /%r\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/,
inside: {
'interpolation': interpolation
}
},
{
pattern: /%r<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/,
inside: {
'interpolation': interpolation
}
},
{
pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,
lookbehind: true
}
],
'variable': /[@$]+[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/,
'symbol': /:[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/
});
Prism.languages.insertBefore('ruby', 'number', {
'builtin': /\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Fload|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,
'constant': /\b[A-Z][a-zA-Z_0-9]*(?:[?!]|\b)/
});
Prism.languages.ruby.string = [
{
pattern: /%[qQiIwWxs]?([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/,
inside: {
'interpolation': interpolation
}
},
{
pattern: /%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/,
inside: {
'interpolation': interpolation
}
},
{
// Here we need to specifically allow interpolation
pattern: /%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/,
inside: {
'interpolation': interpolation
}
},
{
pattern: /%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/,
inside: {
'interpolation': interpolation
}
},
{
pattern: /%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/,
inside: {
'interpolation': interpolation
}
},
{
pattern: /("|')(#\{[^}]+\}|\\(?:\r?\n|\r)|\\?.)*?\1/,
inside: {
'interpolation': interpolation
}
}
];
}(Prism));
Prism.languages.elixir = {
// Negative look-ahead is needed for string interpolation
// Negative look-behind is needed to avoid highlighting markdown headers in
// multi-line doc strings
'comment': {
pattern: /(^|[^#])#(?![{#]).*/m,
lookbehind: true
},
// ~r"""foo""", ~r'''foo''', ~r/foo/, ~r|foo|, ~r"foo", ~r'foo', ~r(foo), ~r[foo], ~r{foo}, ~r<foo>
'regex': /~[rR](?:("""|'''|[\/|"'])(?:\\.|(?!\1)[^\\])+\1|\((?:\\\)|[^)])+\)|\[(?:\\\]|[^\]])+\]|\{(?:\\\}|[^}])+\}|<(?:\\>|[^>])+>)[uismxfr]*/,
'string': [
{
// ~s"""foo""", ~s'''foo''', ~s/foo/, ~s|foo|, ~s"foo", ~s'foo', ~s(foo), ~s[foo], ~s{foo}, ~s<foo>
pattern: /~[cCsSwW](?:("""|'''|[\/|"'])(?:\\.|(?!\1)[^\\])+\1|\((?:\\\)|[^)])+\)|\[(?:\\\]|[^\]])+\]|\{(?:\\\}|#\{[^}]+\}|[^}])+\}|<(?:\\>|[^>])+>)[csa]?/,
inside: {
// See interpolation below
}
},
{
pattern: /("""|''')[\s\S]*?\1/,
inside: {
// See interpolation below
}
},
{
// Multi-line strings are allowed
pattern: /("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/,
inside: {
// See interpolation below
}
}
],
'atom': {
// Look-behind prevents bad highlighting of the :: operator
pattern: /(^|[^:]):\w+/,
lookbehind: true,
alias: 'symbol'
},
// Look-ahead prevents bad highlighting of the :: operator
'attr-name': /\w+:(?!:)/,
'capture': {
// Look-behind prevents bad highlighting of the && operator
pattern: /(^|[^&])&(?:[^&\s\d()][^\s()]*|(?=\())/,
lookbehind: true,
alias: 'function'
},
'argument': {
// Look-behind prevents bad highlighting of the && operator
pattern: /(^|[^&])&\d+/,
lookbehind: true,
alias: 'variable'
},
'attribute': {
pattern: /@[\S]+/,
alias: 'variable'
},
'number': /\b(?:0[box][a-f\d_]+|\d[\d_]*)(?:\.[\d_]+)?(?:e[+-]?[\d_]+)?\b/i,
'keyword': /\b(?:after|alias|and|case|catch|cond|def(?:callback|exception|impl|module|p|protocol|struct)?|do|else|end|fn|for|if|import|not|or|require|rescue|try|unless|use|when)\b/,
'boolean': /\b(?:true|false|nil)\b/,
'operator': [
/\bin\b|&&?|\|[|>]?|\\\\|::|\.\.\.?|\+\+?|-[->]?|<[-=>]|>=|!==?|\B!|=(?:==?|[>~])?|[*\/^]/,
{
// We don't want to match <<
pattern: /([^<])<(?!<)/,
lookbehind: true
},
{
// We don't want to match >>
pattern: /([^>])>(?!>)/,
lookbehind: true
}
],
'punctuation': /<<|>>|[.,%\[\]{}()]/
};
Prism.languages.elixir.string.forEach(function(o) {
o.inside = {
'interpolation': {
pattern: /#\{[^}]+\}/,
inside: {
'delimiter': {
pattern: /^#\{|\}$/,
alias: 'punctuation'
},
rest: Prism.util.clone(Prism.languages.elixir)
}
}
};
});
/** /**
* Original by Aaron Harun: http://aahacreative.com/2012/07/31/php-syntax-highlighting-prism/ * Original by Aaron Harun: http://aahacreative.com/2012/07/31/php-syntax-highlighting-prism/
* Modified by Miles Johnson: http://milesj.me * Modified by Miles Johnson: http://milesj.me
@ -718,7 +948,7 @@ Prism.languages.php = Prism.languages.extend('clike', {
'keyword': /\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i, 'keyword': /\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,
'constant': /\b[A-Z0-9_]{2,}\b/, 'constant': /\b[A-Z0-9_]{2,}\b/,
'comment': { 'comment': {
pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])(\/\/).*?(\r?\n|$))/, pattern: /(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/,
lookbehind: true lookbehind: true
} }
}); });
@ -727,15 +957,15 @@ Prism.languages.php = Prism.languages.extend('clike', {
// common than strings containing hashes... // common than strings containing hashes...
Prism.languages.insertBefore('php', 'class-name', { Prism.languages.insertBefore('php', 'class-name', {
'shell-comment': { 'shell-comment': {
pattern: /(^|[^\\])#.*?(\r?\n|$)/, pattern: /(^|[^\\])#.*/,
lookbehind: true, lookbehind: true,
alias: 'comment' alias: 'comment'
} }
}); });
Prism.languages.insertBefore('php', 'keyword', { Prism.languages.insertBefore('php', 'keyword', {
'delimiter': /(\?>|<\?php|<\?)/i, 'delimiter': /\?>|<\?(?:php)?/i,
'variable': /(\$\w+)\b/i, 'variable': /\$\w+\b/i,
'package': { 'package': {
pattern: /(\\|namespace\s+|use\s+)[\w\\]+/, pattern: /(\\|namespace\s+|use\s+)[\w\\]+/,
lookbehind: true, lookbehind: true,
@ -788,7 +1018,8 @@ if (Prism.languages.markup) {
} }
for (var i = 0, t; t = env.tokenStack[i]; i++) { for (var i = 0, t; t = env.tokenStack[i]; i++) {
env.highlightedCode = env.highlightedCode.replace('{{{PHP' + (i + 1) + '}}}', Prism.highlight(t, env.grammar, 'php')); // The replace prevents $$, $&, $`, $', $n, $nn from being interpreted as special patterns
env.highlightedCode = env.highlightedCode.replace('{{{PHP' + (i + 1) + '}}}', Prism.highlight(t, env.grammar, 'php').replace(/\$/g, '$$$$'));
} }
env.element.innerHTML = env.highlightedCode; env.element.innerHTML = env.highlightedCode;
@ -812,41 +1043,30 @@ if (Prism.languages.markup) {
} }
; ;
Prism.languages.python= { Prism.languages.python= {
'triple-quoted-string': {
pattern: /"""[\s\S]+?"""|'''[\s\S]+?'''/,
alias: 'string'
},
'comment': { 'comment': {
pattern: /(^|[^\\])#.*?(\r?\n|$)/, pattern: /(^|[^\\])#.*/,
lookbehind: true
},
'string': /("|')(?:\\?.)*?\1/,
'function' : {
pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\()/g,
lookbehind: true
},
'class-name': {
pattern: /(\bclass\s+)[a-z0-9_]+/i,
lookbehind: true lookbehind: true
}, },
'string': /"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(\\?.)*?\1/, 'keyword' : /\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/,
'keyword' : /\b(as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/, 'boolean' : /\b(?:True|False)\b/,
'boolean' : /\b(True|False)\b/, 'number' : /\b-?(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,
'number' : /\b-?(0[box])?(?:[\da-f]+\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i, 'operator' : /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,
'operator' : /[-+]|<=?|>=?|!|={1,2}|&{1,2}|\|?\||\?|\*|\/|~|\^|%|\b(or|and|not)\b/,
'punctuation' : /[{}[\];(),.:]/ 'punctuation' : /[{}[\];(),.:]/
}; };
;
/**
* Original by Samuel Flores
*
* Adds the following new token classes:
* constant, builtin, variable, symbol, regex
*/
Prism.languages.ruby = Prism.languages.extend('clike', {
'comment': /#[^\r\n]*(\r?\n|$)/,
'keyword': /\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/,
'builtin': /\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Fload|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,
'constant': /\b[A-Z][a-zA-Z_0-9]*[?!]?\b/
});
Prism.languages.insertBefore('ruby', 'keyword', {
'regex': {
pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,
lookbehind: true
},
'variable': /[@$]+\b[a-zA-Z_][a-zA-Z_0-9]*[?!]?\b/,
'symbol': /:\b[a-zA-Z_][a-zA-Z_0-9]*[?!]?\b/
});
;
/* TODO /* TODO
Add support for Markdown notation inside doc comments Add support for Markdown notation inside doc comments
Add support for nested block comments... Add support for nested block comments...
@ -861,7 +1081,7 @@ Prism.languages.rust = {
lookbehind: true lookbehind: true
}, },
{ {
pattern: /(^|[^\\:])\/\/.*?(\r?\n|$)/, pattern: /(^|[^\\:])\/\/.*/,
lookbehind: true lookbehind: true
} }
], ],
@ -887,7 +1107,7 @@ Prism.languages.rust = {
}, },
// Hex, oct, bin, dec numbers with visual separators and type suffix // Hex, oct, bin, dec numbers with visual separators and type suffix
'number': /\b-?(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(\d(_?\d)*)?\.?\d(_?\d)*([Ee][+-]?\d+)?)(?:_?(?:[iu](?:8|16|32)?|f32|f64))?\b/, 'number': /\b-?(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(\d(_?\d)*)?\.?\d(_?\d)*([Ee][+-]?\d+)?)(?:_?(?:[iu](?:8|16|32|64)?|f32|f64))?\b/,
// Closure params should not be confused with bitwise OR | // Closure params should not be confused with bitwise OR |
'closure-params': { 'closure-params': {
@ -897,6 +1117,6 @@ Prism.languages.rust = {
'operator': /[&*]/ 'operator': /[&*]/
} }
}, },
'punctuation': /[{}[\];(),.:]|->/, 'punctuation': /[{}[\];(),:]|\.+|->/,
'operator': /[-+]{1,2}|!=?|<=?|>=?|={1,3}|&&?|\|\|?|\*|\/|\^|%|<<|>>@/ 'operator': /[-+*\/%!^=]=?|@|&[&=]?|\|[|=]?|<<?=?|>>?=?/
};; };

@ -41,9 +41,9 @@ class app.views.Resizer extends app.View
onDrag: (event) => onDrag: (event) =>
return if @lastDrag and @lastDrag > Date.now() - 50 return if @lastDrag and @lastDrag > Date.now() - 50
@lastDrag = Date.now() @lastDrag = Date.now()
@resize(event.clientX, false) @resize(event.pageX, false)
return return
onDragEnd: (event) => onDragEnd: (event) =>
@resize(event.clientX or (event.screenX - window.screenX), true) @resize(event.pageX or (event.screenX - window.screenX), true)
return return

@ -0,0 +1,6 @@
#= require views/pages/base
class app.views.ElixirPage extends app.views.BasePage
prepare: ->
@highlightCode @findAllByTag('pre'), 'elixir'
return

@ -0,0 +1,5 @@
#= require views/pages/base
class app.views.VagrantPage extends app.views.BasePage
prepare: ->
@highlightCode @findAll('pre.ruby'), 'ruby'

@ -39,6 +39,7 @@
'pages/coffeescript', 'pages/coffeescript',
'pages/d3', 'pages/d3',
'pages/drupal', 'pages/drupal',
'pages/elixir',
'pages/ember', 'pages/ember',
'pages/express', 'pages/express',
'pages/git', 'pages/git',
@ -72,5 +73,7 @@
'pages/socketio', 'pages/socketio',
'pages/sphinx', 'pages/sphinx',
'pages/underscore', 'pages/underscore',
'pages/vagrant',
'pages/vue',
'pages/yard', 'pages/yard',
'pages/yii'; 'pages/yii';

@ -39,6 +39,7 @@
'pages/coffeescript', 'pages/coffeescript',
'pages/d3', 'pages/d3',
'pages/drupal', 'pages/drupal',
'pages/elixir',
'pages/ember', 'pages/ember',
'pages/express', 'pages/express',
'pages/git', 'pages/git',
@ -72,5 +73,7 @@
'pages/socketio', 'pages/socketio',
'pages/sphinx', 'pages/sphinx',
'pages/underscore', 'pages/underscore',
'pages/vagrant',
'pages/vue',
'pages/yard', 'pages/yard',
'pages/yii'; 'pages/yii';

@ -72,31 +72,6 @@
@extend ._booting:before, %user-select-none; @extend ._booting:before, %user-select-none;
} }
._splash-sponsors {
position: absolute;
top: 50%;
left: 0;
right: 0;
margin-top: 1.25rem;
text-align: center;
line-height: 2rem;
}
._splash-sponsor {
position: relative;
display: inline-block;
vertical-align: top;
margin: .5rem 1.5rem;
._logo-thx { opacity: .3; }
&:hover ._logo-thx { opacity: .6; }
._logo-info {
right: 50%;
margin-right: -9rem;
}
}
// //
// Intro // Intro
// //
@ -132,22 +107,6 @@
._intro-link { cursor: pointer; } ._intro-link { cursor: pointer; }
._intro-sponsors {
position: absolute;
bottom: 1rem;
right: 1rem;
margin: 0;
line-height: 1.5rem;
}
._intro-sponsor {
display: inline-block;
vertical-align: top;
margin-left: .5em;
&:hover { text-decoration: none; }
}
// //
// Error // Error
// //
@ -429,76 +388,3 @@
vertical-align: text-top; vertical-align: text-top;
margin-left: .25rem; margin-left: .25rem;
} }
._logo-thx {
position: relative;
display: inline-block;
vertical-align: top;
height: 1.5rem;
overflow: hidden;
text-indent: -20rem;
background-position: center center;
background-repeat: no-repeat;
}
._logo-info {
top: auto;
bottom: 100%;
right: 0;
max-width: 18.25rem;
margin-bottom: .75rem;
padding: .5rem .75rem;
line-height: 1.375rem;
text-align: left;
pointer-events: none;
@extend %notif;
:hover > & { opacity: 1; }
}
._jetbrains-logo {
top: 1px;
width: 5rem;
background-image: image-url('jetbrains.png');
background-size: 5rem 1.5rem;
@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) {
background-image: image-url('jetbrains@2x.png');
}
}
._splash-sponsor > ._jetbrains-logo {
background-image: image-url('jetbrains-bw.png');
@if $style == 'dark' {
filter: invert(100%);
-webkit-filter: invert(100%);
}
@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) {
background-image: image-url('jetbrains-bw@2x.png');
}
}
._code-school-logo {
width: 7rem;
background-image: image-url('code-school.png');
background-size: 7rem 1.25rem;
@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) {
background-image: image-url('code-school@2x.png');
}
}
._splash-sponsor > ._code-school-logo {
background-image: image-url('code-school-bw.png');
@if $style == 'dark' {
filter: invert(100%);
-webkit-filter: invert(100%);
}
@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) {
background-image: image-url('code-school-bw@2x.png');
}
}

@ -34,7 +34,8 @@
._icon-dom_events:before { background-position: -3rem -1rem; } ._icon-dom_events:before { background-position: -3rem -1rem; }
._icon-javascript:before { background-position: -4rem -1rem; } ._icon-javascript:before { background-position: -4rem -1rem; }
._icon-backbone:before { background-position: -5rem -1rem; @extend %darkIconFix !optional; } ._icon-backbone:before { background-position: -5rem -1rem; @extend %darkIconFix !optional; }
._icon-node:before { background-position: -6rem -1rem; } ._icon-node:before,
._icon-node_lts:before { background-position: -6rem -1rem; }
._icon-sass:before { background-position: -7rem -1rem; } ._icon-sass:before { background-position: -7rem -1rem; }
._icon-less:before { background-position: -8rem -1rem; } ._icon-less:before { background-position: -8rem -1rem; }
._icon-angular:before { background-position: -9rem -1rem; } ._icon-angular:before { background-position: -9rem -1rem; }
@ -115,3 +116,5 @@
._icon-phalcon:before { background-position: -1rem -9rem; } ._icon-phalcon:before { background-position: -1rem -9rem; }
%icon-clipboard { background-position: -2rem -9rem; } %icon-clipboard { background-position: -2rem -9rem; }
%icon-clipboard-white { background-position: -3rem -9rem; } %icon-clipboard-white { background-position: -3rem -9rem; }
._icon-elixir:before { background-position: -4rem -9rem; @extend %darkIconFix !optional; }
._icon-vagrant:before { background-position: -5rem -9rem; }

@ -0,0 +1,7 @@
._elixir {
@extend %simple;
.type-detail { margin-bottom: 2em; }
.type-detail pre { margin-left: -1rem; }
._mobile & .type-detail pre { margin-left: 0; }
}

@ -0,0 +1,9 @@
._vagrant {
@extend %simple;
.alert { @extend %note; }
.prev-button { float: left; }
.prev-button:before { content: '\2190 '; }
.next-button { float: right; }
.next-button:after { content: ' \2192'; }
}

@ -37,10 +37,6 @@ module Docs
entries entries
end end
def include_default_entry?
at_css('#sidebar a[href="index"]') || at_css('h1 ~ .section')
end
end end
end end
end end

@ -0,0 +1,37 @@
module Docs
class Elixir
class CleanHtmlFilter < Filter
def call
at_css('footer', '.view-source').remove
css('section section.docstring h2').each do |node|
node.name = 'h4'
end
css('h1 .hover-link', '.detail-link').each do |node|
node.parent['id'] = node['href'].remove('#')
node.remove
end
css('.details-list').each do |list|
type = list['id'].remove(/s\z/)
list.css('.detail-header').each do |node|
node.name = 'h3'
node['class'] += " #{type}"
end
end
css('.summary h2').each { |node| node.parent.before(node) }
css('.summary').each { |node| node.name = 'dl' }
css('.summary-signature').each { |node| node.name = 'dt' }
css('.summary-synopsis').each { |node| node.name = 'dd' }
css('section', 'div:not(.type-detail)', 'h2 a').each do |node|
node.before(node.children).remove
end
doc
end
end
end
end

@ -0,0 +1,40 @@
module Docs
class Elixir
class EntriesFilter < Docs::EntriesFilter
def get_name
at_css('h1').content.split(' ').first.strip
end
def get_type
case at_css('h1 small').try(:content)
when 'exception'
'Exceptions'
when 'protocol'
'Protocols'
else
name.split('.').first
end
end
def additional_entries
return [] if type == 'Exceptions'
css('.detail-header .signature').map do |node|
id = node.parent['id']
name = node.content.strip
name.remove! %r{\(.*\)}
name.remove! 'left '
name.remove! ' right'
name.sub! 'sigil_', '~'
unless node.parent['class'].end_with?('macro') || self.name.start_with?('Kernel')
name.prepend "#{self.name}."
name << " (#{id.split('/').last})"
end
[name, id]
end
end
end
end
end

@ -0,0 +1,18 @@
module Docs
class Vagrant
class CleanHtmlFilter < Filter
def call
@doc = at_css('.page-contents .span8')
css('hr').remove
css('pre > code').each do |node|
node.parent['class'] = node['class']
node.before(node.children).remove
end
doc
end
end
end
end

@ -0,0 +1,36 @@
module Docs
class Vagrant
class EntriesFilter < Docs::EntriesFilter
def get_name
if slug.start_with?('push/')
name = at_css('h2').try(:content)
elsif slug.start_with?('cli/')
name = at_css('h1 + p > strong > code').try(:content).try(:[], /\s*vagrant\s+[\w\-]+/)
end
name || at_css('h1').content
end
def get_type
at_css('.sidebar-nav li.current').content
end
def additional_entries
case at_css('h1 + p > strong > code').try(:content)
when /config\./
h2 = nil
css('.page-contents .span8 > *').each_with_object [] do |node, entries|
if node.name == 'h2'
h2 = node.content
elsif h2 == 'Available Settings' && (code = node.at_css('code')) && (name = code.content) && name.start_with?('config.')
id = code.parent['id'] = name.parameterize
entries << [name, id, 'Config']
end
end
else
[]
end
end
end
end
end

@ -6,7 +6,7 @@ module Docs
at_css('h1').content = 'Vue.js' if root_page? at_css('h1').content = 'Vue.js' if root_page?
css('#demo').remove css('.demo', '.guide-links', '.footer').remove
# Remove code highlighting # Remove code highlighting
css('figure').each do |node| css('figure').each do |node|

@ -2,7 +2,7 @@ module Docs
class Vue class Vue
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
def get_name def get_name
at_css('h1').content at_css('h1').content.presence || 'API'
end end
def get_type def get_type
@ -15,11 +15,16 @@ module Docs
def additional_entries def additional_entries
return [] if slug.start_with?('guide') return [] if slug.start_with?('guide')
type = nil
css('h3').map do |node| css('h2, h3').each_with_object [] do |node, entries|
name = node.content.strip if node.name == 'h2'
name.sub! %r{\(.*\)}, '()' type = node.content.strip
[name, node['id'], "API: #{self.name}"] else
name = node.content.strip
name.sub! %r{\(.*\)}, '()'
entries << [name, node['id'], "API: #{type}"]
end
end end
end end
end end

@ -3,7 +3,7 @@ module Docs
self.name = 'Apache HTTP Server' self.name = 'Apache HTTP Server'
self.slug = 'apache_http_server' self.slug = 'apache_http_server'
self.type = 'apache' self.type = 'apache'
self.version = '2.4.12' self.version = '2.4.17'
self.base_url = 'http://httpd.apache.org/docs/2.4/en/' self.base_url = 'http://httpd.apache.org/docs/2.4/en/'
self.links = { self.links = {
home: 'http://httpd.apache.org/' home: 'http://httpd.apache.org/'

@ -2,7 +2,7 @@ module Docs
class Django < FileScraper class Django < FileScraper
self.name = 'Django' self.name = 'Django'
self.type = 'sphinx' self.type = 'sphinx'
self.version = '1.8.4' self.version = '1.8.6'
self.dir = '/Users/Thibaut/DevDocs/Docs/Django' self.dir = '/Users/Thibaut/DevDocs/Docs/Django'
self.base_url = 'https://docs.djangoproject.com/en/1.8/' self.base_url = 'https://docs.djangoproject.com/en/1.8/'
self.root_path = 'index.html' self.root_path = 'index.html'

@ -0,0 +1,31 @@
module Docs
class Elixir < UrlScraper
self.name = 'Elixir'
self.type = 'elixir'
self.version = '1.1.1'
self.base_url = 'http://elixir-lang.org/docs/stable/'
self.root_path = 'elixir/extra-api-reference.html'
self.initial_paths = %w(
eex/EEx.html
ex_unit/ExUnit.html
iex/IEx.html
logger/Logger.html
mix/Mix.html
)
self.links = {
home: 'http://elixir-lang.org/',
code: 'https://github.com/elixir-lang/elixir'
}
html_filters.push 'elixir/clean_html', 'elixir/entries', 'title'
options[:container] = "#content"
options[:title] = false
options[:root_title] = 'Elixir'
options[:attribution] = <<-HTML
&copy; 2012 Plataformatec<br>
Licensed under the Apache License, Version 2.0.
HTML
end
end

@ -2,7 +2,7 @@ module Docs
class Modernizr < UrlScraper class Modernizr < UrlScraper
self.name = 'Modernizr' self.name = 'Modernizr'
self.type = 'modernizr' self.type = 'modernizr'
self.version = '3.1.0' self.version = '3.2.0'
self.base_url = 'https://modernizr.com/docs/' self.base_url = 'https://modernizr.com/docs/'
html_filters.push 'modernizr/entries', 'modernizr/clean_html', 'title' html_filters.push 'modernizr/entries', 'modernizr/clean_html', 'title'

@ -2,7 +2,7 @@ module Docs
class Mongoose < UrlScraper class Mongoose < UrlScraper
self.name = 'Mongoose' self.name = 'Mongoose'
self.type = 'mongoose' self.type = 'mongoose'
self.version = '4.1.6' self.version = '4.2.4'
self.base_url = 'http://mongoosejs.com/docs/' self.base_url = 'http://mongoosejs.com/docs/'
self.root_path = 'index.html' self.root_path = 'index.html'
self.initial_paths = %w(guide.html api.html) self.initial_paths = %w(guide.html api.html)

@ -3,11 +3,11 @@ module Docs
self.name = 'Node.js' self.name = 'Node.js'
self.slug = 'node' self.slug = 'node'
self.type = 'node' self.type = 'node'
self.version = '4.2.1' self.version = '5.0.0'
self.base_url = 'https://nodejs.org/api/' self.base_url = 'https://nodejs.org/api/'
self.links = { self.links = {
home: 'https://nodejs.org/', home: 'https://nodejs.org/',
code: 'https://github.com/joyent/node' code: 'https://github.com/nodejs/node'
} }
html_filters.push 'node/clean_html', 'node/entries', 'title' html_filters.push 'node/clean_html', 'node/entries', 'title'
@ -19,7 +19,9 @@ module Docs
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
&copy; Joyent, Inc. and other Node contributors<br> &copy; Joyent, Inc. and other Node contributors<br>
Licensed under the MIT License. Licensed under the MIT License.<br>
Node.js is a trademark of Joyent, Inc. and is used with its permission.<br>
We are not endorsed by or affiliated with Joyent.
HTML HTML
end end
end end

@ -0,0 +1,9 @@
module Docs
class NodeLts < Node
self.name = 'Node.js (LTS)'
self.slug = 'node_lts'
self.type = 'node'
self.version = '4.2.1'
self.base_url = 'https://nodejs.org/dist/v4.2.1/docs/api/'
end
end

@ -2,7 +2,7 @@ module Docs
class React < UrlScraper class React < UrlScraper
self.name = 'React' self.name = 'React'
self.type = 'react' self.type = 'react'
self.version = '0.14.0' self.version = '0.14.2'
self.base_url = 'https://facebook.github.io/react/' self.base_url = 'https://facebook.github.io/react/'
self.root_path = 'docs/getting-started.html' self.root_path = 'docs/getting-started.html'
self.links = { self.links = {

@ -3,7 +3,7 @@ module Docs
self.name = 'React Native' self.name = 'React Native'
self.slug = 'react_native' self.slug = 'react_native'
self.type = 'react' self.type = 'react'
self.version = '0.12.0' self.version = '0.14.1'
self.base_url = 'https://facebook.github.io/react-native/docs/' self.base_url = 'https://facebook.github.io/react-native/docs/'
self.root_path = 'getting-started.html' self.root_path = 'getting-started.html'
self.links = { self.links = {

@ -1,7 +1,7 @@
module Docs module Docs
class Rust < UrlScraper class Rust < UrlScraper
self.type = 'rust' self.type = 'rust'
self.version = '1.3.0' self.version = '1.4.0'
self.base_url = 'http://doc.rust-lang.org/' self.base_url = 'http://doc.rust-lang.org/'
self.root_path = 'book/index.html' self.root_path = 'book/index.html'
self.initial_paths = %w( self.initial_paths = %w(

@ -0,0 +1,19 @@
module Docs
class Vagrant < UrlScraper
self.name = 'Vagrant'
self.type = 'vagrant'
self.version = '1.7.4'
self.base_url = 'https://docs.vagrantup.com/v2/'
self.links = {
home: 'https://www.vagrantup.com/',
code: 'https://github.com/mitchellh/vagrant'
}
html_filters.push 'vagrant/entries', 'vagrant/clean_html'
options[:attribution] = <<-HTML
&copy; 2010&ndash;2015 Mitchell Hashimoto<br>
Licensed under the MIT License.
HTML
end
end

@ -3,7 +3,7 @@ module Docs
self.name = 'Vue.js' self.name = 'Vue.js'
self.slug = 'vue' self.slug = 'vue'
self.type = 'vue' self.type = 'vue'
self.version = '0.12.14' self.version = '1.0.7'
self.base_url = 'http://vuejs.org' self.base_url = 'http://vuejs.org'
self.root_path = '/guide/index.html' self.root_path = '/guide/index.html'
self.initial_paths = %w(/api/index.html) self.initial_paths = %w(/api/index.html)

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -0,0 +1,2 @@
http://elixir-lang.org/docs/stable/elixir/assets/logo.png
with permission from José Valim (https://twitter.com/josevalim/status/657125748659126272)

Binary file not shown.

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -0,0 +1 @@
http://www.vagrantup.com

@ -8,14 +8,6 @@ CACHE:
<%= stylesheet_path 'application-dark' %> <%= stylesheet_path 'application-dark' %>
<%= image_path 'icons.png' %> <%= image_path 'icons.png' %>
<%= image_path 'icons@2x.png' %> <%= image_path 'icons@2x.png' %>
<%= image_path 'jetbrains.png' %>
<%= image_path 'jetbrains@2x.png' %>
<%= image_path 'jetbrains-bw.png' %>
<%= image_path 'jetbrains-bw@2x.png' %>
<%= image_path 'code-school.png' %>
<%= image_path 'code-school@2x.png' %>
<%= image_path 'code-school-bw.png' %>
<%= image_path 'code-school-bw@2x.png' %>
<%= asset_path 'docs.js' %> <%= asset_path 'docs.js' %>
<%= doc_index_urls.join "\n" %> <%= doc_index_urls.join "\n" %>

Loading…
Cancel
Save