Unified · Split
| @@ -2,26 +2,9 @@ module Docs · 1 unmodified line | |||
| 2 | class Sequelize | 2 | class Sequelize |
| 3 | class CleanHtmlFilter < Filter | 3 | class CleanHtmlFilter < Filter |
| 4 | def call | 4 | def call |
| 5 | @doc = at_css('.content') | 5 | @doc = at_css('article', '.content') |
| 6 | 6 | ||
| 7 | # Clean up the home page | 7 | if at_css('header > h1') |
| 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 | ||
| 25 | # Pull the header out of its container | 8 | # Pull the header out of its container |
| 26 | header = at_css('h1') | 9 | header = at_css('h1') |
| 27 | header.parent.add_previous_sibling header | 10 | header.parent.add_previous_sibling header |
| @@ -36,18 +19,13 @@ module Docs · 8 unmodified lines | |||
| 36 | end | 19 | end |
| 37 | 20 | ||
| 38 | # Add syntax highlighting to code blocks | 21 | # Add syntax highlighting to code blocks |
| 39 | css('pre > code[class^="lang-"]').each do |node| | 22 | css('pre[class^="prism-code language-"]').each do |node| |
| 40 | pre = node.parent | 23 | node['data-language'] = node['class'][/language-(\w+)/, 1] if node['class'] and node['class'][/language-(\w+)/] |
| 41 | # Convert the existing language definitions to Prism-compatible attributes | 24 | node.content = node.css('.token-line').map(&:content).join("\n") |
| 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' | ||
| 47 | end | 25 | end |
| 48 | 26 | ||
| 49 | # Return the cleaned-up document | 27 | # Return the cleaned-up document |
| 50 | doc | 28 | at_css('.markdown') || doc |
| 51 | end | 29 | end |
| 52 | end | 30 | end |
| 53 | end | 31 | end |
| @@ -8,19 +8,19 @@ module Docs · 7 unmodified lines | |||
| 8 | 8 | ||
| 9 | # Assign the pages to main categories | 9 | # Assign the pages to main categories |
| 10 | def get_type | 10 | def get_type |
| 11 | if path.start_with?('manual/') | 11 | if base_url.path.include?('/docs/') |
| 12 | 'Manual' | 12 | 'Manual' |
| 13 | elsif path.include?('lib/data-types') | 13 | elsif path.include?('src/data-types') |
| 14 | 'datatypes' | 14 | 'datatypes' |
| 15 | elsif path.include?('lib/errors/validation') | 15 | elsif path.include?('src/errors/validation') |
| 16 | 'errors/validation' | 16 | 'errors/validation' |
| 17 | elsif path.include?('lib/errors/database') | 17 | elsif path.include?('src/errors/database') |
| 18 | 'errors/database' | 18 | 'errors/database' |
| 19 | elsif path.include?('lib/errors/connection') | 19 | elsif path.include?('src/errors/connection') |
| 20 | 'errors/connection' | 20 | 'errors/connection' |
| 21 | elsif path.include?('lib/errors') | 21 | elsif path.include?('src/errors') |
| 22 | 'errors' | 22 | 'errors' |
| 23 | elsif path.include?('lib/associations') | 23 | elsif path.include?('src/associations') |
| 24 | 'associations' | 24 | 'associations' |
| 25 | elsif path.include?('master/variable') | 25 | elsif path.include?('master/variable') |
| 26 | 'variables' | 26 | 'variables' |
| @@ -28,6 +28,11 @@ module Docs · 1 unmodified line | |||
| 28 | 'classes' | 28 | 'classes' |
| 29 | end | 29 | end |
| 30 | end | 30 | end |
| 31 | |||
| 32 | def include_default_entry? | ||
| 33 | at_css('.card > h2:contains("📄️")').nil? | ||
| 34 | end | ||
| 35 | |||
| 31 | end | 36 | end |
| 32 | end | 37 | end |
| 33 | end | 38 | end |
| @@ -1,5 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Sequelize < UrlScraper | 2 | class Sequelize < UrlScraper |
| 3 | include MultipleBaseUrls | ||
| 4 | |||
| 3 | self.name = 'Sequelize' | 5 | self.name = 'Sequelize' |
| 4 | self.slug = 'sequelize' | 6 | self.slug = 'sequelize' |
| 5 | self.type = 'simple' | 7 | self.type = 'simple' |
| @@ -20,9 +22,20 @@ module Docs · 14 unmodified lines | |||
| 20 | Licensed under the MIT License. | 22 | Licensed under the MIT License. |
| 21 | HTML | 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 | version '6' do | 32 | version '6' do |
| 24 | self.release = '6.5.0' | 33 | self.release = '6.23.2' |
| 25 | self.base_url = "https://sequelize.org/master/" | 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 | end | 39 | end |
| 27 | 40 | ||
| 28 | version '5' do | 41 | version '5' do |