Unified · Split
Binary file not shown.
Binary file not shown.
| @@ -39,6 +39,7 @@ app.templates.aboutPage = -> """ · 38 unmodified lines | |||
| 39 | <ul> | 39 | <ul> |
| 40 | <li><a href="https://www.heroku.com">Heroku</a> and <a href="http://newrelic.com">New Relic</a> for providing awesome free service | 40 | <li><a href="https://www.heroku.com">Heroku</a> and <a href="http://newrelic.com">New Relic</a> for providing awesome free service |
| 41 | <li>Daniel Bruce for the <a href="http://www.entypo.com">Entypo</a> pictograms | 41 | <li>Daniel Bruce for the <a href="http://www.entypo.com">Entypo</a> pictograms |
| 42 | <li><a href="http://www.jeremykratz.com/">Jeremy Kratz</a> for the C logo | ||
| 42 | </ul> | 43 | </ul> |
| 43 | 44 | ||
| 44 | <h2 class="_lined-heading" id="faq">Questions & Answsers</h2> | 45 | <h2 class="_lined-heading" id="faq">Questions & Answsers</h2> |
| @@ -83,6 +84,11 @@ credits = [ · 38 unmodified lines | |||
| 83 | '2010-2014 Jeremy Ashkenas, DocumentCloud', | 84 | '2010-2014 Jeremy Ashkenas, DocumentCloud', |
| 84 | 'MIT', | 85 | 'MIT', |
| 85 | 'https://raw.github.com/jashkenas/backbone/master/LICENSE' | 86 | 'https://raw.github.com/jashkenas/backbone/master/LICENSE' |
| 87 | ], [ | ||
| 88 | 'C', | ||
| 89 | 'cppreference.com', | ||
| 90 | 'CC BY-SA', | ||
| 91 | 'http://en.cppreference.com/w/Cppreference:Copyright/CC-BY-SA' | ||
| 86 | ], [ | 92 | ], [ |
| 87 | 'CoffeeScript', | 93 | 'CoffeeScript', |
| 88 | '2009-2014 Jeremy Ashkenas', | 94 | '2009-2014 Jeremy Ashkenas', |
| @@ -24,7 +24,10 @@ newsItem = (date, news) -> · 23 unmodified lines | |||
| 24 | result | 24 | result |
| 25 | 25 | ||
| 26 | app.news = [ | 26 | app.news = [ |
| 27 | [ 1392508800000, # February 16, 2013 | 27 | [ 1393027200000, # February 22, 2013 |
| 28 | """ New <a href="/c/">C</a> documentation """, | ||
| 29 | ], [ | ||
| 30 | 1392508800000, # February 16, 2013 | ||
| 28 | """ New <a href="/moment/">Moment.js</a> documentation """, | 31 | """ New <a href="/moment/">Moment.js</a> documentation """, |
| 29 | ], [ | 32 | ], [ |
| 30 | 1392163200000, # February 12, 2013 | 33 | 1392163200000, # February 12, 2013 |
| @@ -0,0 +1,6 @@ | |||
| 1 | #= require views/pages/base | ||
| 2 | |||
| 3 | class app.views.CPage extends app.views.BasePage | ||
| 4 | afterRender: -> | ||
| 5 | @highlightCode @findAll('pre.source-c, .source-c > pre'), 'c' | ||
| 6 | return | ||
| @@ -28,6 +28,7 @@ · 27 unmodified lines | |||
| 28 | 'components/mobile'; | 28 | 'components/mobile'; |
| 29 | 29 | ||
| 30 | @import 'pages/angular', | 30 | @import 'pages/angular', |
| 31 | 'pages/c', | ||
| 31 | 'pages/coffeescript', | 32 | 'pages/coffeescript', |
| 32 | 'pages/d3', | 33 | 'pages/d3', |
| 33 | 'pages/ember', | 34 | 'pages/ember', |
| @@ -48,3 +48,4 @@ · 47 unmodified lines | |||
| 48 | ._icon-d3:before { background-position: -4rem -6rem; } | 48 | ._icon-d3:before { background-position: -4rem -6rem; } |
| 49 | ._icon-knockout:before { background-position: 0 -7rem; } | 49 | ._icon-knockout:before { background-position: 0 -7rem; } |
| 50 | ._icon-moment:before { background-position: -1rem -7rem; } | 50 | ._icon-moment:before { background-position: -1rem -7rem; } |
| 51 | ._icon-c:before { background-position: -2rem -7rem; } | ||
| @@ -0,0 +1,22 @@ | |||
| 1 | ._c { | ||
| 2 | > h2, > h3 { @extend %block-heading; } | ||
| 3 | > h4 { @extend %block-label, %label-blue; } | ||
| 4 | > p > code { @extend %label; } | ||
| 5 | |||
| 6 | .t-dcl-begin pre { | ||
| 7 | margin: 0; | ||
| 8 | padding: 0; | ||
| 9 | line-height: inherit; | ||
| 10 | background: none; | ||
| 11 | border: 0; | ||
| 12 | box-shadow: none; | ||
| 13 | } | ||
| 14 | |||
| 15 | .t-lines > span { display: block; } // numeric/fenv, string/byte, etc. | ||
| 16 | |||
| 17 | .t-spar { // language/switch, language/for, etc. | ||
| 18 | font-style: italic; | ||
| 19 | color: $textColorLight; | ||
| 20 | } | ||
| 21 | .t-sdsc-nopad dl, .t-sdsc-nopad dd { margin: 0; } | ||
| 22 | } | ||
| @@ -0,0 +1,37 @@ | |||
| 1 | module Docs | ||
| 2 | class C | ||
| 3 | class CleanHtmlFilter < Filter | ||
| 4 | def call | ||
| 5 | if root_page? | ||
| 6 | doc.inner_html = ' ' | ||
| 7 | return doc | ||
| 8 | end | ||
| 9 | |||
| 10 | css('#siteSub', '#contentSub', '.printfooter', '.t-navbar', '.editsection', '#toc', '.t-dsc-sep', '.t-dcl-sep', | ||
| 11 | '#catlinks', '.ambox-notice', '.mw-cite-backlink', '.t-sdsc-sep:first-child:last-child').remove | ||
| 12 | |||
| 13 | css('#bodyContent', '.mw-content-ltr', 'span[style]').each do |node| | ||
| 14 | node.before(node.children).remove | ||
| 15 | end | ||
| 16 | |||
| 17 | css('h2 > span[id]', 'h3 > span[id]', 'h4 > span[id]', 'h5 > span[id]', 'h6 > span[id]').each do |node| | ||
| 18 | node.parent['id'] = node['id'] | ||
| 19 | node.before(node.children).remove | ||
| 20 | end | ||
| 21 | |||
| 22 | css('table[style]', 'th[style]', 'td[style]').remove_attr('style') | ||
| 23 | |||
| 24 | css('.t-dsc-hitem > td', '.t-dsc-header > td').each do |node| | ||
| 25 | node.name = 'th' | ||
| 26 | node.content = ' ' if node.content.empty? | ||
| 27 | end | ||
| 28 | |||
| 29 | css('tt').each do |node| | ||
| 30 | node.name = 'code' | ||
| 31 | end | ||
| 32 | |||
| 33 | doc | ||
| 34 | end | ||
| 35 | end | ||
| 36 | end | ||
| 37 | end | ||
| @@ -0,0 +1,44 @@ | |||
| 1 | module Docs | ||
| 2 | class C | ||
| 3 | class EntriesFilter < Docs::EntriesFilter | ||
| 4 | ADDITIONAL_NAMES = { | ||
| 5 | 'Conditional inclusion' => %w(if else elif ifdef ifndef endif).map { |s| "##{s} directive" }, | ||
| 6 | 'Function specifiers' => ['inline specifier', '_Noreturn specifier'] } | ||
| 7 | |||
| 8 | REPLACE_NAMES = { | ||
| 9 | 'Error directive' => '#error directive', | ||
| 10 | 'Filename and line information' => '#line directive', | ||
| 11 | 'Implementation defined behavior control' => '#pragma directive', | ||
| 12 | 'Replacing text macros' => '#define directive', | ||
| 13 | 'Source file inclusion' => '#include directive', | ||
| 14 | 'Warning directive' => '#warning directive' } | ||
| 15 | |||
| 16 | def get_name | ||
| 17 | name = at_css('#firstHeading').content.strip | ||
| 18 | name.sub! 'C keywords: ', '' | ||
| 19 | name.sub! %r{\s\(.+\)}, '' | ||
| 20 | name = name.split(',').first | ||
| 21 | REPLACE_NAMES[name] || name | ||
| 22 | end | ||
| 23 | |||
| 24 | def get_type | ||
| 25 | if type = at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content) | ||
| 26 | type.strip! | ||
| 27 | type.sub! ' library', '' | ||
| 28 | type.sub! ' utilities', '' | ||
| 29 | type | ||
| 30 | end | ||
| 31 | end | ||
| 32 | |||
| 33 | def additional_entries | ||
| 34 | names = at_css('#firstHeading').content.split(',')[1..-1] | ||
| 35 | names.concat ADDITIONAL_NAMES[name] || [] | ||
| 36 | names.map { |name| [name] } | ||
| 37 | end | ||
| 38 | |||
| 39 | def include_default_entry? | ||
| 40 | at_css '.t-navbar > div:nth-child(4) > a' | ||
| 41 | end | ||
| 42 | end | ||
| 43 | end | ||
| 44 | end | ||
| @@ -0,0 +1,21 @@ | |||
| 1 | module Docs | ||
| 2 | class C | ||
| 3 | class FixCodeFilter < Filter | ||
| 4 | def call | ||
| 5 | css('div > span.source-c').each do |node| | ||
| 6 | node.inner_html = node.inner_html.gsub(/<br>\n?/, "\n").gsub("\n</p>\n", "</p>\n") | ||
| 7 | node.parent.name = 'pre' | ||
| 8 | node.parent['class'] = 'source-c' | ||
| 9 | node.parent.content = node.content | ||
| 10 | end | ||
| 11 | |||
| 12 | nbsp = Nokogiri::HTML(' ').text | ||
| 13 | css('pre').each do |node| | ||
| 14 | node.content = node.content.gsub(nbsp, ' ') | ||
| 15 | end | ||
| 16 | |||
| 17 | doc | ||
| 18 | end | ||
| 19 | end | ||
| 20 | end | ||
| 21 | end | ||
| @@ -0,0 +1,11 @@ | |||
| 1 | module Docs | ||
| 2 | class C | ||
| 3 | class FixUrlsFilter < Filter | ||
| 4 | def call | ||
| 5 | html.gsub! File.join(C.base_url, C.root_path), C.base_url[0..-2] | ||
| 6 | html.gsub! %r{#{C.base_url}([^"']+?)\.html}, "#{C.base_url}\\1" | ||
| 7 | html | ||
| 8 | end | ||
| 9 | end | ||
| 10 | end | ||
| 11 | end | ||
| @@ -0,0 +1,22 @@ | |||
| 1 | module Docs | ||
| 2 | class C < FileScraper | ||
| 3 | self.type = 'c' | ||
| 4 | self.dir = '/Users/Thibaut/DevDocs/Docs/C/en/c' | ||
| 5 | self.base_url = 'http://en.cppreference.com/w/c/' | ||
| 6 | self.root_path = 'header.html' | ||
| 7 | |||
| 8 | html_filters.insert_before 'clean_html', 'c/fix_code' | ||
| 9 | html_filters.push 'c/entries', 'c/clean_html', 'title' | ||
| 10 | text_filters.push 'c/fix_urls' | ||
| 11 | |||
| 12 | options[:container] = '#content' | ||
| 13 | options[:title] = false | ||
| 14 | options[:root_title] = 'C Programming Language' | ||
| 15 | options[:skip] = %w(language/history.html) | ||
| 16 | |||
| 17 | options[:attribution] = <<-HTML | ||
| 18 | © cppreference.com<br> | ||
| 19 | Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0. | ||
| 20 | HTML | ||
| 21 | end | ||
| 22 | end | ||
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1,2 @@ | |||
| 1 | http://dribbble.com/shots/799814-Standard-C-Logo | ||
| 2 | with authorization from Jeremy Kratz | ||