diff --git a/assets/images/icons.png b/assets/images/icons.png index b49c62a4..4f9f014b 100644 Binary files a/assets/images/icons.png and b/assets/images/icons.png differ diff --git a/assets/images/icons@2x.png b/assets/images/icons@2x.png index f5f4a181..5e76ac21 100644 Binary files a/assets/images/icons@2x.png and b/assets/images/icons@2x.png differ diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index ef4ea66c..735e7d7c 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,7 +1,7 @@ [ [ "2015-08-02", - "New documentation: OpenTSDB" + "New documentations: Q and OpenTSDB" ], [ "2015-07-26", "Added search abbreviations (e.g. $ is an alias for jQuery).\nClick here to see the full list. Feel free to suggest more on GitHub.", diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index acb12296..0af71918 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -304,6 +304,11 @@ credits = [ '1990-2015 Python Software Foundation
Python is a trademark of the Python Software Foundation.', 'PSFL', 'http://docs.python.org/3/license.html' + ], [ + 'Q', + '2009-2015 Kristopher Michael Kowal and contributors', + 'MIT', + 'https://raw.githubusercontent.com/kriskowal/q/v1/LICENSE' ], [ 'React', '2013-2015 Facebook Inc.', diff --git a/assets/javascripts/views/pages/javascript.coffee b/assets/javascripts/views/pages/javascript.coffee index 2ba17bc8..5cdd2e98 100644 --- a/assets/javascripts/views/pages/javascript.coffee +++ b/assets/javascripts/views/pages/javascript.coffee @@ -26,6 +26,7 @@ app.views.MomentPage = app.views.MongoosePage = app.views.NodePage = app.views.PhaserPage = +app.views.QPage = app.views.RethinkdbPage = app.views.SinonPage = app.views.UnderscorePage = diff --git a/assets/javascripts/views/pages/q.coffee b/assets/javascripts/views/pages/q.coffee deleted file mode 100644 index 67637560..00000000 --- a/assets/javascripts/views/pages/q.coffee +++ /dev/null @@ -1,6 +0,0 @@ -#= require views/pages/base - -class app.views.QPage extends app.views.BasePage - afterRender: -> - @highlightCode @findAll('.highlight-js > pre'), 'javascript' - return diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 51665043..eeccc3dc 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -106,3 +106,4 @@ ._icon-phaser:before { background-position: -2rem -8rem; } ._icon-vue:before { background-position: -3rem -8rem; } ._icon-opentsdb:before { background-position: -4rem -8rem; } +._icon-q:before { background-position: -5rem -8rem; } diff --git a/assets/stylesheets/pages/_q.scss b/assets/stylesheets/pages/_q.scss index 7b0af99c..7f6e7c09 100644 --- a/assets/stylesheets/pages/_q.scss +++ b/assets/stylesheets/pages/_q.scss @@ -1,5 +1,5 @@ ._q { - > h3 { @extend %block-heading; } + > h2, > h3 { @extend %block-heading; } > h4 { @extend %block-label, %label-blue; } code { @extend %label; } } diff --git a/lib/docs/filters/q/clean_html.rb b/lib/docs/filters/q/clean_html.rb index 54d45564..3f789414 100644 --- a/lib/docs/filters/q/clean_html.rb +++ b/lib/docs/filters/q/clean_html.rb @@ -2,13 +2,15 @@ module Docs class Q class CleanHtmlFilter < Filter def call - @doc = at_css('.markdown-body') - - css('h3 > a, h4 > a').each do |node| + css('.anchor').each do |node| node.parent['id'] = node['href'].remove('#') node.remove end + css('.highlight > pre').each do |node| + node.content = node.content.gsub(' ', ' ') + end + doc end end diff --git a/lib/docs/filters/q/entries.rb b/lib/docs/filters/q/entries.rb index 35b861ac..8c613c12 100644 --- a/lib/docs/filters/q/entries.rb +++ b/lib/docs/filters/q/entries.rb @@ -2,40 +2,30 @@ module Docs class Q class EntriesFilter < Docs::EntriesFilter def additional_entries - entries = [] + entry = type = nil - type = '' - entry = [] - css('h3, h4, em:contains("Alias")').each do |node| - - if node.name == 'h3' + css('h3, h4, em:contains("Alias")').each_with_object [] do |node, entries| + case node.name + when 'h3' type = node.content.strip - - if type == "Q.defer()" # Q.defer() is a method, but it also plays a section title role. - entries << ['Q.defer', 'qdefer', 'Q.defer()'] - end - next - end - - if node.name == 'h4' - name = node.content.strip.remove(/\(.*?\).*/) - link = node['id'] - entry = [name, link, type] - + type.remove! %r{\(.+\)} + type.remove! ' Methods' + type.remove! ' API' + entries << [type, node['id'], type] if type == 'Q.defer()' + when 'h4' + name = node.content.strip + name.sub! %r{\(.*?\).*}, '()' + id = node['id'] = name.parameterize + entry = [name, id, type] entries << entry - next + when 'em' + name = node.parent.at_css('code').content + name << '()' if entry[0].end_with?('()') + dup = entry.dup + dup[0] = name + entries << dup end - - if node.name == 'em' # for the aliases - aliasEntry = entry.clone - aliasEntry[0] = node.parent.at_css('code').content - entries << aliasEntry - next - end - end - - entries end end end diff --git a/lib/docs/scrapers/q.rb b/lib/docs/scrapers/q.rb index 78de5b1b..26545b53 100644 --- a/lib/docs/scrapers/q.rb +++ b/lib/docs/scrapers/q.rb @@ -1,22 +1,24 @@ module Docs class Q < UrlScraper self.name = 'Q' - self.slug = 'Q' - self.type = 'Q' + self.type = 'q' self.version = '1.4.1' - self.base_url = "https://github.com/kriskowal/q/wiki/API-Reference" + self.base_url = 'https://github.com/kriskowal/q/wiki/' + self.root_path = 'API-Reference' self.links = { - home: 'https://github.com/kriskowal/q/', - code: 'https://github.com/kriskowal/q/' + home: 'http://documentup.com/kriskowal/q/', + code: 'https://github.com/kriskowal/q' } html_filters.push 'q/clean_html', 'q/entries', 'title' + options[:container] = '.markdown-body' options[:title] = 'Q' options[:skip_links] = true options[:attribution] = <<-HTML - Licensed under the MIT License. + © 2009–2015 Kristopher Michael Kowal and contributors
+ Licensed under the MIT License. HTML end end diff --git a/public/icons/docs/q/16.png b/public/icons/docs/q/16.png index 9568cd73..437ae417 100644 Binary files a/public/icons/docs/q/16.png and b/public/icons/docs/q/16.png differ diff --git a/public/icons/docs/q/16@2x.png b/public/icons/docs/q/16@2x.png index 799b8d9c..0f791b4f 100644 Binary files a/public/icons/docs/q/16@2x.png and b/public/icons/docs/q/16@2x.png differ