php.rb 2.4 KB

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