mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Improve Ruby/RDoc scraper
This commit is contained in:
parent
49de7366fa
commit
7c1bd6b236
2 changed files with 36 additions and 36 deletions
|
@ -23,14 +23,16 @@ module Docs
|
|||
return [] if root_page?
|
||||
require 'cgi'
|
||||
|
||||
css('.method-detail').map do |node|
|
||||
css('.method-detail').inject [] do |entries, node|
|
||||
name = node['id'].dup
|
||||
name.sub! %r{\A\w+?\-.}, ''
|
||||
name.sub! %r{\A-(?!\d)}, ''
|
||||
name.gsub! '-', '%'
|
||||
name = CGI.unescape(name)
|
||||
name.prepend self.name + (node['id'] =~ /\A\w+-c-/ ? '::' : '#')
|
||||
[name, node['id']]
|
||||
|
||||
entries << [name, node['id']] unless entries.any? { |entry| entry[0] == name }
|
||||
entries
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,38 +1,24 @@
|
|||
module Docs
|
||||
class Ruby < Rdoc
|
||||
# Generated with:
|
||||
# rdoc \
|
||||
# --format=darkfish \
|
||||
# --no-line-numbers \
|
||||
# --op=rdoc \
|
||||
# --visibility=public \
|
||||
# find \
|
||||
# *.c \
|
||||
# lib/**/*.rb \
|
||||
# lib/*.rb \
|
||||
# ext/bigdecimal/*.c \
|
||||
# ext/bigdecimal/lib/*.rb \
|
||||
# ext/bigdecimal/lib/**/*.rb \
|
||||
# ext/date/*.c \
|
||||
# ext/date/lib/*.rb \
|
||||
# ext/date/lib/**/*.rb \
|
||||
# ext/digest/*.c \
|
||||
# ext/digest/**/*.c \
|
||||
# ext/digest/**/*.rb \
|
||||
# ext/json/lib/**/*.rb \
|
||||
# ext/pathname/*.c \
|
||||
# ext/pathname/lib/*.rb \
|
||||
# ext/psych/*.c \
|
||||
# ext/psych/lib/*.rb \
|
||||
# ext/psych/lib/**/*.rb \
|
||||
# ext/readline/*.c \
|
||||
# ext/ripper/*.c \
|
||||
# ext/ripper/lib/*.rb \
|
||||
# ext/ripper/lib/**/*.rb \
|
||||
# ext/socket/*.c \
|
||||
# ext/socket/lib/*.rb \
|
||||
# ext/socket/lib/**/*.rb \
|
||||
# ext/stringio/*.c \
|
||||
# ext/zlib/*.c
|
||||
# lib \
|
||||
# ext/bigdecimal \
|
||||
# ext/date \
|
||||
# ext/digest \
|
||||
# ext/json \
|
||||
# ext/pathname \
|
||||
# ext/psych \
|
||||
# ext/readline \
|
||||
# ext/ripper \
|
||||
# ext/socket \
|
||||
# ext/stringio \
|
||||
# ext/zlib \
|
||||
# \( -name '*.c' -or -name '*.rb' \) \
|
||||
# -not -wholename '*sample/*' \
|
||||
# | xargs \
|
||||
# rdoc --format=darkfish --no-line-numbers --op=rdoc --visibility=public
|
||||
|
||||
self.version = '2.0.0'
|
||||
self.dir = '/Users/Thibaut/DevDocs/Docs/RDoc/Ruby'
|
||||
|
@ -44,36 +30,48 @@ module Docs
|
|||
options[:skip] += %w(
|
||||
fatal.html
|
||||
unknown.html
|
||||
CompositePublisher.html
|
||||
Data.html
|
||||
E2MM.html
|
||||
English.html
|
||||
Exception2MessageMapper.html
|
||||
EXCEPTION_TYPE.html
|
||||
GServer.html
|
||||
Logging.html
|
||||
MakeMakefile.html
|
||||
ParallelEach.html
|
||||
Requirement.html
|
||||
SshDirPublisher.html
|
||||
SshFilePublisher.html
|
||||
SshFreshDirPublisher.html
|
||||
Sys.html
|
||||
YAML/DBM.html)
|
||||
|
||||
options[:skip_patterns] = [
|
||||
/\AComplex/,
|
||||
/\AJSON\/Ext/,
|
||||
/\AGem/,
|
||||
/\AHttpServer/,
|
||||
/\AHTTP/i,
|
||||
/\AIRB/,
|
||||
/\AMiniTest/i,
|
||||
/\ANet\/(?!HTTP)/,
|
||||
/\ANQXML/,
|
||||
/\AOpenSSL/,
|
||||
/\AOptionParser\//,
|
||||
/\APride/,
|
||||
/\APsych\//,
|
||||
/\ARacc/,
|
||||
/\ARake/,
|
||||
/\ARbConfig/,
|
||||
/\ARDoc/,
|
||||
/\AREXML/,
|
||||
/\ARSS/,
|
||||
/\AShell\//,
|
||||
/\ASocket\//,
|
||||
/\ATest/,
|
||||
/\AWEBrick/,
|
||||
/\AXML/,
|
||||
/\AXMP/
|
||||
]
|
||||
/\AXMP/]
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
Ruby Core © 1993–2013 Yukihiro Matsumoto<br>
|
||||
|
|
Loading…
Reference in a new issue