Unified · Split
| @@ -8,9 +8,12 @@ class app.collections.Types extends app.Collection · 7 unmodified lines | |||
| 8 | result.filter (e) -> e.length > 0 | 8 | result.filter (e) -> e.length > 0 |
| 9 | 9 | ||
| 10 | GUIDES_RGX = /(^|\()(guides?|tutorials?|reference|book|getting\ started|manual)($|[\):])/i | 10 | GUIDES_RGX = /(^|\()(guides?|tutorials?|reference|book|getting\ started|manual)($|[\):])/i |
| 11 | APPENDIX_RGX = /appendix/i | ||
| 11 | 12 | ||
| 12 | _groupFor: (type) -> | 13 | _groupFor: (type) -> |
| 13 | if GUIDES_RGX.test(type.name) | 14 | if GUIDES_RGX.test(type.name) |
| 14 | 0 | 15 | 0 |
| 16 | else if APPENDIX_RGX.test(type.name) | ||
| 17 | 2 | ||
| 15 | else | 18 | else |
| 16 | 1 | 19 | 1 |
| @@ -6,9 +6,14 @@ · 5 unmodified lines | |||
| 6 | 6 | ||
| 7 | .VARIABLELIST dt { @extend %block-label, %label-blue; } | 7 | .VARIABLELIST dt { @extend %block-label, %label-blue; } |
| 8 | 8 | ||
| 9 | blockquote.NOTE, blockquote.IMPORTANT { @extend %note; } | 9 | blockquote.NOTE, blockquote.IMPORTANT, blockquote.TIP, blockquote.CAUTION { @extend %note; } |
| 10 | blockquote.TIP { @extend %note, %note-green; } | 10 | blockquote.TIP { @extend %note-green; } |
| 11 | blockquote.CAUTION { @extend %note-orange; } | ||
| 11 | 12 | ||
| 12 | p > code { @extend %label; } | 13 | p > code { @extend %label; } |
| 13 | p.c2 { font-weight: bold; } | 14 | p.c2 { font-weight: bold; } |
| 15 | |||
| 16 | .NAVFOOTER > table { width: 100%; } | ||
| 17 | td[align=center] { text-align: center; } | ||
| 18 | td[align=right] { text-align: right; } | ||
| 14 | } | 19 | } |
| @@ -13,24 +13,33 @@ module Docs · 12 unmodified lines | |||
| 13 | def other | 13 | def other |
| 14 | @doc = at_css('#docContent') | 14 | @doc = at_css('#docContent') |
| 15 | 15 | ||
| 16 | css('.NAVHEADER', '.NAVFOOTER').remove | 16 | css('.NAVHEADER', 'hr', '.NAVFOOTER a[accesskey="H"]').remove |
| 17 | 17 | ||
| 18 | css('a[name]').each do |node| | 18 | css('a[name]').each do |node| |
| 19 | node.parent['id'] = node['name'] | 19 | node.parent['id'] = node['name'] |
| 20 | node.before(node.children).remove | 20 | node.before(node.children).remove |
| 21 | end | 21 | end |
| 22 | 22 | ||
| 23 | css('div.SECT1', 'pre > kbd', 'tt > code', 'h1 > tt', '> .CHAPTER').each do |node| | 23 | css('div.SECT1', 'pre > kbd', 'tt > code', 'h1 > tt', '> .CHAPTER', 'div.NOTE', '.APPENDIX').each do |node| |
| 24 | node.before(node.children).remove | 24 | node.before(node.children).remove |
| 25 | end | 25 | end |
| 26 | 26 | ||
| 27 | css('div.CAUTION table.CAUTION').each do |node| | ||
| 28 | parent = node.parent | ||
| 29 | title = node.at_css('.c2, .c3, .c4, .c5').content | ||
| 30 | node.replace(node.css('p')) | ||
| 31 | parent.first_element_child.inner_html = "<strong>#{title}:</strong> #{parent.first_element_child.inner_html}" | ||
| 32 | parent.name = 'blockquote' | ||
| 33 | end | ||
| 34 | |||
| 27 | css('table').each do |node| | 35 | css('table').each do |node| |
| 28 | node.remove_attribute 'border' | 36 | node.remove_attribute 'border' |
| 29 | node.remove_attribute 'width' | 37 | node.remove_attribute 'width' |
| 38 | node.remove_attribute 'cellspacing' | ||
| 39 | node.remove_attribute 'cellpadding' | ||
| 30 | end | 40 | end |
| 31 | 41 | ||
| 32 | css('td').each do |node| | 42 | css('td').each do |node| |
| 33 | node.remove_attribute 'align' | ||
| 34 | node.remove_attribute 'valign' | 43 | node.remove_attribute 'valign' |
| 35 | end | 44 | end |
| 36 | 45 | ||
| @@ -4,6 +4,7 @@ module Docs · 3 unmodified lines | |||
| 4 | REPLACE_NAMES = { | 4 | REPLACE_NAMES = { |
| 5 | 'Sorting Rows' => 'ORDER BY', | 5 | 'Sorting Rows' => 'ORDER BY', |
| 6 | 'Select Lists' => 'SELECT Lists', | 6 | 'Select Lists' => 'SELECT Lists', |
| 7 | 'Comparison Functions and Operators' => 'Comparisons', | ||
| 7 | 'Data Type Formatting Functions' => 'Formatting Functions', | 8 | 'Data Type Formatting Functions' => 'Formatting Functions', |
| 8 | 'Enum Support Functions' => 'Enum Functions', | 9 | 'Enum Support Functions' => 'Enum Functions', |
| 9 | 'Row and Array Comparisons' => 'Array Comparisons', | 10 | 'Row and Array Comparisons' => 'Array Comparisons', |
| @@ -43,8 +44,14 @@ module Docs · 33 unmodified lines | |||
| 43 | @base_name ||= clean_heading_name(at_css('h1').content) | 44 | @base_name ||= clean_heading_name(at_css('h1').content) |
| 44 | end | 45 | end |
| 45 | 46 | ||
| 47 | def heading_level | ||
| 48 | @heading_level ||= at_css('h1').content.scan(/\d+(?=\.)/).last | ||
| 49 | end | ||
| 50 | |||
| 46 | def get_name | 51 | def get_name |
| 47 | if %w(Overview Introduction).include?(base_name) | 52 | if type.start_with?('Tutorial') |
| 53 | "#{heading_level}. #{base_name}" | ||
| 54 | elsif %w(Overview Introduction).include?(base_name) | ||
| 48 | result[:pg_chapter_name] | 55 | result[:pg_chapter_name] |
| 49 | elsif PREPEND_TYPES.include?(type) || type.start_with?('Internals') | 56 | elsif PREPEND_TYPES.include?(type) || type.start_with?('Internals') |
| 50 | "#{type.remove('Internals: ')}: #{base_name}" | 57 | "#{type.remove('Internals: ')}: #{base_name}" |
| @@ -58,17 +65,23 @@ module Docs · 7 unmodified lines | |||
| 58 | 65 | ||
| 59 | if result[:pg_up_path] == 'sql-commands.html' | 66 | if result[:pg_up_path] == 'sql-commands.html' |
| 60 | 'Commands' | 67 | 'Commands' |
| 68 | elsif result[:pg_up_path] == 'appendixes.html' | ||
| 69 | 'Appendixes' | ||
| 61 | elsif result[:pg_up_path].start_with?('reference-') | 70 | elsif result[:pg_up_path].start_with?('reference-') |
| 62 | 'Applications' | 71 | 'Applications' |
| 63 | elsif type = result[:pg_chapter_name] | 72 | elsif type = result[:pg_chapter_name] |
| 64 | if type.start_with?('Func') && (match = base_name.match(/\A(?!Form|Seq|Set|Enum)(.+) Func/)) | 73 | if type.start_with?('Func') && (match = base_name.match(/\A(?!Form|Seq|Set|Enum|Comp)(.+) Func/)) |
| 65 | "Functions: #{match[1]}" | 74 | "Functions: #{match[1]}" |
| 66 | else | 75 | else |
| 67 | type.remove! %r{\ASQL } | 76 | type.remove! %r{\ASQL } |
| 68 | type = REPLACE_TYPES[type] || type | 77 | type = REPLACE_TYPES[type] || type |
| 69 | type = "Internals: #{type}" if INTERNAL_TYPES.include?(type) | 78 | type.prepend 'Internals: ' if INTERNAL_TYPES.include?(type) |
| 79 | type.prepend 'Tutorial: ' if slug.start_with?('tutorial') | ||
| 70 | type | 80 | type |
| 71 | end | 81 | end |
| 82 | elsif type = result[:pg_appendix_name] | ||
| 83 | type.prepend 'Appendix: ' | ||
| 84 | type | ||
| 72 | end | 85 | end |
| 73 | end | 86 | end |
| 74 | 87 | ||
| @@ -97,9 +110,15 @@ module Docs · 22 unmodified lines | |||
| 97 | entries.concat get_custom_entries('> div[id^="FUNC"] td:first-child > code') | 110 | entries.concat get_custom_entries('> div[id^="FUNC"] td:first-child > code') |
| 98 | else | 111 | else |
| 99 | if type && type.start_with?('Functions') | 112 | if type && type.start_with?('Functions') |
| 100 | entries.concat get_custom_entries('> .TABLE td:first-child > code:first-child') | 113 | entries.concat get_custom_entries('> .TABLE td:first-child > code.LITERAL:first-child') |
| 101 | entries.concat get_custom_entries('> .TABLE td:first-child > p > code:first-child') | 114 | entries.concat get_custom_entries('> .TABLE td:first-child > code.FUNCTION:first-child') |
| 102 | entries.concat %w(IS NULL BETWEEN DISTINCT\ FROM).map { |name| ["#{self.name}: #{name}"] } if slug == 'functions-comparison' | 115 | entries.concat get_custom_entries('> .TABLE td:first-child > code:not(.LITERAL):first-child + code.LITERAL') |
| 116 | entries.concat get_custom_entries('> .TABLE td:first-child > p > code.LITERAL:first-child') | ||
| 117 | entries.concat get_custom_entries('> .TABLE td:first-child > p > code.FUNCTION:first-child') | ||
| 118 | entries.concat get_custom_entries('> .TABLE td:first-child > p > code:not(.LITERAL):first-child + code.LITERAL') | ||
| 119 | if slug == 'functions-comparison' && !at_css('#FUNCTIONS-COMPARISON-PRED-TABLE') # before 9.6 | ||
| 120 | entries.concat %w(IS NULL BETWEEN DISTINCT\ FROM).map { |name| ["#{self.name}: #{name}"] } | ||
| 121 | end | ||
| 103 | end | 122 | end |
| 104 | end | 123 | end |
| 105 | 124 | ||
| @@ -157,12 +176,18 @@ module Docs · 51 unmodified lines | |||
| 157 | 176 | ||
| 158 | def skip_additional_entries? | 177 | def skip_additional_entries? |
| 159 | return true unless type | 178 | return true unless type |
| 160 | SKIP_ENTRIES_SLUGS.include?(slug) || SKIP_ENTRIES_TYPES.include?(type) || type.start_with?('Internals') | 179 | SKIP_ENTRIES_SLUGS.include?(slug) || |
| 180 | SKIP_ENTRIES_TYPES.include?(type) || | ||
| 181 | type.start_with?('Internals') || | ||
| 182 | type.start_with?('Tutorial') || | ||
| 183 | type.start_with?('Appendix') | ||
| 161 | end | 184 | end |
| 162 | 185 | ||
| 163 | def clean_heading_name(name) | 186 | def clean_heading_name(name) |
| 164 | name.remove! 'Chapter ' | 187 | name.remove! 'Chapter ' |
| 165 | name.remove! %r{\A[\d\.\s]+} | 188 | name.remove! %r{\A[\d\.\s]+} |
| 189 | name.remove! 'Appendix ' | ||
| 190 | name.remove! %r{\A[A-Z]\.[\d\.\s]*} | ||
| 166 | name.remove! 'Using ' | 191 | name.remove! 'Using ' |
| 167 | name.remove! %r{\AThe } | 192 | name.remove! %r{\AThe } |
| 168 | name.remove! ' (Common Table Expressions)' | 193 | name.remove! ' (Common Table Expressions)' |
| @@ -185,7 +210,7 @@ module Docs · 16 unmodified lines | |||
| 185 | name.squeeze! ' ' | 210 | name.squeeze! ' ' |
| 186 | name.remove! %r{\([^\)]*\z} # bug fix: json_populate_record | 211 | name.remove! %r{\([^\)]*\z} # bug fix: json_populate_record |
| 187 | name = '||' if name.include? ' || ' | 212 | name = '||' if name.include? ' || ' |
| 188 | id = name.gsub(/[^a-z0-9\-_]/) { |char| char.ord } | 213 | id = name.gsub(/[^a-zA-Z0-9\-_]/) { |char| char.ord } |
| 189 | id = id.parameterize | 214 | id = id.parameterize |
| 190 | name.prepend "#{additional_entry_prefix}: " | 215 | name.prepend "#{additional_entry_prefix}: " |
| 191 | 216 | ||
| @@ -15,9 +15,13 @@ module Docs · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | def extract_chapter | 16 | def extract_chapter |
| 17 | return unless text = at_css('.NAVHEADER td[align="center"]').content | 17 | return unless text = at_css('.NAVHEADER td[align="center"]').content |
| 18 | return unless match = text.match(/\AChapter (\d+)\. (.+)\z/) | 18 | if match = text.match(/\AChapter (\d+)\. (.+)\z/) |
| 19 | result[:pg_chapter] = match[1].to_i | 19 | result[:pg_chapter] = match[1].to_i |
| 20 | result[:pg_chapter_name] = match[2].strip | 20 | result[:pg_chapter_name] = match[2].strip |
| 21 | elsif match = text.match(/\AAppendix ([A-Z])\. (.+)\z/) | ||
| 22 | result[:pg_appendix] = match[1] | ||
| 23 | result[:pg_appendix_name] = match[2].strip | ||
| 24 | end | ||
| 21 | end | 25 | end |
| 22 | end | 26 | end |
| 23 | end | 27 | end |
| @@ -5,7 +5,7 @@ module Docs · 4 unmodified lines | |||
| 5 | self.name = 'PostgreSQL' | 5 | self.name = 'PostgreSQL' |
| 6 | self.type = 'postgres' | 6 | self.type = 'postgres' |
| 7 | self.root_path = 'reference.html' | 7 | self.root_path = 'reference.html' |
| 8 | self.initial_paths = %w(sql.html admin.html internals.html) | 8 | self.initial_paths = %w(sql.html admin.html internals.html appendixes.html tutorial.html) |
| 9 | 9 | ||
| 10 | html_filters.insert_before 'normalize_urls', 'postgresql/extract_metadata' | 10 | html_filters.insert_before 'normalize_urls', 'postgresql/extract_metadata' |
| 11 | html_filters.push 'postgresql/clean_html', 'postgresql/entries', 'title' | 11 | html_filters.push 'postgresql/clean_html', 'postgresql/entries', 'title' |
| @@ -23,10 +23,13 @@ module Docs · 11 unmodified lines | |||
| 23 | supported-platforms.html | 23 | supported-platforms.html |
| 24 | error-message-reporting.html | 24 | error-message-reporting.html |
| 25 | error-style-guide.html | 25 | error-style-guide.html |
| 26 | plhandler.html) | 26 | plhandler.html |
| 27 | sourcerepo.html | ||
| 28 | git.html | ||
| 29 | bug-reporting.html | ||
| 30 | client-interfaces.html) | ||
| 27 | 31 | ||
| 28 | options[:skip_patterns] = [ | 32 | options[:skip_patterns] = [ |
| 29 | /\Atutorial/, | ||
| 30 | /\Ainstall/, | 33 | /\Ainstall/, |
| 31 | /\Aregress/, | 34 | /\Aregress/, |
| 32 | /\Aprotocol/, | 35 | /\Aprotocol/, |
| @@ -35,21 +38,32 @@ module Docs · 2 unmodified lines | |||
| 35 | /\Afdw/, | 38 | /\Afdw/, |
| 36 | /\Atablesample/, | 39 | /\Atablesample/, |
| 37 | /\Acustom-scan/, | 40 | /\Acustom-scan/, |
| 38 | /\Abki/ ] | 41 | /\Abki/, |
| 42 | /\Arelease/, | ||
| 43 | /\Acontrib-prog/, | ||
| 44 | /\Aexternal/, | ||
| 45 | /\Adocguide/, | ||
| 46 | /\Afeatures/, | ||
| 47 | /\Aunsupported-features/ ] | ||
| 39 | 48 | ||
| 40 | options[:attribution] = <<-HTML | 49 | options[:attribution] = <<-HTML |
| 41 | © 1996–2016 The PostgreSQL Global Development Group<br> | 50 | © 1996–2016 The PostgreSQL Global Development Group<br> |
| 42 | Licensed under the PostgreSQL License. | 51 | Licensed under the PostgreSQL License. |
| 43 | HTML | 52 | HTML |
| 44 | 53 | ||
| 54 | version '9.6' do | ||
| 55 | self.release = '9.6.0' | ||
| 56 | self.base_url = 'https://www.postgresql.org/docs/9.6/static/' | ||
| 57 | end | ||
| 58 | |||
| 45 | version '9.5' do | 59 | version '9.5' do |
| 46 | self.release = '9.5' | 60 | self.release = '9.5.4' |
| 47 | self.base_url = 'http://www.postgresql.org/docs/9.5/static/' | 61 | self.base_url = 'https://www.postgresql.org/docs/9.5/static/' |
| 48 | end | 62 | end |
| 49 | 63 | ||
| 50 | version '9.4' do | 64 | version '9.4' do |
| 51 | self.release = '9.4' | 65 | self.release = '9.4.9' |
| 52 | self.base_url = 'http://www.postgresql.org/docs/9.4/static/' | 66 | self.base_url = 'https://www.postgresql.org/docs/9.4/static/' |
| 53 | end | 67 | end |
| 54 | end | 68 | end |
| 55 | end | 69 | end |