mirror of https://github.com/freeCodeCamp/devdocs
parent
dd0cc071dc
commit
2bdf3a05d0
@ -0,0 +1,33 @@
|
||||
module Docs
|
||||
class Sequelize
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
# Clean up the home page
|
||||
if root_page?
|
||||
# Remove logo
|
||||
css('.manual-user-index > div > div.logo').remove
|
||||
# Convert title to proper H1 element
|
||||
at_css('.manual-user-index > div > div.sequelize').name = 'h1'
|
||||
# Remove badges (NPM, Travis, test coverage, etc.)
|
||||
css('.manual-user-index > p:nth-child(4)').remove
|
||||
# Remove image cards pointing to entries of the manual
|
||||
css('.manual-cards').remove
|
||||
end
|
||||
|
||||
# Add syntax highlighting to code blocks
|
||||
css('pre > code[class^="lang-"]').each do |node|
|
||||
pre = node.parent
|
||||
# Convert the existing language definitions to Prism-compatible attributes
|
||||
pre['data-language'] = 'javascript' if node['class'] == 'lang-js' || node['class'] == 'lang-javascript'
|
||||
pre['data-language'] = 'json' if node['class'] == 'lang-json'
|
||||
pre['data-language'] = 'shell' if node['class'] == 'lang-sh' || node['class'] == 'lang-bash'
|
||||
pre['data-language'] = 'sql' if node['class'] == 'lang-sql'
|
||||
pre['data-language'] = 'typescript' if node['class'] == 'lang-ts'
|
||||
end
|
||||
|
||||
# Return the cleaned-up document
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,26 @@
|
||||
module Docs
|
||||
class Sequelize
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
# Use the main title as the page name
|
||||
def get_name
|
||||
at_css('h1').text
|
||||
end
|
||||
|
||||
# Assign the pages to main categories
|
||||
def get_type
|
||||
if path.start_with?('manual/')
|
||||
type = 'Manual'
|
||||
elsif path.start_with?('file/lib/')
|
||||
type = 'Source files'
|
||||
else
|
||||
# API Reference pages. The `path` for most of these starts with 'class/lib/',
|
||||
# but there's also 'variable/index' (pseudo-classes), and 'identifiers' (the main index)
|
||||
# so we use an unqualified `else` as a catch-all.
|
||||
type = 'Reference'
|
||||
end
|
||||
|
||||
type
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,30 @@
|
||||
module Docs
|
||||
class Sequelize < UrlScraper
|
||||
self.name = 'Sequelize'
|
||||
self.slug = 'sequelize'
|
||||
self.type = 'simple'
|
||||
self.release = '5.19.6'
|
||||
self.base_url = 'https://sequelize.org/master/'
|
||||
self.links = {
|
||||
home: 'https://sequelize.org/',
|
||||
code: 'https://github.com/sequelize/sequelize/'
|
||||
}
|
||||
|
||||
# List of content filters (to be applied sequentially)
|
||||
html_filters.push 'sequelize/entries', 'sequelize/clean_html'
|
||||
|
||||
# Wrapper element that holds the main content
|
||||
options[:container] = '.content'
|
||||
|
||||
# License information that appears appears at the bottom of the entry page
|
||||
options[:attribution] = <<-HTML
|
||||
Copyright © 2014–present Sequelize contributors<br>
|
||||
Licensed under the MIT License.
|
||||
HTML
|
||||
|
||||
# Method to fetch the most recent version of the project
|
||||
def get_latest_version(opts)
|
||||
get_npm_version('sequelize', opts)
|
||||
end
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 37 KiB |
@ -0,0 +1 @@
|
||||
https://github.com/sequelize/sequelize/blob/master/docs/images/logo.png
|
Loading…
Reference in new issue