Unified · Split
| @@ -0,0 +1,6 @@ | ||
| 1 | +#= require views/pages/base | |
| 2 | + | |
| 3 | +class app.views.QPage extends app.views.BasePage | |
| 4 | + afterRender: -> | |
| 5 | + @highlightCode @findAll('.highlight-js > pre'), 'javascript' | |
| 6 | + return | |
| @@ -59,6 +59,7 @@ · 58 unmodified lines | ||
| 59 | 59 | 'pages/php', |
| 60 | 60 | 'pages/phpunit', |
| 61 | 61 | 'pages/postgres', |
| 62 | + 'pages/q', | |
| 62 | 63 | 'pages/rdoc', |
| 63 | 64 | 'pages/react', |
| 64 | 65 | 'pages/redis', |
| @@ -59,6 +59,7 @@ · 58 unmodified lines | ||
| 59 | 59 | 'pages/php', |
| 60 | 60 | 'pages/phpunit', |
| 61 | 61 | 'pages/postgres', |
| 62 | + 'pages/q', | |
| 62 | 63 | 'pages/rdoc', |
| 63 | 64 | 'pages/react', |
| 64 | 65 | 'pages/redis', |
| @@ -0,0 +1,5 @@ | ||
| 1 | +._q { | |
| 2 | + > h3 { @extend %block-heading; } | |
| 3 | + > h4 { @extend %block-label, %label-blue; } | |
| 4 | + code { @extend %label; } | |
| 5 | +} | |
| @@ -0,0 +1,16 @@ | ||
| 1 | +module Docs | |
| 2 | + class Q | |
| 3 | + class CleanHtmlFilter < Filter | |
| 4 | + def call | |
| 5 | + @doc = at_css('.markdown-body') | |
| 6 | + | |
| 7 | + css('h3 > a, h4 > a').each do |node| | |
| 8 | + node.parent['id'] = node['href'].remove('#') | |
| 9 | + node.remove | |
| 10 | + end | |
| 11 | + | |
| 12 | + doc | |
| 13 | + end | |
| 14 | + end | |
| 15 | + end | |
| 16 | +end | |
| @@ -0,0 +1,42 @@ | ||
| 1 | +module Docs | |
| 2 | + class Q | |
| 3 | + class EntriesFilter < Docs::EntriesFilter | |
| 4 | + def additional_entries | |
| 5 | + entries = [] | |
| 6 | + | |
| 7 | + type = '' | |
| 8 | + entry = [] | |
| 9 | + css('h3, h4, em:contains("Alias")').each do |node| | |
| 10 | + | |
| 11 | + if node.name == 'h3' | |
| 12 | + type = node.content.strip | |
| 13 | + | |
| 14 | + if type == "Q.defer()" # Q.defer() is a method, but it also plays a section title role. | |
| 15 | + entries << ['Q.defer', 'qdefer', 'Q.defer()'] | |
| 16 | + end | |
| 17 | + next | |
| 18 | + end | |
| 19 | + | |
| 20 | + if node.name == 'h4' | |
| 21 | + name = node.content.strip.remove(/\(.*?\).*/) | |
| 22 | + link = node['id'] | |
| 23 | + entry = [name, link, type] | |
| 24 | + | |
| 25 | + entries << entry | |
| 26 | + next | |
| 27 | + end | |
| 28 | + | |
| 29 | + if node.name == 'em' # for the aliases | |
| 30 | + aliasEntry = entry.clone | |
| 31 | + aliasEntry[0] = node.parent.at_css('code').content | |
| 32 | + entries << aliasEntry | |
| 33 | + next | |
| 34 | + end | |
| 35 | + | |
| 36 | + end | |
| 37 | + | |
| 38 | + entries | |
| 39 | + end | |
| 40 | + end | |
| 41 | + end | |
| 42 | +end | |
| @@ -0,0 +1,22 @@ | ||
| 1 | +module Docs | |
| 2 | + class Q < UrlScraper | |
| 3 | + self.name = 'Q' | |
| 4 | + self.slug = 'Q' | |
| 5 | + self.type = 'Q' | |
| 6 | + self.version = '1.4.1' | |
| 7 | + self.base_url = "https://github.com/kriskowal/q/wiki/API-Reference" | |
| 8 | + self.links = { | |
| 9 | + home: 'https://github.com/kriskowal/q/', | |
| 10 | + code: 'https://github.com/kriskowal/q/' | |
| 11 | + } | |
| 12 | + | |
| 13 | + html_filters.push 'q/clean_html', 'q/entries', 'title' | |
| 14 | + | |
| 15 | + options[:title] = 'Q' | |
| 16 | + options[:skip_links] = true | |
| 17 | + | |
| 18 | + options[:attribution] = <<-HTML | |
| 19 | + Licensed under the MIT License. | |
| 20 | + HTML | |
| 21 | + end | |
| 22 | +end | |
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1 @@ | ||
| 1 | +http://kriskowal.github.io/q/q.png | |