History

Move doc links to manifest

Thibaut committed 11 years ago

Commit b29d6ca1 parent 34e804d7 files · +50 −36Browse files

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

Unified · Split

3 files
  1. lib/docs/core/doc.rb +2 −1
  2. lib/docs/core/scraper.rb +2 −6
  3. lib/docs/filters/core/links.rb +0 −26
lib/docs/core/doc.rb+2−1
@@ -38,7 +38,8 @@ module Docs · 37 unmodified lines
38 type: type,38 type: type,
39 version: version,39 version: version,
40 index_path: index_path,40 index_path: index_path,
41 db_path: db_path }41 db_path: db_path,
42 links: links }
42 end43 end
43 44
44 def store_page(store, id)45 def store_page(store, id)
lib/docs/core/scraper.rb+2−6
@@ -34,7 +34,7 @@ module Docs · 33 unmodified lines
34 self.text_filters = FilterStack.new34 self.text_filters = FilterStack.new
35 35
36 html_filters.push 'container', 'clean_html', 'normalize_urls', 'internal_urls', 'normalize_paths'36 html_filters.push 'container', 'clean_html', 'normalize_urls', 'internal_urls', 'normalize_paths'
37 text_filters.push 'inner_html', 'clean_text', 'links', 'attribution'37 text_filters.push 'inner_html', 'clean_text', 'attribution'
38 38
39 def build_page(path)39 def build_page(path)
40 response = request_one url_for(path)40 response = request_one url_for(path)
@@ -65,10 +65,6 @@ module Docs · 24 unmodified lines
65 @root_url ||= root_path? ? URL.parse(File.join(base_url.to_s, root_path)) : base_url.normalize65 @root_url ||= root_path? ? URL.parse(File.join(base_url.to_s, root_path)) : base_url.normalize
66 end66 end
67 67
68 def links
69 self.class.links
70 end
71
72 def root_path68 def root_path
73 self.class.root_path69 self.class.root_path
74 end70 end
@@ -93,7 +89,7 @@ module Docs · 18 unmodified lines
93 89
94 def options90 def options
95 @options ||= self.class.options.deep_dup.tap do |options|91 @options ||= self.class.options.deep_dup.tap do |options|
96 options.merge! base_url: base_url, root_url: root_url, links: links,92 options.merge! base_url: base_url, root_url: root_url,
97 root_path: root_path, initial_paths: initial_paths93 root_path: root_path, initial_paths: initial_paths
98 94
99 if root_path?95 if root_path?
lib/docs/filters/core/links.rb+0−26
@@ -1,26 +0,0 @@
1module Docs
2 class LinksFilter < Filter
3 def call
4 html.prepend(links_html) if root_page? && links
5 html
6 end
7
8 NAMES = {
9 home: 'Homepage',
10 code: 'Source code'
11 }
12
13 def links_html
14 links = self.links.map do |name, link|
15 %(<li><a href="#{link}" class="_toc-link">#{NAMES[name]}</a></li>)
16 end
17
18 <<-HTML.strip_heredoc
19 <div class="_toc">
20 <div class="_toc-title">Resources</div>
21 <ul class="_toc-list">#{links.join}</ul>
22 </div>
23 HTML
24 end
25 end
26end

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