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