Unified · Split
| @@ -2,16 +2,37 @@ 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') | ||
| 6 | |||
| 5 | # Clean up the home page | 7 | # Clean up the home page |
| 6 | if root_page? | 8 | if root_page? || subpath == "index.html" |
| 7 | # Remove logo | 9 | # Remove logo |
| 8 | css('.manual-user-index > div > div.logo').remove | 10 | css('.manual-user-index > div > div.logo').remove |
| 9 | # Convert title to proper H1 element | 11 | |
| 12 | # Convert title to proper h1 element | ||
| 10 | at_css('.manual-user-index > div > div.sequelize').name = 'h1' | 13 | at_css('.manual-user-index > div > div.sequelize').name = 'h1' |
| 14 | |||
| 11 | # Remove badges (NPM, Travis, test coverage, etc.) | 15 | # Remove badges (NPM, Travis, test coverage, etc.) |
| 12 | css('.manual-user-index > p:nth-child(4)').remove | 16 | css('.manual-user-index > p:nth-child(4)').remove |
| 17 | |||
| 13 | # Remove image cards pointing to entries of the manual | 18 | # Remove image cards pointing to entries of the manual |
| 14 | css('.manual-cards').remove | 19 | css('.manual-cards').remove |
| 20 | |||
| 21 | # Pull the header out of it's container | ||
| 22 | header = at_css('h1') | ||
| 23 | header.parent.parent.parent.add_previous_sibling header | ||
| 24 | else | ||
| 25 | # Pull the header out of it's container | ||
| 26 | header = at_css('h1') | ||
| 27 | header.parent.add_previous_sibling header | ||
| 28 | end | ||
| 29 | |||
| 30 | # Remove header notice | ||
| 31 | css('.header-notice').remove | ||
| 32 | |||
| 33 | # Change td in thead to th | ||
| 34 | css('table > thead > tr > td').each do |node| | ||
| 35 | node.name = 'th' | ||
| 15 | end | 36 | end |
| 16 | 37 | ||
| 17 | # Add syntax highlighting to code blocks | 38 | # Add syntax highlighting to code blocks |
| @@ -9,17 +9,24 @@ module Docs · 8 unmodified lines | |||
| 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 path.start_with?('manual/') |
| 12 | type = 'Manual' | 12 | 'Manual' |
| 13 | elsif path.start_with?('file/lib/') | 13 | elsif path.include?('lib/data-types') |
| 14 | type = 'Source files' | 14 | 'datatypes' |
| 15 | elsif path.include?('lib/errors/validation') | ||
| 16 | 'errors/validation' | ||
| 17 | elsif path.include?('lib/errors/database') | ||
| 18 | 'errors/database' | ||
| 19 | elsif path.include?('lib/errors/connection') | ||
| 20 | 'errors/connection' | ||
| 21 | elsif path.include?('lib/errors') | ||
| 22 | 'errors' | ||
| 23 | elsif path.include?('lib/associations') | ||
| 24 | 'associations' | ||
| 25 | elsif path.include?('master/variable') | ||
| 26 | 'variables' | ||
| 15 | else | 27 | else |
| 16 | # API Reference pages. The `path` for most of these starts with 'class/lib/', | 28 | 'classes' |
| 17 | # but there's also 'variable/index' (pseudo-classes), and 'identifiers' (the main index) | ||
| 18 | # so we use an unqualified `else` as a catch-all. | ||
| 19 | type = 'Reference' | ||
| 20 | end | 29 | end |
| 21 | |||
| 22 | type | ||
| 23 | end | 30 | end |
| 24 | end | 31 | end |
| 25 | end | 32 | end |
| @@ -3,18 +3,18 @@ module Docs · 2 unmodified lines | |||
| 3 | self.name = 'Sequelize' | 3 | self.name = 'Sequelize' |
| 4 | self.slug = 'sequelize' | 4 | self.slug = 'sequelize' |
| 5 | self.type = 'simple' | 5 | self.type = 'simple' |
| 6 | self.release = '5.19.6' | 6 | self.release = '5.21.1' |
| 7 | self.base_url = 'https://sequelize.org/master/' | 7 | self.base_url = 'https://sequelize.org/master/' |
| 8 | self.links = { | 8 | self.links = { |
| 9 | home: 'https://sequelize.org/', | 9 | home: 'https://sequelize.org/', |
| 10 | code: 'https://github.com/sequelize/sequelize/' | 10 | code: 'https://github.com/sequelize/sequelize' |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | # List of content filters (to be applied sequentially) | 13 | # List of content filters (to be applied sequentially) |
| 14 | html_filters.push 'sequelize/entries', 'sequelize/clean_html' | 14 | html_filters.push 'sequelize/entries', 'sequelize/clean_html' |
| 15 | 15 | ||
| 16 | # Wrapper element that holds the main content | 16 | # Skip the source files, the license page and the "Who's using Sequelize" page |
| 17 | options[:container] = '.content' | 17 | options[:skip_patterns] = [/\.js\.html/, /manual\/legal\.html/, /manual\/whos-using\.html/] |
| 18 | 18 | ||
| 19 | # License information that appears appears at the bottom of the entry page | 19 | # License information that appears appears at the bottom of the entry page |
| 20 | options[:attribution] = <<-HTML | 20 | options[:attribution] = <<-HTML |