Преглед изворни кода

Merge pull request #1403 from MasterEnoc/twig

Update Twig to 3.1.1 and update previous versions
Simon Legner пре 5 година
родитељ
комит
c0dbaaf140

+ 1 - 1
assets/javascripts/templates/pages/about_tmpl.coffee

@@ -798,7 +798,7 @@ credits = [
     'https://raw.githubusercontent.com/python-trio/trio/master/LICENSE.MIT'
   ], [
     'Twig',
-    '2009-2018 The Twig Team',
+    '2009-2020 The Twig Team',
     'BSD',
     'https://twig.symfony.com/license'
   ], [

+ 18 - 1
lib/docs/filters/twig/clean_html.rb

@@ -2,7 +2,8 @@ module Docs
   class Twig
     class CleanHtmlFilter < Filter
       def call
-        css('.infobar', '.offline-docs', '.headerlink').remove
+
+        css('.infobar', '.offline-docs', '.headerlink', '.linenos').remove
 
         css('.builtin-reference', '.admonition-wrapper', 'h1 > code', 'h2 > code', '.body-web', '.reference em').each do |node|
           node.before(node.children).remove
@@ -33,7 +34,23 @@ module Docs
           node['style'] = 'text-align: center'
         end
 
+        # syntax highlight
+        css('.highlight').each do |node|
+          node.css('pre').each do |subnode|
+            subnode['data-language'] = 'php'
+            subnode.add_class('highlight')
+          end
+        end
+
+        # fix code blocks style
+        css('.highlighttable').each do |node|
+          code = node.at_css('pre')
+          node.before(code)
+          node.remove
+        end
+
         doc
+
       end
     end
   end

+ 9 - 3
lib/docs/scrapers/twig.rb

@@ -11,7 +11,7 @@ module Docs
     options[:attribution] = <<-HTML
       &copy; 2009&ndash;2018 by the Twig Team<br>
       Licensed under the three clause BSD license.<br>
-      The Twig logo is &copy; 2010&ndash;2018 Symfony
+      The Twig logo is &copy; 2010&ndash;2020 Symfony
     HTML
 
     html_filters.push 'twig/clean_html', 'twig/entries'
@@ -19,13 +19,18 @@ module Docs
     options[:container] = 'div.bd > div.content'
     options[:skip] = %w(deprecated.html advanced_legacy.html)
 
+    version '3' do
+      self.release = '3.1.1'
+      self.base_url = 'https://twig.symfony.com/doc/3.x/'
+    end
+
     version '2' do
-      self.release = '2.5.0'
+      self.release = '2.14.1'
       self.base_url = 'https://twig.symfony.com/doc/2.x/'
     end
 
     version '1' do
-      self.release = '1.34.3'
+      self.release = '1.44.1'
       self.base_url = 'https://twig.symfony.com/doc/1.x/'
     end
 
@@ -33,5 +38,6 @@ module Docs
       tags = get_github_tags('twigphp', 'Twig', opts)
       tags[0]['name'][1..-1]
     end
+
   end
 end

BIN
public/icons/docs/twig/16.png


BIN
public/icons/docs/twig/16@2x.png


+ 1 - 1
public/icons/docs/twig/SOURCE

@@ -1 +1 @@
-http://twig.sensiolabs.org/images/twig-logo.png
+https://twig.symfony.com/images/logo.png