php.rb 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. module Docs
  2. class Php < FileScraper
  3. self.name = 'PHP'
  4. self.type = 'php'
  5. self.version = 'up to 5.5.6'
  6. self.base_url = 'http://www.php.net/manual/en/'
  7. self.root_path = 'index.html'
  8. # Downloaded from php.net/download-docs.php
  9. self.dir = '/Users/Thibaut/DevDocs/Docs/PHP'
  10. html_filters.push 'php/internal_urls', 'php/entries', 'php/clean_html', 'title'
  11. text_filters.push 'php/fix_urls'
  12. options[:title] = false
  13. options[:root_title] = 'PHP: Hypertext Preprocessor'
  14. INDEX_PATHS = %w(
  15. index.html
  16. funcref.html
  17. refs.database.html
  18. set.mysqlinfo.html
  19. language.control-structures.html
  20. reserved.exceptions.html
  21. reserved.interfaces.html
  22. reserved.variables.html)
  23. options[:skip_links] = ->(filter) do
  24. INDEX_PATHS.exclude?(filter.subpath)
  25. end
  26. options[:only] = INDEX_PATHS.dup
  27. options[:only_patterns] = [
  28. /\Aclass\./,
  29. /\Afunction\./,
  30. /\Acontrol-structures/,
  31. /\Areserved\.exceptions/,
  32. /\Areserved\.interfaces/,
  33. /\Areserved\.variables/]
  34. BOOKS = %w(amqp apache apc array bc bzip2 calendar classobj ctype curl
  35. datetime dba dir dom eio errorfunc exec fileinfo filesystem filter ftp
  36. funchand gearman geoip gettext gmagick hash http iconv iisfunc image
  37. imagick imap info inotify intl json ldap libevent libxml mail mailparse
  38. math mbstring mcrypt memcached misc mysqli network oauth openssl
  39. outcontrol password pcre pdo pgsql posix pthreads regex runkit reflection
  40. session session-pgsql simplexml soap sockets solr sphinx spl spl-types
  41. sqlite3 sqlsrv ssh2 stats stream strings taint tidy uodbc url var varnish
  42. xml xmlreader xmlrpc xmlwriter xsl yaf yaml zip zlib)
  43. options[:only].concat BOOKS.map { |s| "book.#{s}.html" }
  44. options[:skip] = %w(
  45. control-structures.intro.html
  46. control-structures.alternative-syntax.html
  47. function.mssql-select-db.html)
  48. options[:skip_patterns] = [/mysqlnd/]
  49. options[:attribution] = <<-HTML
  50. &copy; 1997&ndash;2013 The PHP Documentation Group<br>
  51. Licensed under the Creative Commons Attribution License v3.0 or later.
  52. HTML
  53. end
  54. end