Thibaut 10 лет назад
Родитель
Сommit
81c9bfa874

BIN
assets/images/icons.png


BIN
assets/images/icons@2x.png


+ 1 - 1
assets/javascripts/news.json

@@ -1,6 +1,6 @@
 [
   [ "2015-02-15",
-    "New <a href=\"/iojs/\">io.js</a> and <a href=\"/yii1/\">Yii 1.1</a> documentations"
+    "New <a href=\"/iojs/\">io.js</a>, <a href=\"/lua/\">Lua</a> and <a href=\"/yii1/\">Yii 1.1</a> documentations"
   ], [
     "2015-02-08",
     "New dark theme\nClick the icon in the bottom left corner to activate.\n<a href=\"https://github.com/Thibaut/devdocs/issues\" target=\"_blank\">Feedback</a> welcome :)"

+ 5 - 0
assets/javascripts/templates/pages/about_tmpl.coffee

@@ -200,6 +200,11 @@ credits = [
     '2012-2015 The Dojo Foundation',
     'MIT',
     'https://raw.github.com/lodash/lodash/master/LICENSE.txt'
+  ], [
+    'Lua',
+    '1994–2015 Lua.org, PUC-Rio',
+    'MIT',
+    'http://www.lua.org/license.html'
   ], [
     'Marionette.js',
     '2014 Muted Solutions, LLC',

+ 1 - 0
assets/stylesheets/application-dark.css.scss

@@ -46,6 +46,7 @@
         'pages/laravel',
         'pages/less',
         'pages/lodash',
+        'pages/lua',
         'pages/marionette',
         'pages/markdown',
         'pages/maxcdn',

+ 1 - 0
assets/stylesheets/application.css.scss

@@ -46,6 +46,7 @@
         'pages/laravel',
         'pages/less',
         'pages/lodash',
+        'pages/lua',
         'pages/marionette',
         'pages/markdown',
         'pages/maxcdn',

+ 1 - 0
assets/stylesheets/global/_icons.scss

@@ -86,3 +86,4 @@
 %icon-light                 { background-position: 0 -14rem; }
 %icon-light-white           { background-position: -1rem -14rem; }
 ._icon-iojs:before          { background-position: -2rem -14rem; }
+._icon-lua:before           { background-position: -3rem -14rem; }

+ 10 - 0
assets/stylesheets/pages/_lua.scss

@@ -0,0 +1,10 @@
+._lua {
+  padding-left: 1rem;
+
+  h1, h2 { margin-left: -1rem; }
+  h2 { @extend %block-heading; }
+  h3 { @extend %block-label, %label-blue; }
+  h4 { font-size: inherit; }
+
+  .apii { float: right; }
+}

+ 31 - 0
lib/docs/filters/lua/clean_html.rb

@@ -0,0 +1,31 @@
+module Docs
+  class Lua
+    class CleanHtmlFilter < Filter
+      def call
+        css('hr', 'h1 img', '.footer').remove
+
+        css('[name]').each do |node|
+          node['id'] = node['name']
+          node.remove_attribute('name')
+        end
+
+        css('h1 > a[id]', 'h2 > a[id]', 'h3 > a[id]').each do |node|
+          node.parent['id'] = node['id']
+          node.before(node.children).remove
+        end
+
+        3.times { at_css('h1[id="1"]').previous_element.remove }
+
+        css('.apii').each do |node|
+          node.parent.previous_element << node
+        end
+
+        css('pre').each do |node|
+          node.content = node.content.remove(/\A\s*\n/).rstrip.strip_heredoc
+        end
+
+        doc
+      end
+    end
+  end
+end

+ 29 - 0
lib/docs/filters/lua/entries.rb

@@ -0,0 +1,29 @@
+module Docs
+  class Lua
+    class EntriesFilter < Docs::EntriesFilter
+      def additional_entries
+        type = nil
+
+        doc.children.each_with_object [] do |node, entries|
+          if node.name == 'h1'
+            type = node.content.strip
+            type.remove! %r{.+\u{2013}\s+}
+            type.remove! 'The '
+            type = 'API' if type == 'Application Program Interface'
+          end
+
+          next if type && type.include?('Incompatibilities')
+          next if node.name == 'h2' && type.in?(%w(API Auxiliary\ Library Standard\ Libraries))
+
+          if node.name == 'h2' || node.name == 'h3'
+            name = node.content
+            name.remove! %r{.+\u{2013}\s+}
+            name.remove! %r{\[.+\]}
+            name.gsub! %r{\s+\(.*\)}, '()'
+            entries << [name, node['id'], type]
+          end
+        end
+      end
+    end
+  end
+end

+ 17 - 0
lib/docs/scrapers/lua.rb

@@ -0,0 +1,17 @@
+module Docs
+  class Lua < UrlScraper
+    self.type = 'lua'
+    self.version = '5.3'
+    self.base_url = 'http://www.lua.org/manual/5.3/'
+    self.root_path = 'manual.html'
+
+    html_filters.push 'lua/clean_html', 'lua/entries'
+
+    options[:skip_links] = true
+
+    options[:attribution] = <<-HTML
+      &copy; 1994&ndash;2015 Lua.org, PUC-Rio.<br>
+      Licensed under the MIT License.
+    HTML
+  end
+end

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


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


+ 1 - 0
public/icons/docs/lua/SOURCE

@@ -0,0 +1 @@
+http://lua-users.org/wiki/LuaLogo