Improve Ruby/RDoc scraper

pull/15/head
Thibaut 11 years ago
parent 49de7366fa
commit 7c1bd6b236

@ -23,14 +23,16 @@ module Docs
return [] if root_page? return [] if root_page?
require 'cgi' require 'cgi'
css('.method-detail').map do |node| css('.method-detail').inject [] do |entries, node|
name = node['id'].dup name = node['id'].dup
name.sub! %r{\A\w+?\-.}, '' name.sub! %r{\A\w+?\-.}, ''
name.sub! %r{\A-(?!\d)}, '' name.sub! %r{\A-(?!\d)}, ''
name.gsub! '-', '%' name.gsub! '-', '%'
name = CGI.unescape(name) name = CGI.unescape(name)
name.prepend self.name + (node['id'] =~ /\A\w+-c-/ ? '::' : '#') 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 end
end end

@ -1,38 +1,24 @@
module Docs module Docs
class Ruby < Rdoc class Ruby < Rdoc
# Generated with: # Generated with:
# rdoc \ # find \
# --format=darkfish \
# --no-line-numbers \
# --op=rdoc \
# --visibility=public \
# *.c \ # *.c \
# lib/**/*.rb \ # lib \
# lib/*.rb \ # ext/bigdecimal \
# ext/bigdecimal/*.c \ # ext/date \
# ext/bigdecimal/lib/*.rb \ # ext/digest \
# ext/bigdecimal/lib/**/*.rb \ # ext/json \
# ext/date/*.c \ # ext/pathname \
# ext/date/lib/*.rb \ # ext/psych \
# ext/date/lib/**/*.rb \ # ext/readline \
# ext/digest/*.c \ # ext/ripper \
# ext/digest/**/*.c \ # ext/socket \
# ext/digest/**/*.rb \ # ext/stringio \
# ext/json/lib/**/*.rb \ # ext/zlib \
# ext/pathname/*.c \ # \( -name '*.c' -or -name '*.rb' \) \
# ext/pathname/lib/*.rb \ # -not -wholename '*sample/*' \
# ext/psych/*.c \ # | xargs \
# ext/psych/lib/*.rb \ # rdoc --format=darkfish --no-line-numbers --op=rdoc --visibility=public
# 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
self.version = '2.0.0' self.version = '2.0.0'
self.dir = '/Users/Thibaut/DevDocs/Docs/RDoc/Ruby' self.dir = '/Users/Thibaut/DevDocs/Docs/RDoc/Ruby'
@ -44,36 +30,48 @@ module Docs
options[:skip] += %w( options[:skip] += %w(
fatal.html fatal.html
unknown.html unknown.html
CompositePublisher.html
Data.html Data.html
E2MM.html E2MM.html
English.html English.html
Exception2MessageMapper.html Exception2MessageMapper.html
EXCEPTION_TYPE.html
GServer.html GServer.html
Logging.html
MakeMakefile.html MakeMakefile.html
ParallelEach.html ParallelEach.html
Requirement.html Requirement.html
SshDirPublisher.html
SshFilePublisher.html
SshFreshDirPublisher.html
Sys.html
YAML/DBM.html) YAML/DBM.html)
options[:skip_patterns] = [ options[:skip_patterns] = [
/\AComplex/, /\AComplex/,
/\AJSON\/Ext/,
/\AGem/, /\AGem/,
/\AHttpServer/, /\AHTTP/i,
/\AIRB/, /\AIRB/,
/\AMiniTest/i, /\AMiniTest/i,
/\ANet\/(?!HTTP)/,
/\ANQXML/, /\ANQXML/,
/\AOpenSSL/, /\AOpenSSL/,
/\AOptionParser\//,
/\APride/, /\APride/,
/\APsych\//,
/\ARacc/, /\ARacc/,
/\ARake/, /\ARake/,
/\ARbConfig/, /\ARbConfig/,
/\ARDoc/, /\ARDoc/,
/\AREXML/, /\AREXML/,
/\ARSS/, /\ARSS/,
/\AShell\//,
/\ASocket\//,
/\ATest/, /\ATest/,
/\AWEBrick/, /\AWEBrick/,
/\AXML/, /\AXML/,
/\AXMP/ /\AXMP/]
]
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
Ruby Core &copy; 1993&ndash;2013 Yukihiro Matsumoto<br> Ruby Core &copy; 1993&ndash;2013 Yukihiro Matsumoto<br>

Loading…
Cancel
Save