Unified · Split
| @@ -311,7 +311,7 @@ credits = [ · 310 unmodified lines | ||
| 311 | 311 | 'https://raw.githubusercontent.com/phoenixframework/phoenix/master/LICENSE.md' |
| 312 | 312 | ], [ |
| 313 | 313 | 'PHP', |
| 314 | − '1997-2015 The PHP Documentation Group', | |
| 314 | + '1997-2016 The PHP Documentation Group', | |
| 315 | 315 | 'CC BY', |
| 316 | 316 | 'https://creativecommons.org/licenses/by/3.0/' |
| 317 | 317 | ], [ |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | @extend %lined-heading; |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | + h2 { @extend %block-heading; } | |
| 7 | 8 | h3.title { @extend %block-heading; } |
| 8 | 9 | |
| 9 | 10 | .verinfo { |
| @@ -186,5 +186,66 @@ module Docs · 185 unmodified lines | ||
| 186 | 186 | Typhoeus.stub(root_url.to_s).and_return(response) |
| 187 | 187 | end |
| 188 | 188 | end |
| 189 | + | |
| 190 | + module FixInternalUrlsBehavior | |
| 191 | + def self.included(base) | |
| 192 | + base.extend ClassMethods | |
| 193 | + end | |
| 194 | + | |
| 195 | + module ClassMethods | |
| 196 | + attr_reader :internal_urls | |
| 197 | + | |
| 198 | + def store_pages(store) | |
| 199 | + instrument 'info.doc', msg: 'Building internal urls...' | |
| 200 | + with_internal_urls do | |
| 201 | + instrument 'info.doc', msg: 'Building pages...' | |
| 202 | + super | |
| 203 | + end | |
| 204 | + end | |
| 205 | + | |
| 206 | + private | |
| 207 | + | |
| 208 | + def with_internal_urls | |
| 209 | + @internal_urls = new.fetch_internal_urls | |
| 210 | + yield | |
| 211 | + ensure | |
| 212 | + @internal_urls = nil | |
| 213 | + end | |
| 214 | + end | |
| 215 | + | |
| 216 | + def fetch_internal_urls | |
| 217 | + result = [] | |
| 218 | + build_pages do |page| | |
| 219 | + result << base_url.subpath_to(page[:response_url]) if page[:entries].present? | |
| 220 | + end | |
| 221 | + result | |
| 222 | + end | |
| 223 | + | |
| 224 | + def initial_urls | |
| 225 | + return super unless self.class.internal_urls | |
| 226 | + @initial_urls ||= self.class.internal_urls.map(&method(:url_for)).freeze | |
| 227 | + end | |
| 228 | + | |
| 229 | + private | |
| 230 | + | |
| 231 | + def additional_options | |
| 232 | + if self.class.internal_urls | |
| 233 | + { | |
| 234 | + only: self.class.internal_urls.to_set, | |
| 235 | + only_patterns: nil, | |
| 236 | + skip: nil, | |
| 237 | + skip_patterns: nil, | |
| 238 | + skip_links: nil, | |
| 239 | + fixed_internal_urls: true | |
| 240 | + } | |
| 241 | + else | |
| 242 | + {} | |
| 243 | + end | |
| 244 | + end | |
| 245 | + | |
| 246 | + def process_response(response) | |
| 247 | + super.merge! response_url: response.url | |
| 248 | + end | |
| 249 | + end | |
| 189 | 250 | end |
| 190 | 251 | end |
| @@ -25,6 +25,18 @@ module Docs · 24 unmodified lines | ||
| 25 | 25 | node.inner_html = node.inner_html.gsub(br, "\n") |
| 26 | 26 | node.content = node.content |
| 27 | 27 | end |
| 28 | + | |
| 29 | + css('> h2:first-child.title').each do |node| | |
| 30 | + node.name = 'h1' | |
| 31 | + end | |
| 32 | + | |
| 33 | + css('div.partintro', 'div.section').each do |node| | |
| 34 | + node.before(node.children).remove | |
| 35 | + end | |
| 36 | + | |
| 37 | + css('.title + .verinfo + .title').each do |node| | |
| 38 | + node.after(node.previous_element) | |
| 39 | + end | |
| 28 | 40 | end |
| 29 | 41 | end |
| 30 | 42 | end |
| @@ -25,6 +25,7 @@ module Docs · 24 unmodified lines | ||
| 25 | 25 | 'tidy' => 'Tidy', |
| 26 | 26 | 'Worker' => 'pthreads', |
| 27 | 27 | 'XsltProcessor' => 'XSLT', |
| 28 | + 'Yar' => 'Yar', | |
| 28 | 29 | 'ZipArchive' => 'Zip' } |
| 29 | 30 | |
| 30 | 31 | %w(APC Directory DOM Event Gearman Gmagick Imagick mysqli OAuth PDO Reflection |
| @@ -46,13 +47,16 @@ module Docs · 15 unmodified lines | ||
| 46 | 47 | end |
| 47 | 48 | |
| 48 | 49 | REPLACE_TYPES = { |
| 50 | + 'Error' => 'Errors', | |
| 49 | 51 | 'Exceptions' => 'SPL/Exceptions', |
| 52 | + 'finfo' => 'File System', | |
| 50 | 53 | 'GD and Image' => 'Image', |
| 51 | 54 | 'Gmagick' => 'Image/GraphicsMagick', |
| 52 | 55 | 'Imagick' => 'Image/ImageMagick', |
| 53 | 56 | 'Interfaces' => 'SPL/Interfaces', |
| 54 | 57 | 'Iterators' => 'SPL/Iterators', |
| 55 | 58 | 'mysqli' => 'Database/MySQL', |
| 59 | + 'PCRE Patterns' => 'PCRE Reference', | |
| 56 | 60 | 'PostgreSQL' => 'Database/PostgreSQL', |
| 57 | 61 | 'Session' => 'Sessions', |
| 58 | 62 | 'Session PgSQL' => 'Database/PostgreSQL', |
| @@ -62,7 +66,7 @@ module Docs · 3 unmodified lines | ||
| 62 | 66 | 'Yaml' => 'YAML' } |
| 63 | 67 | |
| 64 | 68 | TYPE_GROUPS = { |
| 65 | − 'Classes and Functions' => ['Classes/Object', 'Function handling', 'Predefined Interfaces and Classes', 'runkit'], | |
| 69 | + 'Classes and Functions' => ['Classes/Object', 'Function handling', 'Predefined Interfaces and Classes', 'runkit', 'Throwable'], | |
| 66 | 70 | 'Encoding' => ['Gettext', 'iconv', 'Multibyte String'], |
| 67 | 71 | 'Compression' => ['Bzip2', 'Zip', 'Zlib'], |
| 68 | 72 | 'Cryptography' => ['Hash', 'Mcrypt', 'OpenSSL', 'Password Hashing'], |
| @@ -90,6 +94,9 @@ module Docs · 21 unmodified lines | ||
| 90 | 94 | end |
| 91 | 95 | |
| 92 | 96 | def get_type |
| 97 | + return 'Language Reference' if subpath.start_with?('language.') | |
| 98 | + return 'PCRE Reference' if subpath.start_with?('regexp.') | |
| 99 | + | |
| 93 | 100 | type = at_css('.up').content.strip |
| 94 | 101 | type = 'SPL/Iterators' if type.end_with? 'Iterator' |
| 95 | 102 | type.remove! ' Functions' |
| @@ -108,7 +115,7 @@ module Docs · 12 unmodified lines | ||
| 108 | 115 | end |
| 109 | 116 | |
| 110 | 117 | def include_default_entry? |
| 111 | − !initial_page? && doc.at_css('.reference', '.refentry', '.sect1') | |
| 118 | + !initial_page? && doc.at_css('.reference', '.refentry', '.sect1', '.simpara', '.para') | |
| 112 | 119 | end |
| 113 | 120 | end |
| 114 | 121 | end |
| @@ -3,7 +3,7 @@ module Docs · 2 unmodified lines | ||
| 3 | 3 | class FixUrlsFilter < Filter |
| 4 | 4 | def call |
| 5 | 5 | html.gsub! File.join(Php.base_url, Php.root_path), Php.base_url |
| 6 | − html.gsub! %r{http://www\.php\.net/manual/en/([^"']+?)\.html}, 'http://www.php.net/manual/en/\1.php' | |
| 6 | + html.gsub! %r{https://secure\.php\.net/manual/en/([^"']+?)\.html}, 'https://secure.php.net/manual/en/\1.php' | |
| 7 | 7 | html |
| 8 | 8 | end |
| 9 | 9 | end |
| @@ -2,9 +2,12 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Php |
| 3 | 3 | class InternalUrlsFilter < Filter |
| 4 | 4 | def call |
| 5 | + return doc if context[:fixed_internal_urls] | |
| 6 | + | |
| 5 | 7 | if subpath.start_with?('book.') || subpath.start_with?('class.') |
| 6 | 8 | result[:internal_urls] = internal_urls |
| 7 | 9 | end |
| 10 | + | |
| 8 | 11 | doc |
| 9 | 12 | end |
| 10 | 13 | |
| @@ -1,19 +1,28 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class Php < FileScraper |
| 3 | + include FixInternalUrlsBehavior | |
| 4 | + | |
| 3 | 5 | self.name = 'PHP' |
| 4 | 6 | self.type = 'php' |
| 5 | − self.release = 'up to 5.6.13' | |
| 6 | − self.base_url = 'http://www.php.net/manual/en/' | |
| 7 | + self.release = 'up to 7.0.3' | |
| 8 | + self.base_url = 'https://secure.php.net/manual/en/' | |
| 7 | 9 | self.root_path = 'index.html' |
| 8 | 10 | self.initial_paths = %w( |
| 9 | 11 | funcref.html |
| 12 | + langref.html | |
| 10 | 13 | refs.database.html |
| 11 | 14 | set.mysqlinfo.html |
| 12 | 15 | language.control-structures.html |
| 16 | + reference.pcre.pattern.syntax.html | |
| 13 | 17 | reserved.exceptions.html |
| 14 | 18 | reserved.interfaces.html |
| 15 | 19 | reserved.variables.html) |
| 16 | 20 | |
| 21 | + self.links = { | |
| 22 | + home: 'https://secure.php.net/', | |
| 23 | + code: 'https://github.com/php/php-src' | |
| 24 | + } | |
| 25 | + | |
| 17 | 26 | # Downloaded from php.net/download-docs.php |
| 18 | 27 | self.dir = '/Users/Thibaut/DevDocs/Docs/PHP' |
| 19 | 28 | |
| @@ -25,34 +34,37 @@ module Docs · 5 unmodified lines | ||
| 25 | 34 | options[:skip_links] = ->(filter) { !filter.initial_page? } |
| 26 | 35 | |
| 27 | 36 | options[:only_patterns] = [ |
| 37 | + /\Alanguage\./, | |
| 28 | 38 | /\Aclass\./, |
| 29 | 39 | /\Afunction\./, |
| 30 | 40 | /\Acontrol-structures/, |
| 41 | + /\Aregexp\./, | |
| 31 | 42 | /\Areserved\.exceptions/, |
| 32 | 43 | /\Areserved\.interfaces/, |
| 33 | 44 | /\Areserved\.variables/] |
| 34 | 45 | |
| 35 | − BOOKS = %w(apache apc array bc bzip2 calendar classobj ctype curl datetime | |
| 36 | − dba dir dom eio errorfunc event exec fileinfo filesystem filter ftp funchand | |
| 37 | − gearman geoip gettext gmagick hash http iconv iisfunc image imagick imap | |
| 38 | − info inotify intl json ldap libevent libxml mail mailparse math mbstring | |
| 39 | − mcrypt memcached misc mysqli network oauth openssl outcontrol password | |
| 40 | − pcre pdo pgsql posix pthreads regex runkit reflection session | |
| 41 | − session-pgsql simplexml soap sockets solr sphinx spl spl-types sqlite3 | |
| 42 | − sqlsrv ssh2 stats stream strings taint tidy uodbc url var varnish xml | |
| 43 | − xmlreader xmlrpc xmlwriter xsl yaf yaml zip zlib) | |
| 46 | + BOOKS = %w(apache apc array bc bzip2 calendar csprng classobj ctype curl | |
| 47 | + datetime dba dir dom eio errorfunc event exec fileinfo filesystem filter | |
| 48 | + ftp funchand gearman geoip gettext gmagick gmp hash iconv iisfunc image | |
| 49 | + imagick imap info inotify intl json ldap libevent libxml mail mailparse | |
| 50 | + math mbstring mcrypt memcached misc mysqli network oauth openssl | |
| 51 | + outcontrol password pcre pdo pgsql posix pthreads regex runkit reflection | |
| 52 | + sca session session-pgsql simplexml soap sockets solr sphinx spl | |
| 53 | + spl-types sqlite3 sqlsrv ssh2 stats stream strings taint tidy uodbc url | |
| 54 | + var varnish xml xmlreader xmlrpc xmlwriter xsl yaf yar yaml zip zlib) | |
| 44 | 55 | |
| 45 | 56 | options[:only] = BOOKS.map { |s| "book.#{s}.html" } |
| 46 | 57 | |
| 47 | 58 | options[:skip] = %w( |
| 48 | 59 | control-structures.intro.html |
| 49 | 60 | control-structures.alternative-syntax.html |
| 50 | − function.mssql-select-db.html) | |
| 61 | + function.mssql-select-db.html | |
| 62 | + pthreads.modifiers.html) | |
| 51 | 63 | |
| 52 | 64 | options[:skip_patterns] = [/mysqlnd/] |
| 53 | 65 | |
| 54 | 66 | options[:attribution] = <<-HTML |
| 55 | − © 1997–2015 The PHP Documentation Group<br> | |
| 67 | + © 1997–2016 The PHP Documentation Group<br> | |
| 56 | 68 | Licensed under the Creative Commons Attribution License v3.0 or later. |
| 57 | 69 | HTML |
| 58 | 70 | end |