Unified · Split
Binary file not shown.
Binary file not shown.
| @@ -115,6 +115,11 @@ credits = [ · 114 unmodified lines | ||
| 115 | 115 | '2005-2014 Linus Torvalds and others', |
| 116 | 116 | 'GPLv2', |
| 117 | 117 | 'https://raw.github.com/git/git/master/COPYING' |
| 118 | + ], [ | |
| 119 | + 'Go', | |
| 120 | + 'Google, Inc.', | |
| 121 | + 'CC BY', | |
| 122 | + 'http://creativecommons.org/licenses/by/3.0/' | |
| 118 | 123 | ], [ |
| 119 | 124 | 'HTTP', |
| 120 | 125 | '1999 The Internet Society', |
| @@ -24,7 +24,10 @@ newsItem = (date, news) -> · 23 unmodified lines | ||
| 24 | 24 | result |
| 25 | 25 | |
| 26 | 26 | app.news = [ |
| 27 | − [ 1396137600000, # March 30, 2014 | |
| 27 | + [ 1396742400000, # April 6, 2014 | |
| 28 | + """ New <a href="/go/">Go</a> documentation """, | |
| 29 | + ], [ | |
| 30 | + 1396137600000, # March 30, 2014 | |
| 28 | 31 | """ New <a href="/cpp/">C++</a> documentation """, |
| 29 | 32 | ], [ |
| 30 | 33 | 1394928000000, # March 16, 2014 |
| @@ -0,0 +1,6 @@ | ||
| 1 | +#= require views/pages/base | |
| 2 | + | |
| 3 | +class app.views.GoPage extends app.views.BasePage | |
| 4 | + afterRender: -> | |
| 5 | + @highlightCode @findAll('pre'), 'go' | |
| 6 | + return | |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | ||
| 33 | 33 | 'pages/coffeescript', |
| 34 | 34 | 'pages/d3', |
| 35 | 35 | 'pages/ember', |
| 36 | + 'pages/go', | |
| 36 | 37 | 'pages/jquery', |
| 37 | 38 | 'pages/knockout', |
| 38 | 39 | 'pages/git', |
| @@ -52,3 +52,4 @@ · 51 unmodified lines | ||
| 52 | 52 | %icon-path { background-position: -3rem -7rem; } |
| 53 | 53 | ._icon-yii:before { background-position: -4rem -7rem; } |
| 54 | 54 | ._icon-cpp:before { background-position: 0 -8rem; } |
| 55 | +._icon-go:before { background-position: -1rem -8rem; } | |
| @@ -0,0 +1,7 @@ | ||
| 1 | +._go { | |
| 2 | + padding-left: 1rem; | |
| 3 | + | |
| 4 | + h1, h2, #short-nav, table.dir { margin-left: -1rem; } | |
| 5 | + h2 { @extend %block-heading; } | |
| 6 | + h3 { @extend %block-label, %label-blue; } | |
| 7 | +} | |
| @@ -0,0 +1,46 @@ | ||
| 1 | +module Docs | |
| 2 | + class Go | |
| 3 | + class CleanHtmlFilter < Filter | |
| 4 | + def call | |
| 5 | + if root_page? | |
| 6 | + at_css('h1').content = 'Go Programming Language' | |
| 7 | + | |
| 8 | + # Remove empty columns | |
| 9 | + css('tr:first-child + tr', 'th:first-child + th', 'td:first-child + td').remove | |
| 10 | + | |
| 11 | + # Remove links to unscraped pages | |
| 12 | + css('td + td:empty').each do |node| | |
| 13 | + node.previous_element.content = node.previous_element.content | |
| 14 | + end | |
| 15 | + end | |
| 16 | + | |
| 17 | + css('#plusone', '#nav', '.pkgGopher', '#footer', '.collapsed').remove | |
| 18 | + | |
| 19 | + # Remove triangle character | |
| 20 | + css('h2', '.exampleHeading').each do |node| | |
| 21 | + node.content = node.content.sub("\u25BE", '') | |
| 22 | + node.name = 'h2' | |
| 23 | + end | |
| 24 | + | |
| 25 | + # Turn <dl> into <ul> | |
| 26 | + css('#short-nav', '#manual-nav').each do |node| | |
| 27 | + node.children = node.css('dd').tap { |nodes| nodes.each { |dd| dd.name = 'li' } } | |
| 28 | + node.name = 'ul' | |
| 29 | + end | |
| 30 | + | |
| 31 | + # Remove code highlighting | |
| 32 | + css('pre').each do |node| | |
| 33 | + node.content = node.content | |
| 34 | + end | |
| 35 | + | |
| 36 | + # Fix example markup | |
| 37 | + css('.play').each do |node| | |
| 38 | + node.children = node.at_css('.code').children | |
| 39 | + node.name = 'pre' | |
| 40 | + end | |
| 41 | + | |
| 42 | + doc | |
| 43 | + end | |
| 44 | + end | |
| 45 | + end | |
| 46 | +end | |
| @@ -0,0 +1,33 @@ | ||
| 1 | +module Docs | |
| 2 | + class Go | |
| 3 | + class EntriesFilter < Docs::EntriesFilter | |
| 4 | + def get_name | |
| 5 | + name = at_css('h1').content | |
| 6 | + name.sub! 'Package ', '' | |
| 7 | + name | |
| 8 | + end | |
| 9 | + | |
| 10 | + def get_type | |
| 11 | + subpath[/\A[^\/]+/] | |
| 12 | + end | |
| 13 | + | |
| 14 | + def additional_entries | |
| 15 | + css('#manual-nav a').each_with_object [] do |node, entries| | |
| 16 | + case node.content | |
| 17 | + when /type\ (\w+)/ | |
| 18 | + name = $1 | |
| 19 | + when /func\ (?:\(.+\)\ )?(\w+)\(/ | |
| 20 | + name = "#{$1}()" | |
| 21 | + name.prepend "#{$1}." if node['href'] =~ /#(\w+)\.#{$1}/ | |
| 22 | + end | |
| 23 | + | |
| 24 | + entries << ["#{name} (#{self.name})", node['href'][1..-1]] if name | |
| 25 | + end | |
| 26 | + end | |
| 27 | + | |
| 28 | + def include_default_entry? | |
| 29 | + !at_css('h1 + table.dir') | |
| 30 | + end | |
| 31 | + end | |
| 32 | + end | |
| 33 | +end | |
| @@ -0,0 +1,22 @@ | ||
| 1 | +module Docs | |
| 2 | + class Go < UrlScraper | |
| 3 | + self.type = 'go' | |
| 4 | + self.version = '1.2.1' | |
| 5 | + self.base_url = 'http://golang.org/pkg/' | |
| 6 | + | |
| 7 | + html_filters.push 'go/clean_html', 'go/entries' | |
| 8 | + | |
| 9 | + options[:container] = '#page .container' | |
| 10 | + | |
| 11 | + options[:attribution] = <<-HTML | |
| 12 | + © Google, Inc.<br> | |
| 13 | + Licensed under the Creative Commons Attribution License 3.0. | |
| 14 | + HTML | |
| 15 | + | |
| 16 | + private | |
| 17 | + | |
| 18 | + def parse(html) # Hook here because Nokogori removes whitespace from textareas | |
| 19 | + super html.gsub %r{<textarea\ class="code"[^>]*>([\W\w]+?)</textarea>}, '<pre class="code">\1</pre>' | |
| 20 | + end | |
| 21 | + end | |
| 22 | +end | |
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1 @@ | ||
| 1 | +http://golang.org/doc/gopher/ | |