Unified · Split
| @@ -321,7 +321,7 @@ credits = [ · 320 unmodified lines | |||
| 321 | 'https://creativecommons.org/licenses/by/3.0/' | 321 | 'https://creativecommons.org/licenses/by/3.0/' |
| 322 | ], [ | 322 | ], [ |
| 323 | 'PostgreSQL', | 323 | 'PostgreSQL', |
| 324 | '1996-2013 The PostgreSQL Global Development Group<br>© 1994 The Regents of the University of California', | 324 | '1996-2016 The PostgreSQL Global Development Group<br>© 1994 The Regents of the University of California', |
| 325 | 'PostgreSQL', | 325 | 'PostgreSQL', |
| 326 | 'http://www.postgresql.org/about/licence/' | 326 | 'http://www.postgresql.org/about/licence/' |
| 327 | ], [ | 327 | ], [ |
| @@ -10,4 +10,5 @@ · 9 unmodified lines | |||
| 10 | blockquote.TIP { @extend %note, %note-green; } | 10 | blockquote.TIP { @extend %note, %note-green; } |
| 11 | 11 | ||
| 12 | p > code { @extend %label; } | 12 | p > code { @extend %label; } |
| 13 | p.c2 { font-weight: bold; } | ||
| 13 | } | 14 | } |
| @@ -20,7 +20,7 @@ module Docs · 19 unmodified lines | |||
| 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').each do |node| | 23 | css('div.SECT1', 'pre > kbd', 'tt > code', 'h1 > tt', '> .CHAPTER').each do |node| |
| 24 | node.before(node.children).remove | 24 | node.before(node.children).remove |
| 25 | end | 25 | end |
| 26 | 26 | ||
| @@ -23,7 +23,21 @@ module Docs · 22 unmodified lines | |||
| 23 | 'High Availability, Load Balancing, and Replication' => 'High Availability', | 23 | 'High Availability, Load Balancing, and Replication' => 'High Availability', |
| 24 | 'Monitoring Database Activity' => 'Monitoring', | 24 | 'Monitoring Database Activity' => 'Monitoring', |
| 25 | 'Monitoring Disk Usage' => 'Monitoring', | 25 | 'Monitoring Disk Usage' => 'Monitoring', |
| 26 | 'Reliability and the Write-Ahead Log' => 'Write-Ahead Log' } | 26 | 'Reliability and the Write-Ahead Log' => 'Write-Ahead Log', |
| 27 | 'Overview of PostgreSQL Internals' => 'Internals', | ||
| 28 | 'System Catalogs' => 'Internals: Catalogs', | ||
| 29 | 'How the Planner Uses Statistics' => 'Internals', | ||
| 30 | 'Index Access Method Interface Definition' => 'Index Access Method', | ||
| 31 | 'Database Physical Storage' => 'Physical Storage' } | ||
| 32 | |||
| 33 | INTERNAL_TYPES = [ | ||
| 34 | 'Genetic Query Optimizer', | ||
| 35 | 'Index Access Method', | ||
| 36 | 'GiST Indexes', | ||
| 37 | 'SP-GiST Indexes', | ||
| 38 | 'GIN Indexes', | ||
| 39 | 'BRIN Indexes', | ||
| 40 | 'Physical Storage' ] | ||
| 27 | 41 | ||
| 28 | def base_name | 42 | def base_name |
| 29 | @base_name ||= clean_heading_name(at_css('h1').content) | 43 | @base_name ||= clean_heading_name(at_css('h1').content) |
| @@ -32,8 +46,8 @@ module Docs · 2 unmodified lines | |||
| 32 | def get_name | 46 | def get_name |
| 33 | if %w(Overview Introduction).include?(base_name) | 47 | if %w(Overview Introduction).include?(base_name) |
| 34 | result[:pg_chapter_name] | 48 | result[:pg_chapter_name] |
| 35 | elsif PREPEND_TYPES.include?(type) | 49 | elsif PREPEND_TYPES.include?(type) || type.start_with?('Internals') |
| 36 | "#{type}: #{base_name}" | 50 | "#{type.remove('Internals: ')}: #{base_name}" |
| 37 | else | 51 | else |
| 38 | REPLACE_NAMES[base_name] || base_name | 52 | REPLACE_NAMES[base_name] || base_name |
| 39 | end | 53 | end |
| @@ -50,8 +64,10 @@ module Docs · 10 unmodified lines | |||
| 50 | if type.start_with?('Func') && (match = base_name.match(/\A(?!Form|Seq|Set|Enum)(.+) Func/)) | 64 | if type.start_with?('Func') && (match = base_name.match(/\A(?!Form|Seq|Set|Enum)(.+) Func/)) |
| 51 | "Functions: #{match[1]}" | 65 | "Functions: #{match[1]}" |
| 52 | else | 66 | else |
| 53 | type.remove! 'SQL ' | 67 | type.remove! %r{\ASQL } |
| 54 | REPLACE_TYPES[type] || type | 68 | type = REPLACE_TYPES[type] || type |
| 69 | type = "Internals: #{type}" if INTERNAL_TYPES.include?(type) | ||
| 70 | type | ||
| 55 | end | 71 | end |
| 56 | end | 72 | end |
| 57 | end | 73 | end |
| @@ -60,6 +76,7 @@ module Docs · 2 unmodified lines | |||
| 60 | return [] if skip_additional_entries? | 76 | return [] if skip_additional_entries? |
| 61 | return config_additional_entries if type && type.include?('Configuration') | 77 | return config_additional_entries if type && type.include?('Configuration') |
| 62 | return data_types_additional_entries if type == 'Data Types' | 78 | return data_types_additional_entries if type == 'Data Types' |
| 79 | return command_additional_entries if type == 'Commands' | ||
| 63 | return get_heading_entries('h3[id]') if slug == 'functions-xml' | 80 | return get_heading_entries('h3[id]') if slug == 'functions-xml' |
| 64 | 81 | ||
| 65 | entries = get_heading_entries('h2[id]') | 82 | entries = get_heading_entries('h2[id]') |
| @@ -81,6 +98,7 @@ module Docs · 15 unmodified lines | |||
| 81 | else | 98 | else |
| 82 | if type && type.start_with?('Functions') | 99 | if type && type.start_with?('Functions') |
| 83 | entries.concat get_custom_entries('> .TABLE td:first-child > code:first-child') | 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') | ||
| 84 | entries.concat %w(IS NULL BETWEEN DISTINCT\ FROM).map { |name| ["#{self.name}: #{name}"] } if slug == 'functions-comparison' | 102 | entries.concat %w(IS NULL BETWEEN DISTINCT\ FROM).map { |name| ["#{self.name}: #{name}"] } if slug == 'functions-comparison' |
| 85 | end | 103 | end |
| 86 | end | 104 | end |
| @@ -107,8 +125,18 @@ module Docs · 20 unmodified lines | |||
| 107 | get_custom_entries(selector) | 125 | get_custom_entries(selector) |
| 108 | end | 126 | end |
| 109 | 127 | ||
| 128 | def command_additional_entries | ||
| 129 | css('.REFSECT2[id^="SQL"]').each_with_object([]) do |node, entries| | ||
| 130 | next unless heading = node.at_css('h3') | ||
| 131 | next unless heading.content.strip =~ /[A-Z_\-]+ Clause/ | ||
| 132 | name = heading.at_css('.LITERAL').content | ||
| 133 | name.prepend "#{self.name} ... " | ||
| 134 | entries << [name, node['id']] | ||
| 135 | end | ||
| 136 | end | ||
| 137 | |||
| 110 | def include_default_entry? | 138 | def include_default_entry? |
| 111 | !initial_page? && !at_css('.TOC') | 139 | !initial_page? && !at_css('.TOC') && type |
| 112 | end | 140 | end |
| 113 | 141 | ||
| 114 | SKIP_ENTRIES_SLUGS = [ | 142 | SKIP_ENTRIES_SLUGS = [ |
| @@ -128,10 +156,12 @@ module Docs · 13 unmodified lines | |||
| 128 | 'Monitoring' ] | 156 | 'Monitoring' ] |
| 129 | 157 | ||
| 130 | def skip_additional_entries? | 158 | def skip_additional_entries? |
| 131 | SKIP_ENTRIES_SLUGS.include?(slug) || SKIP_ENTRIES_TYPES.include?(type) | 159 | return true unless type |
| 160 | SKIP_ENTRIES_SLUGS.include?(slug) || SKIP_ENTRIES_TYPES.include?(type) || type.start_with?('Internals') | ||
| 132 | end | 161 | end |
| 133 | 162 | ||
| 134 | def clean_heading_name(name) | 163 | def clean_heading_name(name) |
| 164 | name.remove! 'Chapter ' | ||
| 135 | name.remove! %r{\A[\d\.\s]+} | 165 | name.remove! %r{\A[\d\.\s]+} |
| 136 | name.remove! 'Using ' | 166 | name.remove! 'Using ' |
| 137 | name.remove! %r{\AThe } | 167 | name.remove! %r{\AThe } |
| @@ -17,7 +17,7 @@ module Docs · 16 unmodified lines | |||
| 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 | return unless 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] | 20 | result[:pg_chapter_name] = match[2].strip |
| 21 | end | 21 | end |
| 22 | end | 22 | end |
| 23 | end | 23 | end |
| @@ -1,11 +1,11 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Postgresql < UrlScraper | 2 | class Postgresql < UrlScraper |
| 3 | include FixInternalUrlsBehavior | ||
| 4 | |||
| 3 | self.name = 'PostgreSQL' | 5 | self.name = 'PostgreSQL' |
| 4 | self.type = 'postgres' | 6 | self.type = 'postgres' |
| 5 | self.release = '9.4' | ||
| 6 | self.base_url = "http://www.postgresql.org/docs/#{release}/static/" | ||
| 7 | self.root_path = 'reference.html' | 7 | self.root_path = 'reference.html' |
| 8 | self.initial_paths = %w(sql.html admin.html) | 8 | self.initial_paths = %w(sql.html admin.html internals.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' |
| @@ -14,61 +14,42 @@ module Docs · 2 unmodified lines | |||
| 14 | options[:root_title] = 'PostgreSQL' | 14 | options[:root_title] = 'PostgreSQL' |
| 15 | options[:follow_links] = ->(filter) { filter.initial_page? } | 15 | options[:follow_links] = ->(filter) { filter.initial_page? } |
| 16 | 16 | ||
| 17 | options[:only] = %w( | ||
| 18 | arrays.html | ||
| 19 | rowtypes.html | ||
| 20 | rangetypes.html | ||
| 21 | transaction-iso.html | ||
| 22 | explicit-locking.html | ||
| 23 | applevel-consistency.html | ||
| 24 | locking-indexes.html | ||
| 25 | config-setting.html | ||
| 26 | locale.html | ||
| 27 | collation.html | ||
| 28 | multibyte.html | ||
| 29 | using-explain.html | ||
| 30 | planner-stats.html | ||
| 31 | explicit-joins.html | ||
| 32 | populate.html | ||
| 33 | non-durability.html | ||
| 34 | logfile-maintenance.html | ||
| 35 | continuous-archiving.html | ||
| 36 | dynamic-trace.html) | ||
| 37 | |||
| 38 | options[:only_patterns] = [ | ||
| 39 | /\Asql\-/, | ||
| 40 | /\Aapp\-/, | ||
| 41 | /\Addl\-/, | ||
| 42 | /\Adml\-/, | ||
| 43 | /\Aqueries\-/, | ||
| 44 | /\Adatatype\-/, | ||
| 45 | /\Afunctions\-/, | ||
| 46 | /\Atypeconv\-/, | ||
| 47 | /\Atextsearch\-/, | ||
| 48 | /\Amvcc\-/, | ||
| 49 | /\Aindexes\-/, | ||
| 50 | /\Aruntime\-config\-/, | ||
| 51 | /\Aauth\-/, | ||
| 52 | /\Aclient\-authentication/, | ||
| 53 | /\Amanage\-ag/, | ||
| 54 | /\Aroutine/, | ||
| 55 | /\Abackup\-/, | ||
| 56 | /\Amonitoring\-/, | ||
| 57 | /\Awal\-/, | ||
| 58 | /\Adisk/, | ||
| 59 | /role/, | ||
| 60 | /recovery/, | ||
| 61 | /standby/] | ||
| 62 | |||
| 63 | options[:skip] = %w( | 17 | options[:skip] = %w( |
| 18 | index.html | ||
| 64 | ddl-others.html | 19 | ddl-others.html |
| 65 | functions-event-triggers.html | 20 | functions-event-triggers.html |
| 66 | functions-trigger.html | 21 | functions-trigger.html |
| 67 | textsearch-migration.html) | 22 | textsearch-migration.html |
| 23 | supported-platforms.html | ||
| 24 | error-message-reporting.html | ||
| 25 | error-style-guide.html | ||
| 26 | plhandler.html) | ||
| 27 | |||
| 28 | options[:skip_patterns] = [ | ||
| 29 | /\Atutorial/, | ||
| 30 | /\Ainstall/, | ||
| 31 | /\Aregress/, | ||
| 32 | /\Aprotocol/, | ||
| 33 | /\Asource/, | ||
| 34 | /\Anls/, | ||
| 35 | /\Afdw/, | ||
| 36 | /\Atablesample/, | ||
| 37 | /\Acustom-scan/, | ||
| 38 | /\Abki/ ] | ||
| 68 | 39 | ||
| 69 | options[:attribution] = <<-HTML | 40 | options[:attribution] = <<-HTML |
| 70 | © 1996–2014 The PostgreSQL Global Development Group<br> | 41 | © 1996–2016 The PostgreSQL Global Development Group<br> |
| 71 | Licensed under the PostgreSQL License. | 42 | Licensed under the PostgreSQL License. |
| 72 | HTML | 43 | HTML |
| 44 | |||
| 45 | version '9.5' do | ||
| 46 | self.release = '9.5' | ||
| 47 | self.base_url = 'http://www.postgresql.org/docs/9.5/static/' | ||
| 48 | end | ||
| 49 | |||
| 50 | version '9.4' do | ||
| 51 | self.release = '9.4' | ||
| 52 | self.base_url = 'http://www.postgresql.org/docs/9.4/static/' | ||
| 53 | end | ||
| 73 | end | 54 | end |
| 74 | end | 55 | end |