History

Add i3 documentation

Simon Legner committed 4 years ago

Commit 489975d1 parent 38a65067 files · +54 −-1Browse files

Showing the changes to lib/docs (2 of 7 files). Show all

Unified · Split

2 files
  1. lib/docs/filters/i3/entries.rb +17 −0
  2. lib/docs/scrapers/i3.rb +28 −0
lib/docs/filters/i3/entries.rb+17−0
@@ -0,0 +1,17 @@
1module Docs
2 class I3
3 class EntriesFilter < Docs::EntriesFilter
4 def additional_entries
5 entries = []
6 type = nil
7 css('h2[id], h3[id]').each do |node|
8 if node.name == 'h2' && node['id']
9 type = node.content
10 end
11 entries << [node.content, node['id'], type]
12 end
13 entries
14 end
15 end
16 end
17end
lib/docs/scrapers/i3.rb+28−0
@@ -0,0 +1,28 @@
1module Docs
2 class I3 < UrlScraper
3 self.name = 'i3'
4 self.type = 'simple'
5 self.slug = 'i3'
6 self.release = '4.20.1'
7 self.base_url = 'https://i3wm.org/docs/userguide.html'
8 self.links = {
9 home: 'https://i3wm.org/',
10 code: 'https://github.com/i3/i3'
11 }
12
13 html_filters.push 'i3/entries', 'title'
14
15 options[:container] = 'main'
16 options[:skip_links] = true
17
18 options[:attribution] = <<-HTML
19 &copy; 2009, Michael Stapelberg and contributors
20 HTML
21
22 def get_latest_version(opts)
23 tags = get_github_tags('i3', 'i3', opts)
24 tag = tags.find {|tag| tag['name'].start_with?('4.')}
25 tag['name']
26 end
27 end
28end

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t