[devdocsgjs/main: 908/1867] Update C++ documentation ()
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 908/1867] Update C++ documentation ()
- Date: Fri, 19 Nov 2021 23:47:34 +0000 (UTC)
commit 70c5b257afec14b007d61fa77ab37b2a30d3a132
Author: Jasper van Merle <jaspervmerle gmail com>
Date: Tue Sep 3 01:28:41 2019 +0200
Update C++ documentation ()
lib/docs/filters/cpp/entries.rb | 42 +++++++++++++++++++++++++----------------
lib/docs/scrapers/cpp.rb | 1 +
2 files changed, 27 insertions(+), 16 deletions(-)
---
diff --git a/lib/docs/filters/cpp/entries.rb b/lib/docs/filters/cpp/entries.rb
index 6f96ed8b..b0700139 100644
--- a/lib/docs/filters/cpp/entries.rb
+++ b/lib/docs/filters/cpp/entries.rb
@@ -10,20 +10,8 @@ module Docs
def get_name
name = at_css('#firstHeading').content.strip
- name.remove! 'C++ concepts: '
- name.remove! 'C++ keywords: '
- name.remove! 'C++ ' unless name == 'C++ language'
- name.remove! %r{\s\(.+\)}
- name.sub! %r{\AStandard library header <(.+)>\z}, '\1'
- if name.include?('operator') && name.include?(',')
- name.sub!(%r{operator.+([\( ])}, 'operators (') || name.sub!(%r{operator.+}, 'operators')
- name.sub! ' ', ' '
- name << ')' unless name.last == ')' || name.exclude?('(')
- name.sub! '()', ''
- name.sub! %r{\(.+\)}, '' if !name.start_with?('operator') && name.length > 50
- end
- name = name.split(',').first
- REPLACE_NAMES[name] || name
+ name = format_name(name)
+ name.split(',').first
end
def get_type
@@ -33,6 +21,8 @@ module Docs
'Experimental libraries'
elsif subpath.start_with?('language/')
'Language'
+ elsif subpath.start_with?('freestanding')
+ 'Utilities'
elsif type = at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content)
type.strip!
type.remove! ' library'
@@ -45,11 +35,31 @@ module Docs
def additional_entries
return [] if root_page? || self.name.start_with?('operators')
- names = at_css('#firstHeading').content.remove(%r{\(.+?\)}).split(',')[1..-1]
+ names = at_css('#firstHeading').content.remove(%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] }
+ names.map { |name| [format_name(name)] }
+ end
+
+ def format_name(name)
+ name.remove! 'C++ concepts: '
+ name.remove! 'C++ keywords: '
+ name.remove! 'C++ ' unless name == 'C++ language'
+ name.remove! %r{\s\(.+\)}
+
+ name.sub! %r{\AStandard library header <(.+)>\z}, '\1'
+ name.sub! %r{(<[^>]+>)}, ''
+
+ if name.include?('operator') && name.include?(',')
+ name.sub!(%r{operator.+([\( ])}, 'operators (') || name.sub!(%r{operator.+}, 'operators')
+ name.sub! ' ', ' '
+ name << ')' unless name.last == ')' || name.exclude?('(')
+ name.sub! '()', ''
+ name.sub! %r{\(.+\)}, '' if !name.start_with?('operator') && name.length > 50
+ end
+
+ REPLACE_NAMES[name] || name
end
end
end
diff --git a/lib/docs/scrapers/cpp.rb b/lib/docs/scrapers/cpp.rb
index f96ee8f1..f0ad2b16 100644
--- a/lib/docs/scrapers/cpp.rb
+++ b/lib/docs/scrapers/cpp.rb
@@ -24,6 +24,7 @@ module Docs
options[:only_patterns] = [/\.html\z/]
options[:fix_urls] = ->(url) do
+ url = CGI.unescape(url)
url.sub! %r{\A.+/http%3A/}, 'http://'
url.sub! 'http://en.cppreference.com/upload.cppreference.com', 'http://upload.cppreference.com'
url
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]