Fix Qt entry typing
Unified · Split
| @@ -2,22 +2,19 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Qt |
| 3 | 3 | class CleanHtmlFilter < Filter |
| 4 | 4 | def call |
| 5 | − # Remove unneeded elements | |
| 6 | − css('.copy-notice, .navigationbar, .headerNavi, .footerNavi, .sidebar, .toc, #ec_toggle', '.landingicons img', 'br').remove | |
| 5 | + # Narrow down container further. Breadcrumb is safe to remove. | |
| 6 | + @doc = at_css('article .mainContent .context') unless root_page? | |
| 7 | + | |
| 8 | + css('h1').remove_attribute('class') | |
| 7 | 9 | |
| 8 | 10 | # QML property/method header |
| 9 | 11 | css('.qmlproto').each do |node| |
| 10 | − id = node.at_css('tr')['id'] | |
| 11 | − id = node.at_css('a')['name'] if id.blank? | |
| 12 | + id = node.at_css('span.name').content | |
| 12 | 13 | node.inner_html = node.at_css('td').inner_html |
| 13 | 14 | node.name = 'h3' |
| 14 | 15 | node['id'] = id |
| 15 | 16 | end |
| 16 | 17 | |
| 17 | − css('.main-rounded', '.content', '.line', '.context', '.descr', '.types', '.func', '.table', 'div:not([class])', '.landing', '.col-1', '.heading', '.qmlitem', '.qmldoc', 'div.pre').each do |node| | |
| 18 | − node.before(node.children).remove | |
| 19 | − end | |
| 20 | − | |
| 21 | 18 | css('pre').each do |node| |
| 22 | 19 | node.content = node.content |
| 23 | 20 | node['data-language'] = 'cpp' if node['class'].include?('cpp') |
| @@ -19,25 +19,8 @@ module Docs · 18 unmodified lines | ||
| 19 | 19 | end |
| 20 | 20 | |
| 21 | 21 | def get_type |
| 22 | − breadcrumb = css('#main_title_bar + ul li') | |
| 23 | − category = if breadcrumb.length < 3 | |
| 24 | − then 'Qt'.dup | |
| 25 | − else breadcrumb.at(1).content | |
| 26 | − end | |
| 27 | − | |
| 28 | − if category == 'Qt' | |
| 29 | − return 'Qt Platforms' if name.include?(' for ') || name == 'Qt Platform Abstraction' | |
| 30 | − return 'Qt Quick' if name == 'Qt Quick Test' || name == 'Qt Quick Test Reference Documentation' | |
| 31 | − | |
| 32 | − alwaysInQt = ['Qt Configure Options', 'Qt Image Formats'] | |
| 33 | − category = name if name.start_with?('Qt ') && !alwaysInQt.include?(name) | |
| 34 | − end | |
| 35 | − | |
| 36 | − qtPlatformsTypes = ['Qt Platform Headers', 'Qt Android Extras', 'Qt Mac Extras', 'Qt Windows Extras', 'Qt X11 Extras'] | |
| 37 | − return 'Qt Platforms' if qtPlatformsTypes.include?(category) | |
| 38 | − | |
| 39 | − category.remove!(' Manual') | |
| 40 | − category | |
| 22 | + breadcrumb = css('ul.c-breadcrump li') # Yes, really: breadcrump. | |
| 23 | + breadcrumb[1].content | |
| 41 | 24 | end |
| 42 | 25 | |
| 43 | 26 | def include_default_entry? |
| @@ -107,11 +90,9 @@ module Docs · 63 unmodified lines | ||
| 107 | 90 | end |
| 108 | 91 | |
| 109 | 92 | # QML properties/functions |
| 110 | − qmlTypeName = at_css('h1.title').content.remove(' QML Type', '') | |
| 111 | 93 | css('.qmlproto').each do |node| |
| 112 | 94 | title = node.content.strip |
| 113 | − id = node.at_css('tr')['id'] | |
| 114 | − id = node.at_css('a')['name'] if id.blank? | |
| 95 | + id = node.at_css('span.name').content | |
| 115 | 96 | |
| 116 | 97 | # Remove options |
| 117 | 98 | title.remove!(%r{^\[.*\] }) |
| @@ -128,7 +109,8 @@ module Docs · 10 unmodified lines | ||
| 128 | 109 | # Remove return type |
| 129 | 110 | title.remove!(%r{.* }) |
| 130 | 111 | |
| 131 | − title = "#{qmlTypeName}.#{title.strip}" | |
| 112 | + title = title.strip | |
| 113 | + | |
| 132 | 114 | unless titles.include?(title) # Remove duplicates (function overloading) |
| 133 | 115 | entries << [title, id] |
| 134 | 116 | titles.push(title) |
| @@ -11,8 +11,8 @@ module Docs · 10 unmodified lines | ||
| 11 | 11 | |
| 12 | 12 | html_filters.push 'qt/entries', 'qt/clean_html' |
| 13 | 13 | |
| 14 | − options[:container] = 'article, .main' | |
| 15 | − options[:max_image_size] = 156_000 | |
| 14 | + options[:container] = '.b-sidebar__content' | |
| 15 | + options[:max_image_size] = 256_000 | |
| 16 | 16 | options[:skip_patterns] = [ |
| 17 | 17 | # License, copyright attributions |
| 18 | 18 | /3rdparty/, |
| @@ -56,6 +56,8 @@ module Docs · 37 unmodified lines | ||
| 56 | 56 | "compatmap.html", |
| 57 | 57 | |
| 58 | 58 | # Indexes |
| 59 | + "qdoc-index.html", | |
| 60 | + "qmake-manual.html", | |
| 59 | 61 | "classes.html", |
| 60 | 62 | "qtmodules.html", |
| 61 | 63 | "modules-qml.html", |
| @@ -103,7 +105,12 @@ module Docs · 41 unmodified lines | ||
| 103 | 105 | Licensed under the GNU Free Documentation License, Version 1.3. |
| 104 | 106 | HTML |
| 105 | 107 | |
| 106 | − version do | |
| 108 | + version '6.9' do | |
| 109 | + self.release = '6.9' | |
| 110 | + self.base_url = "https://doc.qt.io/qt-#{self.release}/" | |
| 111 | + end | |
| 112 | + | |
| 113 | + version '6.8' do | |
| 107 | 114 | self.release = '6.8' |
| 108 | 115 | self.base_url = "https://doc.qt.io/qt-#{self.release}/" |
| 109 | 116 | end |