Bläddra i källkod

Update and improve PHP documentation (5.6.6)

Fixes #162.
Thibaut 10 år sedan
förälder
incheckning
c3e41d792a

+ 6 - 0
assets/javascripts/views/pages/php.coffee

@@ -0,0 +1,6 @@
+#= require views/pages/base
+
+class app.views.PhpPage extends app.views.BasePage
+  afterRender: ->
+    @highlightCode @findAllByClass('phpcode'), 'php'
+    return

+ 0 - 2
assets/stylesheets/pages/_php.scss

@@ -23,8 +23,6 @@
   .classsynopsis > .methodsynopsis,
   .classsynopsis > .fieldsynopsis { margin-left: 1em; }
 
-  .phpcode > pre { white-space: normal; }
-
   blockquote.note { @extend %note; }
   blockquote.note > p { margin-bottom: 0; }
 

+ 5 - 2
lib/docs/filters/php/clean_html.rb

@@ -18,9 +18,12 @@ module Docs
           @doc = doc.first_element_child
         end
 
-        # Put code blocks in <pre> tags
-        css('.phpcode > code').each do |node|
+        # Remove code highlighting
+        br = /<br\s?\/?>/i
+        css('.phpcode').each do |node|
           node.name = 'pre'
+          node.inner_html = node.inner_html.gsub(br, "\n")
+          node.content = node.content
         end
       end
     end

+ 1 - 1
lib/docs/filters/php/entries.rb

@@ -27,7 +27,7 @@ module Docs
         'XsltProcessor'   => 'XSLT',
         'ZipArchive'      => 'Zip' }
 
-      %w(APC Directory DOM Gearman Gmagick Imagick mysqli OAuth PDO Reflection
+      %w(APC Directory DOM Event Gearman Gmagick Imagick mysqli OAuth PDO Reflection
         Session SimpleXML Solr Sphinx SQLite3 Varnish XSLT Yaf).each do |str|
         TYPE_BY_NAME_STARTS_WITH[str] = str
       end

+ 2 - 2
lib/docs/scrapers/php.rb

@@ -2,7 +2,7 @@ module Docs
   class Php < FileScraper
     self.name = 'PHP'
     self.type = 'php'
-    self.version = 'up to 5.6.5'
+    self.version = 'up to 5.6.6'
     self.base_url = 'http://www.php.net/manual/en/'
     self.root_path = 'index.html'
     self.initial_paths = %w(
@@ -33,7 +33,7 @@ module Docs
       /\Areserved\.variables/]
 
     BOOKS = %w(apache apc array bc bzip2 calendar classobj ctype curl datetime
-      dba dir dom eio errorfunc exec fileinfo filesystem filter ftp funchand
+      dba dir dom eio errorfunc event exec fileinfo filesystem filter ftp funchand
       gearman geoip gettext gmagick hash http 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