diff --git a/assets/images/icons.png b/assets/images/icons.png
index 18d8741b..2151678c 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 c97d2f6b..7c49ad21 100644
Binary files a/assets/images/icons@2x.png and b/assets/images/icons@2x.png differ
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee
index 59722d81..169ff080 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -39,7 +39,7 @@ app.templates.aboutPage = -> """
Questions & Answsers
@@ -86,7 +86,7 @@ credits = [
'MIT',
'https://raw.github.com/jashkenas/backbone/master/LICENSE'
], [
- 'C',
+ 'C
C++',
'cppreference.com',
'CC BY-SA',
'http://en.cppreference.com/w/Cppreference:Copyright/CC-BY-SA'
diff --git a/assets/javascripts/templates/pages/news_tmpl.coffee b/assets/javascripts/templates/pages/news_tmpl.coffee
index d2efaf0e..5580f168 100644
--- a/assets/javascripts/templates/pages/news_tmpl.coffee
+++ b/assets/javascripts/templates/pages/news_tmpl.coffee
@@ -24,7 +24,10 @@ newsItem = (date, news) ->
result
app.news = [
- [ 1394928000000, # March 16, 2013
+ [ 1396137600000, # March 30, 2014
+ """ New C++ documentation """,
+ ], [
+ 1394928000000, # March 16, 2014
""" New Yii documentation """,
], [
1394236800000, # March 8, 2014
diff --git a/assets/javascripts/views/pages/c.coffee b/assets/javascripts/views/pages/c.coffee
index aa6daf83..e079fe6d 100644
--- a/assets/javascripts/views/pages/c.coffee
+++ b/assets/javascripts/views/pages/c.coffee
@@ -3,4 +3,5 @@
class app.views.CPage extends app.views.BasePage
afterRender: ->
@highlightCode @findAll('pre.source-c, .source-c > pre'), 'c'
+ @highlightCode @findAll('pre.source-cpp, .source-cpp > pre'), 'cpp'
return
diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss
index 898d99ce..29902127 100644
--- a/assets/stylesheets/global/_icons.scss
+++ b/assets/stylesheets/global/_icons.scss
@@ -4,7 +4,7 @@
width: 1rem;
height: 1rem;
background-image: image-url('icons.png');
- background-size: 5rem 8rem;
+ background-size: 5rem 9rem;
}
@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) {
@@ -51,3 +51,4 @@
._icon-c:before { background-position: -2rem -7rem; }
%icon-path { background-position: -3rem -7rem; }
._icon-yii:before { background-position: -4rem -7rem; }
+._icon-cpp:before { background-position: 0 -8rem; }
diff --git a/assets/stylesheets/pages/_c.scss b/assets/stylesheets/pages/_c.scss
index 9bc384e3..acb505fd 100644
--- a/assets/stylesheets/pages/_c.scss
+++ b/assets/stylesheets/pages/_c.scss
@@ -19,4 +19,18 @@
color: $textColorLight;
}
.t-sdsc-nopad dl, .t-sdsc-nopad dd { margin: 0; }
+
+ td > h5 {
+ margin: 0;
+ line-height: inherit;
+ }
+
+ .t-inheritance-diagram {
+ display: table;
+ margin: 1rem 0;
+ padding: .375rem;
+ font-size: .75rem;
+ border: 1px solid #ccc;
+ border-radius: 2px;
+ }
}
diff --git a/lib/docs/filters/c/clean_html.rb b/lib/docs/filters/c/clean_html.rb
index ed7d5995..70c89f77 100644
--- a/lib/docs/filters/c/clean_html.rb
+++ b/lib/docs/filters/c/clean_html.rb
@@ -30,6 +30,14 @@ module Docs
node.name = 'code'
end
+ css('div > a > img[alt="About this image"]').each do |node|
+ node.parent.parent.remove
+ end
+
+ css('area[href]').each do |node|
+ node['href'] = node['href'].sub('.html', '')
+ end
+
doc
end
end
diff --git a/lib/docs/filters/cpp/entries.rb b/lib/docs/filters/cpp/entries.rb
new file mode 100644
index 00000000..95e4fb58
--- /dev/null
+++ b/lib/docs/filters/cpp/entries.rb
@@ -0,0 +1,50 @@
+module Docs
+ class Cpp
+ class EntriesFilter < Docs::EntriesFilter
+ REPLACE_NAMES = {
+ 'Error directive' => '#error directive',
+ 'Filename and line information' => '#line directive',
+ 'Implementation defined behavior control' => '#pragma directive',
+ 'Replacing text macros' => '#define directive',
+ 'Source file inclusion' => '#include directive' }
+
+ def get_name
+ name = at_css('#firstHeading').content.strip
+ name.sub! 'C++ concepts: ', ''
+ name.sub! 'C++ keywords: ', ''
+ name.sub! 'C++ ', ''
+ name.sub! %r{\s\(.+\)}, ''
+ name.sub! %r{\AStandard library header <(.+)>\z}, '\1'
+ name = name.split(',').first
+ REPLACE_NAMES[name] || name
+ end
+
+ def get_type
+ if at_css('#firstHeading').content.include?('C++ keyword')
+ 'Keywords'
+ elsif type = at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content)
+ type.strip!
+ type.sub! ' library', ''
+ type.sub! ' utilities', ''
+ type.sub! 'C++ ', ''
+ type.capitalize!
+ type
+ end
+ end
+
+ def additional_entries
+ return [] unless include_default_entry?
+ names = at_css('#firstHeading').content.gsub(%r{\(.+?\)}, '').split(',')[1..-1]
+ names.each(&:strip!).reject! do |name|
+ name.size <= 2 || name == '...' || name =~ /\A[<>]/ || name.start_with?('operator')
+ end
+ names.map { |name| [name] }
+ end
+
+ def include_default_entry?
+ return @include_default_entry if defined? @include_default_entry
+ @include_default_entry = at_css('.t-navbar > div:nth-child(4) > a') && at_css('#firstHeading').content !~ /\A\s*operator./
+ end
+ end
+ end
+end
diff --git a/lib/docs/filters/cpp/fix_urls.rb b/lib/docs/filters/cpp/fix_urls.rb
new file mode 100644
index 00000000..d9936f6d
--- /dev/null
+++ b/lib/docs/filters/cpp/fix_urls.rb
@@ -0,0 +1,12 @@
+module Docs
+ class Cpp
+ class FixUrlsFilter < Filter
+ def call
+ html.gsub! File.join(Cpp.base_url, Cpp.root_path), Cpp.base_url[0..-2]
+ html.gsub! %r{#{Cpp.base_url}([^"']+?)\.html}, "#{Cpp.base_url}\\1"
+ html.gsub! %r{http://en.cppreference.com/common/([^"']+?)\.svg}, 'http://upload.cppreference.com/mwiki/\1.svg'
+ html
+ end
+ end
+ end
+end
diff --git a/lib/docs/scrapers/cpp.rb b/lib/docs/scrapers/cpp.rb
new file mode 100644
index 00000000..55992808
--- /dev/null
+++ b/lib/docs/scrapers/cpp.rb
@@ -0,0 +1,30 @@
+module Docs
+ class Cpp < FileScraper
+ self.name = 'C++'
+ self.slug = 'cpp'
+ self.type = 'c'
+ self.dir = '/Users/Thibaut/DevDocs/Docs/C/en/cpp'
+ self.base_url = 'http://en.cppreference.com/w/cpp/'
+ self.root_path = 'header.html'
+
+ html_filters.insert_before 'clean_html', 'c/fix_code'
+ html_filters.push 'cpp/entries', 'c/clean_html', 'title'
+ text_filters.push 'cpp/fix_urls'
+
+ options[:container] = '#content'
+ options[:title] = false
+ options[:root_title] = 'C++ Programming Language'
+ options[:skip] = %w(
+ language/extending_std.html
+ language/history.html
+ regex/ecmascript.html
+ regex/regex_token_iterator/operator_cmp.html
+ )
+ options[:only_patterns] = [/\.html\z/]
+
+ options[:attribution] = <<-HTML
+ © cppreference.com
+ Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
+ HTML
+ end
+end
diff --git a/public/icons/docs/cpp/16.png b/public/icons/docs/cpp/16.png
new file mode 100644
index 00000000..e0e7c218
Binary files /dev/null and b/public/icons/docs/cpp/16.png differ
diff --git a/public/icons/docs/cpp/16@2x.png b/public/icons/docs/cpp/16@2x.png
new file mode 100644
index 00000000..677d8960
Binary files /dev/null and b/public/icons/docs/cpp/16@2x.png differ
diff --git a/public/icons/docs/cpp/SOURCE b/public/icons/docs/cpp/SOURCE
new file mode 100644
index 00000000..bf9dedaa
--- /dev/null
+++ b/public/icons/docs/cpp/SOURCE
@@ -0,0 +1,2 @@
+http://dribbble.com/shots/799814-Standard-C-Logo
+with authorization from Jeremy Kratz