소스 검색

Add i3 documentation

Simon Legner 4 년 전
부모
커밋
489975da83

+ 4 - 0
assets/javascripts/news.json

@@ -1,4 +1,8 @@
 [
+  [
+    "2021-11-29",
+    "New documentation: <a href=\"/i3/\">i3</a>"
+  ],
   [
     "2021-06-09",
     "New documentation: <a href=\"/r/\">R</a>"

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

@@ -82,7 +82,12 @@ app.templates.aboutPage = -> """
 """
 
 credits = [
-  [ 'Angular.js',
+  [ 'i3',
+    '2009, Michael Stapelberg and contributors',
+    'BSD',
+    'https://raw.githubusercontent.com/i3/i3/next/LICENSE'
+  ], [
+    'Angular.js',
     '2010-2020 Google, Inc.',
     'CC BY 3.0',
     'https://creativecommons.org/licenses/by/3.0/'

+ 17 - 0
lib/docs/filters/i3/entries.rb

@@ -0,0 +1,17 @@
+module Docs
+  class I3
+    class EntriesFilter < Docs::EntriesFilter
+      def additional_entries
+        entries = []
+        type = nil
+        css('h2[id], h3[id]').each do |node|
+          if node.name == 'h2' && node['id']
+            type = node.content
+          end
+          entries << [node.content, node['id'], type]
+        end
+        entries
+      end
+    end
+  end
+end

+ 28 - 0
lib/docs/scrapers/i3.rb

@@ -0,0 +1,28 @@
+module Docs
+  class I3 < UrlScraper
+    self.name = 'i3'
+    self.type = 'simple'
+    self.slug = 'i3'
+    self.release = '4.20.1'
+    self.base_url = 'https://i3wm.org/docs/userguide.html'
+    self.links = {
+      home: 'https://i3wm.org/',
+      code: 'https://github.com/i3/i3'
+    }
+
+    html_filters.push 'i3/entries', 'title'
+
+    options[:container] = 'main'
+    options[:skip_links] = true
+
+    options[:attribution] = <<-HTML
+      &copy; 2009, Michael Stapelberg and contributors
+    HTML
+
+    def get_latest_version(opts)
+        tags = get_github_tags('i3', 'i3', opts)
+        tag = tags.find {|tag| tag['name'].start_with?('4.')}
+        tag['name']
+      end
+  end
+end

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


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


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

@@ -0,0 +1 @@
+https://github.com/i3/i3.github.io/blob/master/logo.png