Update PHP documentation (7.1.0)

pull/547/head
Thibaut Courouble 8 years ago
parent 3a18fe6d16
commit bd2224b9d1

@ -7,6 +7,10 @@
h2 { @extend %block-heading; }
h3.title { @extend %block-heading; }
.manualnavbar {
margin-top: 1rem;
}
.verinfo {
float: right;
font-weight: bold;
@ -28,6 +32,7 @@
blockquote.note > p { margin-bottom: 0; }
div.warning { @extend %note, %note-red; }
div.caution { @extend %note, %note-orange; }
div.tip { @extend %note, %note-green; }
strong > code, dt > code { @extend %label; }

@ -11,16 +11,28 @@ module Docs
end
def other
css('.manualnavbar', 'hr').remove
css('.manualnavbar:first-child', '.manualnavbar .up', '.manualnavbar .home', 'hr').remove
nav = at_css('.manualnavbar').remove
if prev_link = nav.at_css('.prev a')
prev_link.content = "#{prev_link.content}"
end
if next_link = nav.at_css('.next a')
next_link.content = "#{next_link.content}"
end
# Remove top-level <div>
if doc.elements.length == 1
@doc = doc.first_element_child
end
doc << nav
# Remove code highlighting
br = /<br\s?\/?>/i
css('.phpcode').each do |node|
css('.phpcode', 'div.methodsynopsis').each do |node|
node.name = 'pre'
node.inner_html = node.inner_html.gsub(br, "\n")
node.content = node.content.strip

@ -7,6 +7,7 @@ module Docs
'Cond' => 'pthreads',
'CURL' => 'cURL',
'Date' => 'Date/Time',
'Ds' => 'Data Structures',
'ErrorException' => 'Predefined Exceptions',
'Exception' => 'Predefined Exceptions',
'Json' => 'JSON',
@ -14,6 +15,7 @@ module Docs
'Mutex' => 'pthreads',
'php_user_filter' => 'Stream',
'Pool' => 'pthreads',
'QuickHash' => 'Quickhash',
'Reflector' => 'Reflection',
'Soap' => 'SOAP',
'SplFile' => 'SPL/File',
@ -24,6 +26,7 @@ module Docs
'streamWrapper' => 'Stream',
'Thread' => 'pthreads',
'tidy' => 'Tidy',
'Weak' => 'Weakref',
'Worker' => 'pthreads',
'XsltProcessor' => 'XSLT',
'Yar' => 'Yar',
@ -48,8 +51,10 @@ module Docs
end
REPLACE_TYPES = {
'APCu' => 'APC',
'Error' => 'Errors',
'Exceptions' => 'SPL/Exceptions',
'Exif' => 'Image/Exif',
'finfo' => 'File System',
'GD and Image' => 'Image',
'Gmagick' => 'Image/GraphicsMagick',
@ -74,7 +79,7 @@ module Docs
'Database' => ['DBA', 'ODBC', 'PDO'],
'Date and Time' => ['Calendar', 'Date/Time'],
'Errors' => ['Error Handling', 'Predefined Exceptions'],
'File System' => ['Directory', 'Fileinfo', 'Filesystem', 'Inotify'],
'File System' => ['Directory', 'Fileinfo', 'Filesystem', 'Inotify', 'Proctitle'],
'HTML' => ['DOM', 'Tidy'],
'Language' => ['Control Structures', 'Misc.', 'PHP Options/Info', 'Predefined Variables'],
'Mail' => ['Mail', 'Mailparse'],
@ -116,6 +121,47 @@ module Docs
REPLACE_TYPES[type] || type
end
ALIASES = {
'language.oop5.traits' => ['trait'],
'language.operators.type' => ['instanceof'],
'functions.user-defined' => ['function'],
'language.oop5.visibility' => ['public', 'private', 'protected'],
'language.references.whatdo' => ['=&'],
'language.oop5.static' => ['static'],
'language.oop5.interfaces' => ['interface', 'implements'],
'language.oop5.inheritance' => ['extends'],
'language.oop5.cloning' => ['clone', '__clone()'],
'language.operators.logical' => ['and', 'or', 'xor'],
'language.operators.increment' => ['++', '--'],
'language.generators.syntax' => ['yield'],
'language.oop5.final' => ['final'],
'language.exceptions' => ['try', 'catch', 'finally'],
'language.oop5.decon' => ['__construct()', '__destruct()'],
'language.operators.comparison' => ['==', '===', '!=', '<>', '!==', '<=>'],
'language.oop5.abstract' => ['abstract'],
'language.operators.bitwise' => ['&', '|', '^', '~', '<<', '>>']
}
def additional_entries
if aliases = ALIASES[slug]
aliases.map { |a| [a] }
elsif slug == 'language.constants.predefined'
css('table tr[id]').map do |node|
[node.at_css('code').content, node['id']]
end
elsif slug == 'language.oop5.magic'
css('h3 a').map do |node|
[node.content, node['href'][/#(.+)/, 1]]
end
elsif slug == 'language.oop5.overloading'
css('.methodsynopsis[id]').map do |node|
[node.at_css('.methodname').content + '()', node['id']]
end
else
[]
end
end
def include_default_entry?
!initial_page? && doc.at_css('.reference', '.refentry', '.sect1', '.simpara', '.para')
end

@ -4,7 +4,7 @@ module Docs
self.name = 'PHP'
self.type = 'php'
self.release = 'up to 7.0.11'
self.release = 'up to 7.1.0'
self.base_url = 'https://secure.php.net/manual/en/'
self.root_path = 'index.html'
self.initial_paths = %w(
@ -43,15 +43,15 @@ module Docs
/\Areserved\.interfaces/,
/\Areserved\.variables/]
BOOKS = %w(apache apc array bc bzip2 calendar csprng classobj ctype curl
datetime dba dir dom eio errorfunc ev event exec fileinfo filesystem filter
BOOKS = %w(apache apc apcu array bc bzip2 calendar csprng classobj ctype curl
datetime dba dir dom ds eio errorfunc ev event exec exif fileinfo filesystem filter
ftp funchand gearman geoip gettext gmagick gmp hash iconv iisfunc image
imagick imap info inotify intl json ldap libevent libxml mail mailparse
math mbstring mcrypt memcached misc mysqli network oauth openssl
outcontrol password pcntl pcre pdo pgsql phar posix pthreads regex runkit reflection
sca session sem session-pgsql shmop simplexml soap sockets solr sphinx spl
outcontrol password pcntl pcre pdo pgsql phar posix proctitle pthreads quickhash regex runkit
reflection sca session sem session-pgsql shmop simplexml soap sockets solr sphinx spl
spl-types sqlite3 sqlsrv ssh2 stats stream strings sync taint tidy uodbc url
var varnish xml xmlreader xmlrpc xmlwriter xsl yaf yar yaml zip zlib)
var varnish weakref xml xmlreader xmlrpc xmlwriter xsl yaf yar yaml zip zlib)
options[:only] = BOOKS.map { |s| "book.#{s}.html" }

Loading…
Cancel
Save