php.rb 2.1 KB

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