diff --git a/assets/images/docs-2.png b/assets/images/docs-2.png index 089ecbde..2af0f5b9 100644 Binary files a/assets/images/docs-2.png and b/assets/images/docs-2.png differ diff --git a/assets/images/docs-2@2x.png b/assets/images/docs-2@2x.png index c8234813..c781b248 100644 Binary files a/assets/images/docs-2@2x.png and b/assets/images/docs-2@2x.png differ diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index ffdb2615..aff770f4 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,7 +1,7 @@ [ [ - "2018-08-06", - "New documentation: Dart" + "2018-08-12", + "New documentations: Dart and Qt" ], [ "2018-07-29", "New documentations: Bash, Graphite and Pygame" diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 14c12346..42e5be23 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -177,3 +177,4 @@ ._icon-pygame:before { background-position: -5rem -3rem; @extend %doc-icon-2; } ._icon-bash:before { background-position: -6rem -3rem; @extend %doc-icon-2; } ._icon-dart:before { background-position: -7rem -3rem; @extend %doc-icon-2; } +._icon-qt:before { background-position: -8rem -3rem; @extend %doc-icon-2; } diff --git a/assets/stylesheets/pages/_qt.scss b/assets/stylesheets/pages/_qt.scss index 8efecaaf..db2554ce 100644 --- a/assets/stylesheets/pages/_qt.scss +++ b/assets/stylesheets/pages/_qt.scss @@ -1,63 +1,9 @@ ._qt { @extend %simple; - h1 { - margin-top: 0; - @extend %lined-heading; - } - - // Home page - .landingicons { - .icons1of3 { - display: flex; - flex-wrap: wrap; - align-items: center; - margin: 1em 0; - - @if $style == 'dark' { - &:nth-child(3) img { - filter: invert(1) hue-rotate(180deg) brightness(1.5) - } - } - } - - h2 { - flex: 1; - margin: 0; - margin-left: 10px; - } - - h2 + p { - width: 100%; - padding-left: 70px; - } - - .centerAlign, - .centerAlign img { // Icon - width: 60px; - height: 60px; - margin: 0; - } - } - - // Syntax highlighting - .pre { - .operator { @extend .token, .operator; } - .number { @extend .token, .number; } - .keyword { @extend .token, .keyword; } - .type { @extend .token, .function; } - .type a { color: inherit; } - .pun, .comment { @extend .token, .punctuation; } - .kwd, .preprocessor { @extend .token, .keyword; } - .str, .string { @extend .token, .string; } - } - // Function headers - h3.fn code { - @extend %label; + h3.fn > code { float: right; - font-size: .8em; - padding: 0; - margin-right: -.5em; + color: $textColorLight; } } diff --git a/lib/docs/filters/qt/clean_html.rb b/lib/docs/filters/qt/clean_html.rb index 18e57baa..f8f7ebd0 100644 --- a/lib/docs/filters/qt/clean_html.rb +++ b/lib/docs/filters/qt/clean_html.rb @@ -3,17 +3,27 @@ module Docs class CleanHtmlFilter < Filter def call # Remove unneeded elements - css('.copy-notice, .navigationbar, .headerNavi, .footerNavi, .sidebar, .toc, #ec_toggle').remove + css('.copy-notice, .navigationbar, .headerNavi, .footerNavi, .sidebar, .toc, #ec_toggle', '.landingicons img', 'br').remove # QML property/method header css('.qmlproto').each do |node| id = node.at_css('tr')['id'] node.inner_html = node.at_css('td').inner_html node.name = 'h3' - node.add_class '_qml_header' node['id'] = id end + css('.main-rounded', '.content', '.line', '.context', '.descr', '.types', '.func', '.table', 'div:not([class])', '.landing', '.col-1', '.heading', '.qmlitem', '.qmldoc', 'div.pre').each do |node| + node.before(node.children).remove + end + + css('pre').each do |node| + node.content = node.content + node['data-language'] = 'cpp' if node['class'].include?('cpp') + node['data-language'] = 'qml' if node['class'].include?('qml') + node.remove_attribute('class') + end + doc end end diff --git a/lib/docs/filters/qt/entries.rb b/lib/docs/filters/qt/entries.rb index c9e172d0..64d342f1 100644 --- a/lib/docs/filters/qt/entries.rb +++ b/lib/docs/filters/qt/entries.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Docs class Qt class EntriesFilter < Docs::EntriesFilter @@ -9,7 +11,7 @@ module Docs 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) - 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) " end @@ -19,34 +21,34 @@ module Docs def get_type breadcrumb = css('#main_title_bar + ul li') category = if breadcrumb.length < 3 - then 'Qt' + then 'Qt'.dup else breadcrumb.at(1).content end if category == 'Qt' - return 'Qt Platforms' if name.include? ' for ' or name == 'Qt Platform Abstraction' - return 'Qt Quick' if name == 'Qt Quick Test' or name == 'Qt Quick Test Reference Documentation' + return 'Qt Platforms' if name.include?(' for ') || name == 'Qt Platform Abstraction' + 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) end 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 end def include_default_entry? - name != 'All Classes' and name != 'All QML Types' + name != 'All Classes' && name != 'All QML Types' end def additional_entries entries = [] titles = [] - className = at_css('h1.title').content.strip.sub ' Class', '' + className = at_css('h1.title').content.strip.remove(' Class') displayedClassName = className alternativeClassName = at_css('h1.title + .small-subtitle a') displayedClassName = alternativeClassName.content if alternativeClassName @@ -56,7 +58,7 @@ module Docs header = node.clone # Skip typenames - next if header.content.strip.start_with? 'typename ' + next if header.content.strip.start_with?('typename ') # Remove leading header.children.css('a[name]').remove @@ -66,7 +68,7 @@ module Docs code.remove if code.name == 'code' # 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 returnType = header.children.first @@ -78,57 +80,57 @@ module Docs title[0] = '' if title[0] == '&' || title[0] == '*' # Ignore operator overloads - next if title.start_with? 'operator' + next if title.start_with?('operator') # Remove function parameters title.sub! %r{\(.*\)}, '()' # Remove template generics - title.sub! %r{^<.*> }, '' + title.remove!(%r{^<.*> }) # Remove ‘const’ at the end - title.sub! %r{ const$}, '' + title.remove!(%r{ const$}) # Enum/typedef formatting title.sub! %r{(enum|typedef) (.*)}, '\2 (\1)' # 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 - 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']] titles.push title end end # 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| title = node.content.strip id = node.at_css('tr')['id'] # Remove options - title.sub! %r{^\[.*\] }, '' + title.remove!(%r{^\[.*\] }) # Remove function parameters title.sub! %r{\(.*\)}, '()' # Remove property type - title.sub! %r{ : .*$}, '' + title.remove!(%r{ : .*$}) # Remove return type - title.sub! %r{.* }, '' + title.remove!(%r{.* }) # Remove return type - title.sub! %r{.* }, '' + title.remove!(%r{.* }) title = "#{qmlTypeName}.#{title.strip}" - unless titles.include? title # Remove duplicates (function overloading) + unless titles.include?(title) # Remove duplicates (function overloading) entries << [title, id] - titles.push title + titles.push(title) end end diff --git a/lib/docs/scrapers/qt.rb b/lib/docs/scrapers/qt.rb index c4ff2db9..412eca6d 100644 --- a/lib/docs/scrapers/qt.rb +++ b/lib/docs/scrapers/qt.rb @@ -12,7 +12,7 @@ module Docs html_filters.push 'qt/entries', 'qt/clean_html' options[:container] = '.main' - + options[:max_image_size] = 156_000 options[:skip_patterns] = [ # License, copyright attributions /3rdparty/, diff --git a/public/icons/docs-2.pxm b/public/icons/docs-2.pxm index 7039ec5f..1d81916e 100644 Binary files a/public/icons/docs-2.pxm and b/public/icons/docs-2.pxm differ diff --git a/public/icons/docs-2@2x.pxm b/public/icons/docs-2@2x.pxm index e0dd2df5..ca26ef6f 100644 Binary files a/public/icons/docs-2@2x.pxm and b/public/icons/docs-2@2x.pxm differ diff --git a/public/icons/docs/qt/16.png b/public/icons/docs/qt/16.png index 9d601d73..3c14a85f 100644 Binary files a/public/icons/docs/qt/16.png and b/public/icons/docs/qt/16.png differ diff --git a/public/icons/docs/qt/16@2x.png b/public/icons/docs/qt/16@2x.png index 5140eb23..858b2245 100644 Binary files a/public/icons/docs/qt/16@2x.png and b/public/icons/docs/qt/16@2x.png differ