Unified · Split
| @@ -2,26 +2,9 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Sequelize |
| 3 | 3 | class CleanHtmlFilter < Filter |
| 4 | 4 | def call |
| 5 | − @doc = at_css('.content') | |
| 5 | + @doc = at_css('article', '.content') | |
| 6 | 6 | |
| 7 | − # Clean up the home page | |
| 8 | − if root_page? || subpath == "index.html" | |
| 9 | − # Remove logo | |
| 10 | − css('.manual-user-index > div > div.logo').remove | |
| 11 | − | |
| 12 | − # Convert title to proper h1 element | |
| 13 | − at_css('.manual-user-index > div > div.sequelize').name = 'h1' | |
| 14 | − | |
| 15 | − # Remove badges (NPM, Travis, test coverage, etc.) | |
| 16 | − css('.manual-user-index > p:nth-child(4)').remove | |
| 17 | − | |
| 18 | − # Remove image cards pointing to entries of the manual | |
| 19 | − css('.manual-cards').remove | |
| 20 | − | |
| 21 | − # Pull the header out of its container | |
| 22 | − header = at_css('h1') | |
| 23 | − header.parent.parent.parent.add_previous_sibling header | |
| 24 | − else | |
| 7 | + if at_css('header > h1') | |
| 25 | 8 | # Pull the header out of its container |
| 26 | 9 | header = at_css('h1') |
| 27 | 10 | header.parent.add_previous_sibling header |
| @@ -36,18 +19,13 @@ module Docs · 8 unmodified lines | ||
| 36 | 19 | end |
| 37 | 20 | |
| 38 | 21 | # Add syntax highlighting to code blocks |
| 39 | − css('pre > code[class^="lang-"]').each do |node| | |
| 40 | − pre = node.parent | |
| 41 | − # Convert the existing language definitions to Prism-compatible attributes | |
| 42 | − pre['data-language'] = 'javascript' if node['class'] == 'lang-js' || node['class'] == 'lang-javascript' | |
| 43 | − pre['data-language'] = 'json' if node['class'] == 'lang-json' | |
| 44 | − pre['data-language'] = 'shell' if node['class'] == 'lang-sh' || node['class'] == 'lang-bash' | |
| 45 | − pre['data-language'] = 'sql' if node['class'] == 'lang-sql' | |
| 46 | − pre['data-language'] = 'typescript' if node['class'] == 'lang-ts' | |
| 22 | + css('pre[class^="prism-code language-"]').each do |node| | |
| 23 | + node['data-language'] = node['class'][/language-(\w+)/, 1] if node['class'] and node['class'][/language-(\w+)/] | |
| 24 | + node.content = node.css('.token-line').map(&:content).join("\n") | |
| 47 | 25 | end |
| 48 | 26 | |
| 49 | 27 | # Return the cleaned-up document |
| 50 | − doc | |
| 28 | + at_css('.markdown') || doc | |
| 51 | 29 | end |
| 52 | 30 | end |
| 53 | 31 | end |
| @@ -8,19 +8,19 @@ module Docs · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | # Assign the pages to main categories |
| 10 | 10 | def get_type |
| 11 | − if path.start_with?('manual/') | |
| 11 | + if base_url.path.include?('/docs/') | |
| 12 | 12 | 'Manual' |
| 13 | − elsif path.include?('lib/data-types') | |
| 13 | + elsif path.include?('src/data-types') | |
| 14 | 14 | 'datatypes' |
| 15 | − elsif path.include?('lib/errors/validation') | |
| 15 | + elsif path.include?('src/errors/validation') | |
| 16 | 16 | 'errors/validation' |
| 17 | − elsif path.include?('lib/errors/database') | |
| 17 | + elsif path.include?('src/errors/database') | |
| 18 | 18 | 'errors/database' |
| 19 | − elsif path.include?('lib/errors/connection') | |
| 19 | + elsif path.include?('src/errors/connection') | |
| 20 | 20 | 'errors/connection' |
| 21 | − elsif path.include?('lib/errors') | |
| 21 | + elsif path.include?('src/errors') | |
| 22 | 22 | 'errors' |
| 23 | − elsif path.include?('lib/associations') | |
| 23 | + elsif path.include?('src/associations') | |
| 24 | 24 | 'associations' |
| 25 | 25 | elsif path.include?('master/variable') |
| 26 | 26 | 'variables' |
| @@ -28,6 +28,11 @@ module Docs · 1 unmodified line | ||
| 28 | 28 | 'classes' |
| 29 | 29 | end |
| 30 | 30 | end |
| 31 | + | |
| 32 | + def include_default_entry? | |
| 33 | + at_css('.card > h2:contains("📄️")').nil? | |
| 34 | + end | |
| 35 | + | |
| 31 | 36 | end |
| 32 | 37 | end |
| 33 | 38 | end |
| @@ -1,5 +1,7 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class Sequelize < UrlScraper |
| 3 | + include MultipleBaseUrls | |
| 4 | + | |
| 3 | 5 | self.name = 'Sequelize' |
| 4 | 6 | self.slug = 'sequelize' |
| 5 | 7 | self.type = 'simple' |
| @@ -20,9 +22,20 @@ module Docs · 14 unmodified lines | ||
| 20 | 22 | Licensed under the MIT License. |
| 21 | 23 | HTML |
| 22 | 24 | |
| 25 | + def initial_urls | |
| 26 | + [ | |
| 27 | + "https://sequelize.org/docs/v6/", | |
| 28 | + "https://sequelize.org/api/v6/identifiers.html", | |
| 29 | + ] | |
| 30 | + end | |
| 31 | + | |
| 23 | 32 | version '6' do |
| 24 | − self.release = '6.5.0' | |
| 25 | − self.base_url = "https://sequelize.org/master/" | |
| 33 | + self.release = '6.23.2' | |
| 34 | + self.base_url = "https://sequelize.org/docs/v6/" | |
| 35 | + self.base_urls = [ | |
| 36 | + "https://sequelize.org/docs/v6/", | |
| 37 | + "https://sequelize.org/api/v6/", | |
| 38 | + ] | |
| 26 | 39 | end |
| 27 | 40 | |
| 28 | 41 | version '5' do |