Add Composer

This commit is contained in:
Nicolas Ettlin 2018-10-01 18:34:36 +02:00
parent 24abe4c9d9
commit b98ab152c8
8 changed files with 98 additions and 0 deletions

View file

@ -190,6 +190,11 @@ credits = [
'2009-2018 Jeremy Ashkenas',
'MIT',
'https://raw.githubusercontent.com/jashkenas/coffeescript/master/LICENSE'
], [
'Composer',
'2012-2018 Nils Adermann, Jordi Boggiano',
'MIT',
'https://github.com/composer/composer/blob/master/LICENSE'
], [
'Cordova',
'2012-2017 The Apache Software Foundation',

View file

@ -21,6 +21,7 @@
._bower,
._chai,
._codeceptjs,
._composer,
._docker,
._electron,
._fish,

View file

@ -0,0 +1,25 @@
module Docs
class Composer
class CleanHtmlFilter < Filter
def call
# Remove unneeded elements
css('#searchbar, .toc, .fork-and-edit, .anchor').remove
# Code blocks
css('pre').each do |node|
code = node.at_css('code[class]')
unless code.nil?
node['data-language'] = 'javascript' if code['class'].include?('javascript')
node['data-language'] = 'php' if code['class'].include?('php')
end
node.content = node.content.strip
node.remove_attribute('class')
end
doc
end
end
end
end

View file

@ -0,0 +1,39 @@
module Docs
class Composer
class EntriesFilter < Docs::EntriesFilter
def get_name
title = at_css('h1').content
title = "#{Integer(subpath[1]) + 1}. #{title}" if type == 'Book'
title
end
def get_type
return 'Articles' if subpath.start_with?('articles/')
'Book'
end
def additional_entries
entries = []
if subpath == '04-schema.md' # JSON Schema
css('h3').each do |node|
name = node.content.strip
name.remove!(' (root-only)')
entries << [name, node['id'], 'JSON Schema']
end
end
if subpath == '06-config.md' # Composer config
css('h2').each do |node|
entries << [node.content.strip, node['id'], 'Configuration Options']
end
end
entries
end
end
end
end

View file

@ -0,0 +1,27 @@
module Docs
class Composer < UrlScraper
self.name = 'Composer'
self.type = 'composer'
self.links = {
home: 'https://getcomposer.org',
code: 'https://github.com/composer/composer'
}
html_filters.push 'composer/clean_html', 'composer/entries'
self.release = '1.7.2'
self.base_url = 'https://getcomposer.org/doc/'
options[:container] = '#main'
options[:skip_patterns] = [
/^faqs/
]
options[:attribution] = <<-HTML
&copy; Nils Adermann, Jordi Boggiano<br>
Licensed under the MIT License.
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

@ -0,0 +1 @@
https://github.com/composer/getcomposer.org/blob/master/web/img/logo-composer-transparent.png