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

@ -11,16 +11,28 @@ module Docs
end end
def other 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> # Remove top-level <div>
if doc.elements.length == 1 if doc.elements.length == 1
@doc = doc.first_element_child @doc = doc.first_element_child
end end
doc << nav
# Remove code highlighting # Remove code highlighting
br = /<br\s?\/?>/i br = /<br\s?\/?>/i
css('.phpcode').each do |node| css('.phpcode', 'div.methodsynopsis').each do |node|
node.name = 'pre' node.name = 'pre'
node.inner_html = node.inner_html.gsub(br, "\n") node.inner_html = node.inner_html.gsub(br, "\n")
node.content = node.content.strip node.content = node.content.strip

@ -7,6 +7,7 @@ module Docs
'Cond' => 'pthreads', 'Cond' => 'pthreads',
'CURL' => 'cURL', 'CURL' => 'cURL',
'Date' => 'Date/Time', 'Date' => 'Date/Time',
'Ds' => 'Data Structures',
'ErrorException' => 'Predefined Exceptions', 'ErrorException' => 'Predefined Exceptions',
'Exception' => 'Predefined Exceptions', 'Exception' => 'Predefined Exceptions',
'Json' => 'JSON', 'Json' => 'JSON',
@ -14,6 +15,7 @@ module Docs
'Mutex' => 'pthreads', 'Mutex' => 'pthreads',
'php_user_filter' => 'Stream', 'php_user_filter' => 'Stream',
'Pool' => 'pthreads', 'Pool' => 'pthreads',
'QuickHash' => 'Quickhash',
'Reflector' => 'Reflection', 'Reflector' => 'Reflection',
'Soap' => 'SOAP', 'Soap' => 'SOAP',
'SplFile' => 'SPL/File', 'SplFile' => 'SPL/File',
@ -24,6 +26,7 @@ module Docs
'streamWrapper' => 'Stream', 'streamWrapper' => 'Stream',
'Thread' => 'pthreads', 'Thread' => 'pthreads',
'tidy' => 'Tidy', 'tidy' => 'Tidy',
'Weak' => 'Weakref',
'Worker' => 'pthreads', 'Worker' => 'pthreads',
'XsltProcessor' => 'XSLT', 'XsltProcessor' => 'XSLT',
'Yar' => 'Yar', 'Yar' => 'Yar',
@ -48,8 +51,10 @@ module Docs
end end
REPLACE_TYPES = { REPLACE_TYPES = {
'APCu' => 'APC',
'Error' => 'Errors', 'Error' => 'Errors',
'Exceptions' => 'SPL/Exceptions', 'Exceptions' => 'SPL/Exceptions',
'Exif' => 'Image/Exif',
'finfo' => 'File System', 'finfo' => 'File System',
'GD and Image' => 'Image', 'GD and Image' => 'Image',
'Gmagick' => 'Image/GraphicsMagick', 'Gmagick' => 'Image/GraphicsMagick',
@ -74,7 +79,7 @@ module Docs
'Database' => ['DBA', 'ODBC', 'PDO'], 'Database' => ['DBA', 'ODBC', 'PDO'],
'Date and Time' => ['Calendar', 'Date/Time'], 'Date and Time' => ['Calendar', 'Date/Time'],
'Errors' => ['Error Handling', 'Predefined Exceptions'], 'Errors' => ['Error Handling', 'Predefined Exceptions'],
'File System' => ['Directory', 'Fileinfo', 'Filesystem', 'Inotify'], 'File System' => ['Directory', 'Fileinfo', 'Filesystem', 'Inotify', 'Proctitle'],
'HTML' => ['DOM', 'Tidy'], 'HTML' => ['DOM', 'Tidy'],
'Language' => ['Control Structures', 'Misc.', 'PHP Options/Info', 'Predefined Variables'], 'Language' => ['Control Structures', 'Misc.', 'PHP Options/Info', 'Predefined Variables'],
'Mail' => ['Mail', 'Mailparse'], 'Mail' => ['Mail', 'Mailparse'],
@ -116,6 +121,47 @@ module Docs
REPLACE_TYPES[type] || type REPLACE_TYPES[type] || type
end 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? def include_default_entry?
!initial_page? && doc.at_css('.reference', '.refentry', '.sect1', '.simpara', '.para') !initial_page? && doc.at_css('.reference', '.refentry', '.sect1', '.simpara', '.para')
end end

@ -4,7 +4,7 @@ module Docs
self.name = 'PHP' self.name = 'PHP'
self.type = '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.base_url = 'https://secure.php.net/manual/en/'
self.root_path = 'index.html' self.root_path = 'index.html'
self.initial_paths = %w( self.initial_paths = %w(
@ -43,15 +43,15 @@ module Docs
/\Areserved\.interfaces/, /\Areserved\.interfaces/,
/\Areserved\.variables/] /\Areserved\.variables/]
BOOKS = %w(apache apc array bc bzip2 calendar csprng classobj ctype curl BOOKS = %w(apache apc apcu array bc bzip2 calendar csprng classobj ctype curl
datetime dba dir dom eio errorfunc ev event exec fileinfo filesystem filter 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 ftp funchand gearman geoip gettext gmagick gmp hash iconv iisfunc image
imagick imap info inotify intl json ldap libevent libxml mail mailparse imagick imap info inotify intl json ldap libevent libxml mail mailparse
math mbstring mcrypt memcached misc mysqli network oauth openssl math mbstring mcrypt memcached misc mysqli network oauth openssl
outcontrol password pcntl pcre pdo pgsql phar posix pthreads regex runkit reflection outcontrol password pcntl pcre pdo pgsql phar posix proctitle pthreads quickhash regex runkit
sca session sem session-pgsql shmop simplexml soap sockets solr sphinx spl 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 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" } options[:only] = BOOKS.map { |s| "book.#{s}.html" }

Loading…
Cancel
Save