|
|
@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
|
|
|
|
module Docs
|
|
|
|
module Docs
|
|
|
|
class Qt
|
|
|
|
class Qt
|
|
|
|
class EntriesFilter < Docs::EntriesFilter
|
|
|
|
class EntriesFilter < Docs::EntriesFilter
|
|
|
@ -9,7 +11,7 @@ module Docs
|
|
|
|
name.sub! %r{ QML Basic Type$}, ' (QML basic type)'
|
|
|
|
name.sub! %r{ QML Basic Type$}, ' (QML basic type)'
|
|
|
|
|
|
|
|
|
|
|
|
# Add '(class)' to the class pages where the subtitle name is used (e.g. qset-const-iterator.html)
|
|
|
|
# Add '(class)' to the class pages where the subtitle name is used (e.g. qset-const-iterator.html)
|
|
|
|
if at_css('h1.title').content.strip.end_with?(' Class') and !name.include?('(class)')
|
|
|
|
if at_css('h1.title').content.strip.end_with?(' Class') && !name.include?('(class)')
|
|
|
|
name = "#{name} (class) "
|
|
|
|
name = "#{name} (class) "
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -19,34 +21,34 @@ module Docs
|
|
|
|
def get_type
|
|
|
|
def get_type
|
|
|
|
breadcrumb = css('#main_title_bar + ul li')
|
|
|
|
breadcrumb = css('#main_title_bar + ul li')
|
|
|
|
category = if breadcrumb.length < 3
|
|
|
|
category = if breadcrumb.length < 3
|
|
|
|
then 'Qt'
|
|
|
|
then 'Qt'.dup
|
|
|
|
else breadcrumb.at(1).content
|
|
|
|
else breadcrumb.at(1).content
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if category == 'Qt'
|
|
|
|
if category == 'Qt'
|
|
|
|
return 'Qt Platforms' if name.include? ' for ' or name == 'Qt Platform Abstraction'
|
|
|
|
return 'Qt Platforms' if name.include?(' for ') || name == 'Qt Platform Abstraction'
|
|
|
|
return 'Qt Quick' if name == 'Qt Quick Test' or name == 'Qt Quick Test Reference Documentation'
|
|
|
|
return 'Qt Quick' if name == 'Qt Quick Test' || name == 'Qt Quick Test Reference Documentation'
|
|
|
|
|
|
|
|
|
|
|
|
alwaysInQt = ["Qt Configure Options", "Qt Image Formats"]
|
|
|
|
alwaysInQt = ['Qt Configure Options', 'Qt Image Formats']
|
|
|
|
category = name if name.start_with?('Qt ') && !alwaysInQt.include?(name)
|
|
|
|
category = name if name.start_with?('Qt ') && !alwaysInQt.include?(name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
qtPlatformsTypes = ['Qt Platform Headers', 'Qt Android Extras', 'Qt Mac Extras', 'Qt Windows Extras', 'Qt X11 Extras']
|
|
|
|
qtPlatformsTypes = ['Qt Platform Headers', 'Qt Android Extras', 'Qt Mac Extras', 'Qt Windows Extras', 'Qt X11 Extras']
|
|
|
|
return 'Qt Platforms' if qtPlatformsTypes.include? category
|
|
|
|
return 'Qt Platforms' if qtPlatformsTypes.include?(category)
|
|
|
|
|
|
|
|
|
|
|
|
category.sub! ' Manual', ''
|
|
|
|
category.remove!(' Manual')
|
|
|
|
category
|
|
|
|
category
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def include_default_entry?
|
|
|
|
def include_default_entry?
|
|
|
|
name != 'All Classes' and name != 'All QML Types'
|
|
|
|
name != 'All Classes' && name != 'All QML Types'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def additional_entries
|
|
|
|
def additional_entries
|
|
|
|
entries = []
|
|
|
|
entries = []
|
|
|
|
titles = []
|
|
|
|
titles = []
|
|
|
|
|
|
|
|
|
|
|
|
className = at_css('h1.title').content.strip.sub ' Class', ''
|
|
|
|
className = at_css('h1.title').content.strip.remove(' Class')
|
|
|
|
displayedClassName = className
|
|
|
|
displayedClassName = className
|
|
|
|
alternativeClassName = at_css('h1.title + .small-subtitle a')
|
|
|
|
alternativeClassName = at_css('h1.title + .small-subtitle a')
|
|
|
|
displayedClassName = alternativeClassName.content if alternativeClassName
|
|
|
|
displayedClassName = alternativeClassName.content if alternativeClassName
|
|
|
@ -56,7 +58,7 @@ module Docs
|
|
|
|
header = node.clone
|
|
|
|
header = node.clone
|
|
|
|
|
|
|
|
|
|
|
|
# Skip typenames
|
|
|
|
# Skip typenames
|
|
|
|
next if header.content.strip.start_with? 'typename '
|
|
|
|
next if header.content.strip.start_with?('typename ')
|
|
|
|
|
|
|
|
|
|
|
|
# Remove leading <a name="">
|
|
|
|
# Remove leading <a name="">
|
|
|
|
header.children.css('a[name]').remove
|
|
|
|
header.children.css('a[name]').remove
|
|
|
@ -66,7 +68,7 @@ module Docs
|
|
|
|
code.remove if code.name == 'code'
|
|
|
|
code.remove if code.name == 'code'
|
|
|
|
|
|
|
|
|
|
|
|
# Remove leading ‘const’
|
|
|
|
# Remove leading ‘const’
|
|
|
|
header.children.first.remove if header.content.strip.start_with? 'const '
|
|
|
|
header.children.first.remove if header.content.strip.start_with?('const ')
|
|
|
|
|
|
|
|
|
|
|
|
# Remove return type
|
|
|
|
# Remove return type
|
|
|
|
returnType = header.children.first
|
|
|
|
returnType = header.children.first
|
|
|
@ -78,57 +80,57 @@ module Docs
|
|
|
|
title[0] = '' if title[0] == '&' || title[0] == '*'
|
|
|
|
title[0] = '' if title[0] == '&' || title[0] == '*'
|
|
|
|
|
|
|
|
|
|
|
|
# Ignore operator overloads
|
|
|
|
# Ignore operator overloads
|
|
|
|
next if title.start_with? 'operator'
|
|
|
|
next if title.start_with?('operator')
|
|
|
|
|
|
|
|
|
|
|
|
# Remove function parameters
|
|
|
|
# Remove function parameters
|
|
|
|
title.sub! %r{\(.*\)}, '()'
|
|
|
|
title.sub! %r{\(.*\)}, '()'
|
|
|
|
|
|
|
|
|
|
|
|
# Remove template generics
|
|
|
|
# Remove template generics
|
|
|
|
title.sub! %r{^<.*> }, ''
|
|
|
|
title.remove!(%r{^<.*> })
|
|
|
|
|
|
|
|
|
|
|
|
# Remove ‘const’ at the end
|
|
|
|
# Remove ‘const’ at the end
|
|
|
|
title.sub! %r{ const$}, ''
|
|
|
|
title.remove!(%r{ const$})
|
|
|
|
|
|
|
|
|
|
|
|
# Enum/typedef formatting
|
|
|
|
# Enum/typedef formatting
|
|
|
|
title.sub! %r{(enum|typedef) (.*)}, '\2 (\1)'
|
|
|
|
title.sub! %r{(enum|typedef) (.*)}, '\2 (\1)'
|
|
|
|
|
|
|
|
|
|
|
|
# Remove property type
|
|
|
|
# Remove property type
|
|
|
|
title = "#{displayedClassName}::#{title}" if title.sub! %r{ : .*$}, ''
|
|
|
|
title = "#{displayedClassName}::#{title}" if title.sub!(%r{ : .*$}, '')
|
|
|
|
|
|
|
|
|
|
|
|
# Replace the class name by the alternative class name if available
|
|
|
|
# Replace the class name by the alternative class name if available
|
|
|
|
title.sub! className, displayedClassName if alternativeClassName
|
|
|
|
title = title.sub(className, displayedClassName) if alternativeClassName
|
|
|
|
|
|
|
|
|
|
|
|
unless titles.include? title # Remove duplicates (function overloading)
|
|
|
|
unless titles.include?(title) # Remove duplicates (function overloading)
|
|
|
|
entries << [title, header['id']]
|
|
|
|
entries << [title, header['id']]
|
|
|
|
titles.push title
|
|
|
|
titles.push title
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# QML properties/functions
|
|
|
|
# QML properties/functions
|
|
|
|
qmlTypeName = at_css('h1.title').content.sub ' QML Type', ''
|
|
|
|
qmlTypeName = at_css('h1.title').content.remove(' QML Type', '')
|
|
|
|
css('.qmlproto').each do |node|
|
|
|
|
css('.qmlproto').each do |node|
|
|
|
|
title = node.content.strip
|
|
|
|
title = node.content.strip
|
|
|
|
id = node.at_css('tr')['id']
|
|
|
|
id = node.at_css('tr')['id']
|
|
|
|
|
|
|
|
|
|
|
|
# Remove options
|
|
|
|
# Remove options
|
|
|
|
title.sub! %r{^\[.*\] }, ''
|
|
|
|
title.remove!(%r{^\[.*\] })
|
|
|
|
|
|
|
|
|
|
|
|
# Remove function parameters
|
|
|
|
# Remove function parameters
|
|
|
|
title.sub! %r{\(.*\)}, '()'
|
|
|
|
title.sub! %r{\(.*\)}, '()'
|
|
|
|
|
|
|
|
|
|
|
|
# Remove property type
|
|
|
|
# Remove property type
|
|
|
|
title.sub! %r{ : .*$}, ''
|
|
|
|
title.remove!(%r{ : .*$})
|
|
|
|
|
|
|
|
|
|
|
|
# Remove return type
|
|
|
|
# Remove return type
|
|
|
|
title.sub! %r{.* }, ''
|
|
|
|
title.remove!(%r{.* })
|
|
|
|
|
|
|
|
|
|
|
|
# Remove return type
|
|
|
|
# Remove return type
|
|
|
|
title.sub! %r{.* }, ''
|
|
|
|
title.remove!(%r{.* })
|
|
|
|
|
|
|
|
|
|
|
|
title = "#{qmlTypeName}.#{title.strip}"
|
|
|
|
title = "#{qmlTypeName}.#{title.strip}"
|
|
|
|
unless titles.include? title # Remove duplicates (function overloading)
|
|
|
|
unless titles.include?(title) # Remove duplicates (function overloading)
|
|
|
|
entries << [title, id]
|
|
|
|
entries << [title, id]
|
|
|
|
titles.push title
|
|
|
|
titles.push(title)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|