|
|
@ -23,7 +23,21 @@ module Docs
|
|
|
|
'High Availability, Load Balancing, and Replication' => 'High Availability',
|
|
|
|
'High Availability, Load Balancing, and Replication' => 'High Availability',
|
|
|
|
'Monitoring Database Activity' => 'Monitoring',
|
|
|
|
'Monitoring Database Activity' => 'Monitoring',
|
|
|
|
'Monitoring Disk Usage' => 'Monitoring',
|
|
|
|
'Monitoring Disk Usage' => 'Monitoring',
|
|
|
|
'Reliability and the Write-Ahead Log' => 'Write-Ahead Log' }
|
|
|
|
'Reliability and the Write-Ahead Log' => 'Write-Ahead Log',
|
|
|
|
|
|
|
|
'Overview of PostgreSQL Internals' => 'Internals',
|
|
|
|
|
|
|
|
'System Catalogs' => 'Internals: Catalogs',
|
|
|
|
|
|
|
|
'How the Planner Uses Statistics' => 'Internals',
|
|
|
|
|
|
|
|
'Index Access Method Interface Definition' => 'Index Access Method',
|
|
|
|
|
|
|
|
'Database Physical Storage' => 'Physical Storage' }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INTERNAL_TYPES = [
|
|
|
|
|
|
|
|
'Genetic Query Optimizer',
|
|
|
|
|
|
|
|
'Index Access Method',
|
|
|
|
|
|
|
|
'GiST Indexes',
|
|
|
|
|
|
|
|
'SP-GiST Indexes',
|
|
|
|
|
|
|
|
'GIN Indexes',
|
|
|
|
|
|
|
|
'BRIN Indexes',
|
|
|
|
|
|
|
|
'Physical Storage' ]
|
|
|
|
|
|
|
|
|
|
|
|
def base_name
|
|
|
|
def base_name
|
|
|
|
@base_name ||= clean_heading_name(at_css('h1').content)
|
|
|
|
@base_name ||= clean_heading_name(at_css('h1').content)
|
|
|
@ -32,8 +46,8 @@ module Docs
|
|
|
|
def get_name
|
|
|
|
def get_name
|
|
|
|
if %w(Overview Introduction).include?(base_name)
|
|
|
|
if %w(Overview Introduction).include?(base_name)
|
|
|
|
result[:pg_chapter_name]
|
|
|
|
result[:pg_chapter_name]
|
|
|
|
elsif PREPEND_TYPES.include?(type)
|
|
|
|
elsif PREPEND_TYPES.include?(type) || type.start_with?('Internals')
|
|
|
|
"#{type}: #{base_name}"
|
|
|
|
"#{type.remove('Internals: ')}: #{base_name}"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
REPLACE_NAMES[base_name] || base_name
|
|
|
|
REPLACE_NAMES[base_name] || base_name
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -50,8 +64,10 @@ module Docs
|
|
|
|
if type.start_with?('Func') && (match = base_name.match(/\A(?!Form|Seq|Set|Enum)(.+) Func/))
|
|
|
|
if type.start_with?('Func') && (match = base_name.match(/\A(?!Form|Seq|Set|Enum)(.+) Func/))
|
|
|
|
"Functions: #{match[1]}"
|
|
|
|
"Functions: #{match[1]}"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
type.remove! 'SQL '
|
|
|
|
type.remove! %r{\ASQL }
|
|
|
|
REPLACE_TYPES[type] || type
|
|
|
|
type = REPLACE_TYPES[type] || type
|
|
|
|
|
|
|
|
type = "Internals: #{type}" if INTERNAL_TYPES.include?(type)
|
|
|
|
|
|
|
|
type
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -60,6 +76,7 @@ module Docs
|
|
|
|
return [] if skip_additional_entries?
|
|
|
|
return [] if skip_additional_entries?
|
|
|
|
return config_additional_entries if type && type.include?('Configuration')
|
|
|
|
return config_additional_entries if type && type.include?('Configuration')
|
|
|
|
return data_types_additional_entries if type == 'Data Types'
|
|
|
|
return data_types_additional_entries if type == 'Data Types'
|
|
|
|
|
|
|
|
return command_additional_entries if type == 'Commands'
|
|
|
|
return get_heading_entries('h3[id]') if slug == 'functions-xml'
|
|
|
|
return get_heading_entries('h3[id]') if slug == 'functions-xml'
|
|
|
|
|
|
|
|
|
|
|
|
entries = get_heading_entries('h2[id]')
|
|
|
|
entries = get_heading_entries('h2[id]')
|
|
|
@ -81,6 +98,7 @@ module Docs
|
|
|
|
else
|
|
|
|
else
|
|
|
|
if type && type.start_with?('Functions')
|
|
|
|
if type && type.start_with?('Functions')
|
|
|
|
entries.concat get_custom_entries('> .TABLE td:first-child > code:first-child')
|
|
|
|
entries.concat get_custom_entries('> .TABLE td:first-child > code:first-child')
|
|
|
|
|
|
|
|
entries.concat get_custom_entries('> .TABLE td:first-child > p > code:first-child')
|
|
|
|
entries.concat %w(IS NULL BETWEEN DISTINCT\ FROM).map { |name| ["#{self.name}: #{name}"] } if slug == 'functions-comparison'
|
|
|
|
entries.concat %w(IS NULL BETWEEN DISTINCT\ FROM).map { |name| ["#{self.name}: #{name}"] } if slug == 'functions-comparison'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -107,8 +125,18 @@ module Docs
|
|
|
|
get_custom_entries(selector)
|
|
|
|
get_custom_entries(selector)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def command_additional_entries
|
|
|
|
|
|
|
|
css('.REFSECT2[id^="SQL"]').each_with_object([]) do |node, entries|
|
|
|
|
|
|
|
|
next unless heading = node.at_css('h3')
|
|
|
|
|
|
|
|
next unless heading.content.strip =~ /[A-Z_\-]+ Clause/
|
|
|
|
|
|
|
|
name = heading.at_css('.LITERAL').content
|
|
|
|
|
|
|
|
name.prepend "#{self.name} ... "
|
|
|
|
|
|
|
|
entries << [name, node['id']]
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def include_default_entry?
|
|
|
|
def include_default_entry?
|
|
|
|
!initial_page? && !at_css('.TOC')
|
|
|
|
!initial_page? && !at_css('.TOC') && type
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
SKIP_ENTRIES_SLUGS = [
|
|
|
|
SKIP_ENTRIES_SLUGS = [
|
|
|
@ -128,10 +156,12 @@ module Docs
|
|
|
|
'Monitoring' ]
|
|
|
|
'Monitoring' ]
|
|
|
|
|
|
|
|
|
|
|
|
def skip_additional_entries?
|
|
|
|
def skip_additional_entries?
|
|
|
|
SKIP_ENTRIES_SLUGS.include?(slug) || SKIP_ENTRIES_TYPES.include?(type)
|
|
|
|
return true unless type
|
|
|
|
|
|
|
|
SKIP_ENTRIES_SLUGS.include?(slug) || SKIP_ENTRIES_TYPES.include?(type) || type.start_with?('Internals')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def clean_heading_name(name)
|
|
|
|
def clean_heading_name(name)
|
|
|
|
|
|
|
|
name.remove! 'Chapter '
|
|
|
|
name.remove! %r{\A[\d\.\s]+}
|
|
|
|
name.remove! %r{\A[\d\.\s]+}
|
|
|
|
name.remove! 'Using '
|
|
|
|
name.remove! 'Using '
|
|
|
|
name.remove! %r{\AThe }
|
|
|
|
name.remove! %r{\AThe }
|
|
|
|