Unified · Split
Binary file not shown.
Binary file not shown.
| @@ -1,5 +1,8 @@ | ||
| 1 | 1 | [ |
| 2 | 2 | [ |
| 3 | + "2015-04-26", | |
| 4 | + "New <a href=\"/npm/\">npm</a> documentation" | |
| 5 | + ], [ | |
| 3 | 6 | "2015-03-22", |
| 4 | 7 | "New <a href=\"/meteor/\">Meteor</a> and <a href=\"/mocha/\">mocha</a> documentations" |
| 5 | 8 | ], [ |
| @@ -265,6 +265,11 @@ credits = [ · 264 unmodified lines | ||
| 265 | 265 | '2008-2014 2014 Aaron Patterson, Mike Dalessio, Charles Nutter, Sergio Arbeo, Patrick Mahoney, Yoko Harada, Akinori Musha', |
| 266 | 266 | 'MIT', |
| 267 | 267 | 'https://github.com/sparklemotion/nokogiri/blob/master/README.rdoc#license' |
| 268 | + ], [ | |
| 269 | + 'npm', | |
| 270 | + 'npm, Inc. and Contributors<br>npm is a trademark of npm, Inc.', | |
| 271 | + 'npm', | |
| 272 | + 'https://raw.githubusercontent.com/npm/npm/master/LICENSE' | |
| 268 | 273 | ], [ |
| 269 | 274 | 'PHP', |
| 270 | 275 | '1997-2015 The PHP Documentation Group', |
| @@ -52,6 +52,7 @@ · 51 unmodified lines | ||
| 52 | 52 | 'pages/moment', |
| 53 | 53 | 'pages/nginx', |
| 54 | 54 | 'pages/node', |
| 55 | + 'pages/npm', | |
| 55 | 56 | 'pages/php', |
| 56 | 57 | 'pages/phpunit', |
| 57 | 58 | 'pages/postgres', |
| @@ -52,6 +52,7 @@ · 51 unmodified lines | ||
| 52 | 52 | 'pages/moment', |
| 53 | 53 | 'pages/nginx', |
| 54 | 54 | 'pages/node', |
| 55 | + 'pages/npm', | |
| 55 | 56 | 'pages/php', |
| 56 | 57 | 'pages/phpunit', |
| 57 | 58 | 'pages/postgres', |
| @@ -99,3 +99,4 @@ · 98 unmodified lines | ||
| 99 | 99 | ._icon-symfony:before { background-position: -5rem -7rem; } |
| 100 | 100 | ._icon-mocha:before { background-position: -6rem -7rem; } |
| 101 | 101 | ._icon-meteor:before { background-position: -7rem -7rem; @extend %darkIconFix !optional; } |
| 102 | +._icon-npm:before { background-position: -8rem -7rem } | |
| @@ -27,3 +27,4 @@ · 26 unmodified lines | ||
| 27 | 27 | ._sinon { |
| 28 | 28 | @extend %simple; |
| 29 | 29 | } |
| 30 | + | |
| @@ -0,0 +1,15 @@ | ||
| 1 | +._npm { | |
| 2 | + @extend %simple; | |
| 3 | + | |
| 4 | + .pageColumns { | |
| 5 | + padding-left: 0; | |
| 6 | + list-style: none; | |
| 7 | + } | |
| 8 | + | |
| 9 | + .faint.heading { | |
| 10 | + font-size: .9em; | |
| 11 | + color: $textColorLight; | |
| 12 | + } | |
| 13 | + | |
| 14 | + .youtube-video iframe { width: 420px; height: 315px; } | |
| 15 | +} | |
| @@ -0,0 +1,28 @@ | ||
| 1 | +module Docs | |
| 2 | + class Npm | |
| 3 | + class CleanHtmlFilter < Filter | |
| 4 | + def call | |
| 5 | + if root_page? | |
| 6 | + css('#enterprise', '#policies', '#viewAll').remove | |
| 7 | + else | |
| 8 | + @doc = doc.at_css('#page') | |
| 9 | + css('meta', '.colophon').remove | |
| 10 | + end | |
| 11 | + | |
| 12 | + css('> section', '.deep-link > a').each do |node| | |
| 13 | + node.before(node.children).remove | |
| 14 | + end | |
| 15 | + | |
| 16 | + css('pre.editor').each do |node| | |
| 17 | + node.inner_html = node.inner_html.gsub(/<\/div>(?!\n|\z)/, "</div>\n") | |
| 18 | + end | |
| 19 | + | |
| 20 | + css('pre').each do |node| | |
| 21 | + node.content = node.content | |
| 22 | + end | |
| 23 | + | |
| 24 | + doc | |
| 25 | + end | |
| 26 | + end | |
| 27 | + end | |
| 28 | +end | |
| @@ -0,0 +1,43 @@ | ||
| 1 | +module Docs | |
| 2 | + class Npm | |
| 3 | + class EntriesFilter < Docs::EntriesFilter | |
| 4 | + def get_name | |
| 5 | + if slug.start_with?('api') && at_css('pre').content =~ /\A\s*npm\.([\w\-]+\.)*[\w\-]+/ | |
| 6 | + name = $&.strip | |
| 7 | + else | |
| 8 | + name = at_css('nav > section.active a.active').content | |
| 9 | + end | |
| 10 | + | |
| 11 | + name << ' (CLI)' if slug.start_with?('cli') | |
| 12 | + name | |
| 13 | + end | |
| 14 | + | |
| 15 | + def get_type | |
| 16 | + case slug | |
| 17 | + when 'files/package.json' | |
| 18 | + 'package.json' | |
| 19 | + when 'misc/config' | |
| 20 | + 'Config' | |
| 21 | + else | |
| 22 | + at_css('nav > section.active > h2').content | |
| 23 | + end | |
| 24 | + end | |
| 25 | + | |
| 26 | + def additional_entries | |
| 27 | + case slug | |
| 28 | + when 'files/package.json' | |
| 29 | + css('#page > h2[id]').each_with_object [] do |node, entries| | |
| 30 | + next if node.content =~ /\A[A-Z]/ | |
| 31 | + entries << ["package.json: #{node.content}", node['id']] | |
| 32 | + end | |
| 33 | + when 'misc/config' | |
| 34 | + css('#config-settings ~ h3[id]').map do |node| | |
| 35 | + ["config: #{node.content}", node['id']] | |
| 36 | + end | |
| 37 | + else | |
| 38 | + [] | |
| 39 | + end | |
| 40 | + end | |
| 41 | + end | |
| 42 | + end | |
| 43 | +end | |
| @@ -0,0 +1,31 @@ | ||
| 1 | +module Docs | |
| 2 | + class Npm < UrlScraper | |
| 3 | + self.name = 'npm' | |
| 4 | + self.type = 'npm' | |
| 5 | + self.version = '2.8.4' | |
| 6 | + self.base_url = 'https://docs.npmjs.com/' | |
| 7 | + self.links = { | |
| 8 | + home: 'https://www.npmjs.com/', | |
| 9 | + code: 'https://github.com/npm/npm' | |
| 10 | + } | |
| 11 | + | |
| 12 | + html_filters.push 'npm/entries', 'npm/clean_html', 'title' | |
| 13 | + | |
| 14 | + options[:container] = ->(filter) { filter.root_page? ? '.toc' : nil } | |
| 15 | + options[:title] = false | |
| 16 | + options[:root_title] = 'npm' | |
| 17 | + | |
| 18 | + options[:skip] = %w(all) | |
| 19 | + options[:skip_patterns] = [ | |
| 20 | + /\Aenterprise/, | |
| 21 | + /\Acompany/, | |
| 22 | + /\Apolicies/ | |
| 23 | + ] | |
| 24 | + | |
| 25 | + options[:attribution] = <<-HTML | |
| 26 | + © npm, Inc. and Contributors<br> | |
| 27 | + Licensed under the npm License.<br> | |
| 28 | + npm is a trademark of npm, Inc. | |
| 29 | + HTML | |
| 30 | + end | |
| 31 | +end | |
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1 @@ | ||
| 1 | +https://www.npmjs.com/ | |