php.rb 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. module Docs
  2. class Php < FileScraper
  3. include FixInternalUrlsBehavior
  4. self.name = 'PHP'
  5. self.type = 'php'
  6. self.release = '7.2.2'
  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://git.php.net/?p=php-src.git;a=summary'
  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. /\Afunctions?\./,
  34. /\Acontrol-structures/,
  35. /\Aregexp\./,
  36. /\Areserved\.exceptions/,
  37. /\Areserved\.interfaces/,
  38. /\Areserved\.variables/]
  39. BOOKS = %w(apache apc apcu array bc bzip2 calendar csprng classobj ctype curl
  40. datetime dba dir dom ds eio errorfunc ev event exec exif fileinfo filesystem filter
  41. ftp funchand gearman geoip gettext gmagick gmp hash ibase iconv iisfunc image
  42. imagick imap info inotify intl json judy ldap libevent libxml lua mail mailparse
  43. math mbstring mcrypt memcached misc mysqli network oauth openssl
  44. outcontrol password pcntl pcre pdo pgsql phar posix proctitle pthreads quickhash regex runkit
  45. reflection sca session sem session-pgsql shmop simplexml soap sockets solr sphinx spl
  46. spl-types sqlite3 sqlsrv ssh2 stats stream strings sync taint tidy tokenizer uodbc url
  47. v8js var varnish weakref 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;2018 The PHP Documentation Group<br>
  57. Licensed under the Creative Commons Attribution License v3.0 or later.
  58. HTML
  59. end
  60. end