mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Add Composer
This commit is contained in:
parent
24abe4c9d9
commit
b98ab152c8
8 changed files with 98 additions and 0 deletions
|
@ -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',
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
._bower,
|
||||
._chai,
|
||||
._codeceptjs,
|
||||
._composer,
|
||||
._docker,
|
||||
._electron,
|
||||
._fish,
|
||||
|
|
25
lib/docs/filters/composer/clean_html.rb
Normal file
25
lib/docs/filters/composer/clean_html.rb
Normal 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
|
39
lib/docs/filters/composer/entries.rb
Normal file
39
lib/docs/filters/composer/entries.rb
Normal 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
|
27
lib/docs/scrapers/composer.rb
Normal file
27
lib/docs/scrapers/composer.rb
Normal 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
|
||||
© Nils Adermann, Jordi Boggiano<br>
|
||||
Licensed under the MIT License.
|
||||
HTML
|
||||
end
|
||||
end
|
BIN
public/icons/docs/composer/16.png
Normal file
BIN
public/icons/docs/composer/16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
public/icons/docs/composer/16@2x.png
Normal file
BIN
public/icons/docs/composer/16@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
1
public/icons/docs/composer/SOURCE
Normal file
1
public/icons/docs/composer/SOURCE
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/composer/getcomposer.org/blob/master/web/img/logo-composer-transparent.png
|
Loading…
Reference in a new issue