Unified · Split
| @@ -321,7 +321,7 @@ credits = [ · 320 unmodified lines | ||
| 321 | 321 | 'https://creativecommons.org/licenses/by/3.0/' |
| 322 | 322 | ], [ |
| 323 | 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 | 325 | 'PostgreSQL', |
| 326 | 326 | 'http://www.postgresql.org/about/licence/' |
| 327 | 327 | ], [ |
| @@ -10,4 +10,5 @@ · 9 unmodified lines | ||
| 10 | 10 | blockquote.TIP { @extend %note, %note-green; } |
| 11 | 11 | |
| 12 | 12 | p > code { @extend %label; } |
| 13 | + p.c2 { font-weight: bold; } | |
| 13 | 14 | } |
| @@ -20,7 +20,7 @@ module Docs · 19 unmodified lines | ||
| 20 | 20 | node.before(node.children).remove |
| 21 | 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 | 24 | node.before(node.children).remove |
| 25 | 25 | end |
| 26 | 26 | |
| @@ -23,7 +23,21 @@ module Docs · 22 unmodified lines | ||
| 23 | 23 | 'High Availability, Load Balancing, and Replication' => 'High Availability', |
| 24 | 24 | 'Monitoring Database Activity' => 'Monitoring', |
| 25 | 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 | 42 | def base_name |
| 29 | 43 | @base_name ||= clean_heading_name(at_css('h1').content) |
| @@ -32,8 +46,8 @@ module Docs · 2 unmodified lines | ||
| 32 | 46 | def get_name |
| 33 | 47 | if %w(Overview Introduction).include?(base_name) |
| 34 | 48 | result[:pg_chapter_name] |
| 35 | − elsif PREPEND_TYPES.include?(type) | |
| 36 | − "#{type}: #{base_name}" | |
| 49 | + elsif PREPEND_TYPES.include?(type) || type.start_with?('Internals') | |
| 50 | + "#{type.remove('Internals: ')}: #{base_name}" | |
| 37 | 51 | else |
| 38 | 52 | REPLACE_NAMES[base_name] || base_name |
| 39 | 53 | end |
| @@ -50,8 +64,10 @@ module Docs · 10 unmodified lines | ||
| 50 | 64 | if type.start_with?('Func') && (match = base_name.match(/\A(?!Form|Seq|Set|Enum)(.+) Func/)) |
| 51 | 65 | "Functions: #{match[1]}" |
| 52 | 66 | else |
| 53 | − type.remove! 'SQL ' | |
| 54 | − REPLACE_TYPES[type] || type | |
| 67 | + type.remove! %r{\ASQL } | |
| 68 | + type = REPLACE_TYPES[type] || type | |
| 69 | + type = "Internals: #{type}" if INTERNAL_TYPES.include?(type) | |
| 70 | + type | |
| 55 | 71 | end |
| 56 | 72 | end |
| 57 | 73 | end |
| @@ -60,6 +76,7 @@ module Docs · 2 unmodified lines | ||
| 60 | 76 | return [] if skip_additional_entries? |
| 61 | 77 | return config_additional_entries if type && type.include?('Configuration') |
| 62 | 78 | return data_types_additional_entries if type == 'Data Types' |
| 79 | + return command_additional_entries if type == 'Commands' | |
| 63 | 80 | return get_heading_entries('h3[id]') if slug == 'functions-xml' |
| 64 | 81 | |
| 65 | 82 | entries = get_heading_entries('h2[id]') |
| @@ -81,6 +98,7 @@ module Docs · 15 unmodified lines | ||
| 81 | 98 | else |
| 82 | 99 | if type && type.start_with?('Functions') |
| 83 | 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 | 102 | entries.concat %w(IS NULL BETWEEN DISTINCT\ FROM).map { |name| ["#{self.name}: #{name}"] } if slug == 'functions-comparison' |
| 85 | 103 | end |
| 86 | 104 | end |
| @@ -107,8 +125,18 @@ module Docs · 20 unmodified lines | ||
| 107 | 125 | get_custom_entries(selector) |
| 108 | 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 | 138 | def include_default_entry? |
| 111 | − !initial_page? && !at_css('.TOC') | |
| 139 | + !initial_page? && !at_css('.TOC') && type | |
| 112 | 140 | end |
| 113 | 141 | |
| 114 | 142 | SKIP_ENTRIES_SLUGS = [ |
| @@ -128,10 +156,12 @@ module Docs · 13 unmodified lines | ||
| 128 | 156 | 'Monitoring' ] |
| 129 | 157 | |
| 130 | 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 | 161 | end |
| 133 | 162 | |
| 134 | 163 | def clean_heading_name(name) |
| 164 | + name.remove! 'Chapter ' | |
| 135 | 165 | name.remove! %r{\A[\d\.\s]+} |
| 136 | 166 | name.remove! 'Using ' |
| 137 | 167 | name.remove! %r{\AThe } |
| @@ -17,7 +17,7 @@ module Docs · 16 unmodified lines | ||
| 17 | 17 | return unless text = at_css('.NAVHEADER td[align="center"]').content |
| 18 | 18 | return unless match = text.match(/\AChapter (\d+)\. (.+)\z/) |
| 19 | 19 | result[:pg_chapter] = match[1].to_i |
| 20 | − result[:pg_chapter_name] = match[2] | |
| 20 | + result[:pg_chapter_name] = match[2].strip | |
| 21 | 21 | end |
| 22 | 22 | end |
| 23 | 23 | end |
| @@ -1,11 +1,11 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class Postgresql < UrlScraper |
| 3 | + include FixInternalUrlsBehavior | |
| 4 | + | |
| 3 | 5 | self.name = 'PostgreSQL' |
| 4 | 6 | self.type = 'postgres' |
| 5 | − self.release = '9.4' | |
| 6 | − self.base_url = "http://www.postgresql.org/docs/#{release}/static/" | |
| 7 | 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 | 10 | html_filters.insert_before 'normalize_urls', 'postgresql/extract_metadata' |
| 11 | 11 | html_filters.push 'postgresql/clean_html', 'postgresql/entries', 'title' |
| @@ -14,61 +14,42 @@ module Docs · 2 unmodified lines | ||
| 14 | 14 | options[:root_title] = 'PostgreSQL' |
| 15 | 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 | 17 | options[:skip] = %w( |
| 18 | + index.html | |
| 64 | 19 | ddl-others.html |
| 65 | 20 | functions-event-triggers.html |
| 66 | 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 | 40 | options[:attribution] = <<-HTML |
| 70 | − © 1996–2014 The PostgreSQL Global Development Group<br> | |
| 41 | + © 1996–2016 The PostgreSQL Global Development Group<br> | |
| 71 | 42 | Licensed under the PostgreSQL License. |
| 72 | 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 | 54 | end |
| 74 | 55 | end |