|
|
@@ -0,0 +1,44 @@
|
|
|
+module Docs
|
|
|
+ class C
|
|
|
+ class EntriesFilter < Docs::EntriesFilter
|
|
|
+ ADDITIONAL_NAMES = {
|
|
|
+ 'Conditional inclusion' => %w(if else elif ifdef ifndef endif).map { |s| "##{s} directive" },
|
|
|
+ 'Function specifiers' => ['inline specifier', '_Noreturn specifier'] }
|
|
|
+
|
|
|
+ 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',
|
|
|
+ 'Warning directive' => '#warning directive' }
|
|
|
+
|
|
|
+ def get_name
|
|
|
+ name = at_css('#firstHeading').content.strip
|
|
|
+ name.sub! 'C keywords: ', ''
|
|
|
+ name.sub! %r{\s\(.+\)}, ''
|
|
|
+ name = name.split(',').first
|
|
|
+ REPLACE_NAMES[name] || name
|
|
|
+ end
|
|
|
+
|
|
|
+ def get_type
|
|
|
+ if type = at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content)
|
|
|
+ type.strip!
|
|
|
+ type.sub! ' library', ''
|
|
|
+ type.sub! ' utilities', ''
|
|
|
+ type
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ def additional_entries
|
|
|
+ names = at_css('#firstHeading').content.split(',')[1..-1]
|
|
|
+ names.concat ADDITIONAL_NAMES[name] || []
|
|
|
+ names.map { |name| [name] }
|
|
|
+ end
|
|
|
+
|
|
|
+ def include_default_entry?
|
|
|
+ at_css '.t-navbar > div:nth-child(4) > a'
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end
|
|
|
+end
|