[devdocsgjs/main: 30/239] Add i3 documentation




commit 489975da835e31492c3858a8d414d52facfa5ed8
Author: Simon Legner <Simon Legner gmail com>
Date:   Mon Nov 29 18:23:14 2021 +0100

    Add i3 documentation

 assets/javascripts/news.json                       |   4 +++
 .../javascripts/templates/pages/about_tmpl.coffee  |   7 +++++-
 lib/docs/filters/i3/entries.rb                     |  17 +++++++++++++
 lib/docs/scrapers/i3.rb                            |  28 +++++++++++++++++++++
 public/icons/docs/i3/16.png                        | Bin 0 -> 1203 bytes
 public/icons/docs/i3/16 2x png                     | Bin 0 -> 2162 bytes
 public/icons/docs/i3/SOURCE                        |   1 +
 7 files changed, 56 insertions(+), 1 deletion(-)
---
diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json
index cae61ade..d5b52149 100644
--- a/assets/javascripts/news.json
+++ b/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>"
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee 
b/assets/javascripts/templates/pages/about_tmpl.coffee
index c27816c5..14083f41 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/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/'
diff --git a/lib/docs/filters/i3/entries.rb b/lib/docs/filters/i3/entries.rb
new file mode 100644
index 00000000..0992fec0
--- /dev/null
+++ b/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
diff --git a/lib/docs/scrapers/i3.rb b/lib/docs/scrapers/i3.rb
new file mode 100644
index 00000000..abc4e791
--- /dev/null
+++ b/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
diff --git a/public/icons/docs/i3/16.png b/public/icons/docs/i3/16.png
new file mode 100644
index 00000000..d53f0127
Binary files /dev/null and b/public/icons/docs/i3/16.png differ
diff --git a/public/icons/docs/i3/16 2x png b/public/icons/docs/i3/16 2x png
new file mode 100644
index 00000000..afec0e90
Binary files /dev/null and b/public/icons/docs/i3/16 2x png differ
diff --git a/public/icons/docs/i3/SOURCE b/public/icons/docs/i3/SOURCE
new file mode 100644
index 00000000..7a8de2b5
--- /dev/null
+++ b/public/icons/docs/i3/SOURCE
@@ -0,0 +1 @@
+https://github.com/i3/i3.github.io/blob/master/logo.png


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]