octopress-docs 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -26
- data/docs/_includes/nav.html +8 -0
- data/docs/_layouts/default.html +0 -3
- data/docs/_layouts/docs.html +7 -6
- data/docs/_layouts/docs_index.html +7 -0
- data/docs/index.html +7 -6
- data/lib/octopress-docs/command.rb +10 -6
- data/lib/octopress-docs/doc.rb +15 -2
- data/lib/octopress-docs/liquid_filters.rb +13 -0
- data/lib/octopress-docs/version.rb +1 -1
- data/lib/octopress-docs.rb +17 -2
- metadata +19 -3
- data/lib/octopress-docs/tag.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7d9c16f5a6ec8fa4a578e5d748d012a6f9a0d8e
|
4
|
+
data.tar.gz: 926e1271abaf66985a4b1ff241e8fc324409eff5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a2235e5295576bd5f95562cd90504409fff3f8588f8413b12a8a2423c2ab04f3bbbd994e8487e50d40f0129200020bfd534bc0ac3335395fe3714c900160b75
|
7
|
+
data.tar.gz: 6b2a03703eef7a4ce73629dc57ccd6cead78a00533b7d25853eafccfcc7185772839632f5453b43041f6668614d47550e701e61d14afc22310093a5d5e6ca955
|
data/README.md
CHANGED
@@ -1,35 +1,22 @@
|
|
1
1
|
# Octopress Docs
|
2
2
|
|
3
|
-
|
3
|
+
If you have the Octopress gem installed, run `$ octopress docs` from the root of your Jekyll site, and a website will mount at `http://localhost:4444` with documentation for Octopress and any plugins which support this feature.
|
4
4
|
|
5
|
-
##
|
5
|
+
## Adding docs to your plugin
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
gem 'octopress-docs'
|
10
|
-
|
11
|
-
And then execute:
|
12
|
-
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
Or install it yourself as:
|
16
|
-
|
17
|
-
$ gem install octopress-docs
|
18
|
-
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
Automatically add your Readme and Changelog files along with any pages in your gem path under `/assets/docs`.
|
7
|
+
Use the code below to automatically add your plugin's Readme, Changelog and any pages in your gem path under `assets/docs`.
|
8
|
+
If your plugin is built on Octopress Ink, these documentation pages are added automatically.
|
22
9
|
|
23
10
|
```ruby
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
11
|
+
require 'octopress-docs'
|
12
|
+
Octopress::Docs.add({
|
13
|
+
name: "Your Plugin",
|
14
|
+
description: "This plugin causes awesomeness",
|
15
|
+
dir: File.expand_path(File.join(File.dirname(__FILE__), "../../")),
|
16
|
+
slug: "your-plugin", # optional
|
17
|
+
source_url: "https://github.com/some/project", # optional
|
18
|
+
website: "http://example.com", # optional
|
19
|
+
})
|
33
20
|
```
|
34
21
|
|
35
22
|
## Contributing
|
data/docs/_layouts/default.html
CHANGED
data/docs/_layouts/docs.html
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
---
|
2
2
|
layout: default
|
3
3
|
---
|
4
|
+
{% include nav.html %}
|
4
5
|
|
5
6
|
{{ content }}
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
<
|
10
|
-
{% for doc in
|
11
|
-
<
|
8
|
+
{% assign doc_pages = plugin_docs[page.plugin.slug].docs %}
|
9
|
+
{% if doc_pages.size > 1 %}
|
10
|
+
<nav class='plugin-nav' role='navigation'>
|
11
|
+
{% for doc in doc_pages %}
|
12
|
+
<a href="{{ doc.url }}">{{ doc.title }}</a>
|
12
13
|
{% endfor %}
|
13
|
-
</ul>
|
14
14
|
</nav>
|
15
|
+
{% endif %}
|
data/docs/index.html
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
---
|
2
|
-
layout:
|
2
|
+
layout: docs_index
|
3
3
|
---
|
4
4
|
|
5
5
|
{% for plugin in plugin_docs %}
|
6
|
-
<
|
7
|
-
<
|
8
|
-
{%
|
9
|
-
|
10
|
-
{%
|
6
|
+
<ul class='plugin'>
|
7
|
+
<li>
|
8
|
+
<a href="/{{ plugin[1].url }}">{{ plugin[1].name }}</a>{% if plugin[1].description %} - {{ plugin[1].description }}{% endif %}
|
9
|
+
{% assign source = plugin[1].source_url %}
|
10
|
+
{% if source %} - {{ source | docs_source_url }}{% endif %}
|
11
|
+
</li>
|
11
12
|
</ul>
|
12
13
|
{% endfor %}
|
@@ -11,7 +11,6 @@ module Octopress
|
|
11
11
|
if ENV['OCTODEV']
|
12
12
|
c.option 'watch', '--watch', 'Watch docs site for changes and rebuild. (For docs development)'
|
13
13
|
end
|
14
|
-
c.option 'jekyll', '--jekyll', "Launch local server with docs for Jekyll v#{Jekyll::VERSION}"
|
15
14
|
|
16
15
|
c.action do |args, options|
|
17
16
|
serve_docs(options)
|
@@ -20,12 +19,17 @@ module Octopress
|
|
20
19
|
end
|
21
20
|
|
22
21
|
def self.serve_docs(options)
|
22
|
+
# Activate dependencies for serving docs.
|
23
|
+
require "octopress-escape-code"
|
24
|
+
require "octopress-hooks"
|
25
|
+
require "octopress-docs/page"
|
26
|
+
require "octopress-docs/doc"
|
27
|
+
require "octopress-docs/hooks"
|
28
|
+
require "octopress-docs/liquid_filters"
|
29
|
+
|
23
30
|
Octopress::Docs.docs_mode = true
|
24
|
-
|
25
|
-
|
26
|
-
else
|
27
|
-
options = init_octopress_docs(options)
|
28
|
-
end
|
31
|
+
options = init_octopress_docs(options)
|
32
|
+
options["port"] ||= '4444'
|
29
33
|
options["serving"] = true
|
30
34
|
options = Jekyll.configuration Jekyll::Utils.symbolize_hash_keys(options)
|
31
35
|
Jekyll::Commands::Build.process(options)
|
data/lib/octopress-docs/doc.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Octopress
|
2
2
|
module Docs
|
3
3
|
class Doc
|
4
|
-
attr_reader :filename, :plugin_name, :base_url
|
4
|
+
attr_reader :filename, :plugin_name, :base_url, :plugin_type, :description, :source_url
|
5
5
|
|
6
6
|
def initialize(options={})
|
7
7
|
@file = options[:file]
|
@@ -11,6 +11,8 @@ module Octopress
|
|
11
11
|
@plugin_slug = options[:slug]
|
12
12
|
@plugin_type = options[:type]
|
13
13
|
@base_url = options[:base_url]
|
14
|
+
@source_url = options[:source_url]
|
15
|
+
@description = options[:description]
|
14
16
|
@data = options[:data] || {}
|
15
17
|
end
|
16
18
|
|
@@ -41,10 +43,14 @@ module Octopress
|
|
41
43
|
@page.data['plugin'] = {
|
42
44
|
'name' => @plugin_name,
|
43
45
|
'slug' => plugin_slug,
|
44
|
-
'docs_base_url' => @base_url
|
46
|
+
'docs_base_url' => @base_url,
|
47
|
+
'source_url' => @source_url,
|
48
|
+
'description' => @description
|
45
49
|
}
|
50
|
+
|
46
51
|
@page.data['dir'] = doc_dir
|
47
52
|
@page.data = @data.merge(@page.data)
|
53
|
+
@page.data.merge!(comment_yaml(@page.content))
|
48
54
|
@page
|
49
55
|
end
|
50
56
|
|
@@ -70,6 +76,13 @@ module Octopress
|
|
70
76
|
File.join(@dir, page_dir, File.dirname(@file))
|
71
77
|
end
|
72
78
|
|
79
|
+
def comment_yaml(content)
|
80
|
+
if content =~ /<!-{3}\s+(.+)?-{3}>/m
|
81
|
+
SafeYAML.load($1)
|
82
|
+
else
|
83
|
+
{}
|
84
|
+
end
|
85
|
+
end
|
73
86
|
end
|
74
87
|
end
|
75
88
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# For plugin authors who need to generate urls pointing to ther doc pages.
|
2
|
+
module DocsFilters
|
3
|
+
def docs_source_url(input)
|
4
|
+
if input =~ /github.com/
|
5
|
+
label = "GitHub"
|
6
|
+
else
|
7
|
+
label = "source"
|
8
|
+
end
|
9
|
+
"<a href='#{input}'>#{label}</a>"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
Liquid::Template.register_filter(DocsFilters)
|
data/lib/octopress-docs.rb
CHANGED
@@ -8,7 +8,6 @@ require "octopress-docs/version"
|
|
8
8
|
require "octopress-docs/command"
|
9
9
|
require "octopress-docs/page"
|
10
10
|
require "octopress-docs/doc"
|
11
|
-
require "octopress-docs/tag"
|
12
11
|
require "octopress-docs/hooks"
|
13
12
|
|
14
13
|
module Octopress
|
@@ -52,10 +51,15 @@ module Octopress
|
|
52
51
|
docs.each { |slug, pages|
|
53
52
|
docs[slug] = {
|
54
53
|
"name" => pages.first.plugin_name,
|
55
|
-
"docs" => plugin_docs(pages)
|
54
|
+
"docs" => plugin_docs(pages),
|
55
|
+
"url" => pages.first.base_url,
|
56
|
+
"type" => pages.first.plugin_type,
|
57
|
+
"description" => pages.first.description,
|
58
|
+
"source_url" => pages.first.source_url
|
56
59
|
}
|
57
60
|
}
|
58
61
|
|
62
|
+
|
59
63
|
{ 'plugin_docs' => docs }
|
60
64
|
end
|
61
65
|
|
@@ -91,6 +95,8 @@ module Octopress
|
|
91
95
|
type: plugin.type,
|
92
96
|
base_url: plugin.docs_url,
|
93
97
|
dir: plugin.path,
|
98
|
+
source_url: plugin.source_url,
|
99
|
+
website: plugin.website,
|
94
100
|
docs_path: File.join(plugin.assets_path, 'docs'),
|
95
101
|
docs: %w{readme changelog}
|
96
102
|
}
|
@@ -187,3 +193,12 @@ module Octopress
|
|
187
193
|
end
|
188
194
|
end
|
189
195
|
end
|
196
|
+
|
197
|
+
# Add documentation for this plugin
|
198
|
+
|
199
|
+
Octopress::Docs.add({
|
200
|
+
name: "Octopress Docs",
|
201
|
+
description: "The fancy local documentation viewer.",
|
202
|
+
source_url: "https://github.com/octopress/docs",
|
203
|
+
dir: File.expand_path(File.join(File.dirname(__FILE__), "../"))
|
204
|
+
})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-docs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: octopress
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: pry-byebug
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,8 +120,10 @@ files:
|
|
106
120
|
- docs/Gemfile
|
107
121
|
- docs/Gemfile.lock
|
108
122
|
- docs/_config.yml
|
123
|
+
- docs/_includes/nav.html
|
109
124
|
- docs/_layouts/default.html
|
110
125
|
- docs/_layouts/docs.html
|
126
|
+
- docs/_layouts/docs_index.html
|
111
127
|
- docs/_sass/_solarized.scss
|
112
128
|
- docs/index.html
|
113
129
|
- docs/stylesheets/site.scss
|
@@ -115,8 +131,8 @@ files:
|
|
115
131
|
- lib/octopress-docs/command.rb
|
116
132
|
- lib/octopress-docs/doc.rb
|
117
133
|
- lib/octopress-docs/hooks.rb
|
134
|
+
- lib/octopress-docs/liquid_filters.rb
|
118
135
|
- lib/octopress-docs/page.rb
|
119
|
-
- lib/octopress-docs/tag.rb
|
120
136
|
- lib/octopress-docs/version.rb
|
121
137
|
homepage: https://github.com/octopress/docs
|
122
138
|
licenses:
|
data/lib/octopress-docs/tag.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# For plugin authors who need to generate urls pointing to ther doc pages.
|
2
|
-
|
3
|
-
module Octopress
|
4
|
-
module Docs
|
5
|
-
class DocUrlTag < Liquid::Tag
|
6
|
-
def initialize(tag_name, markup, tokens)
|
7
|
-
super
|
8
|
-
@url = markup.strip
|
9
|
-
end
|
10
|
-
|
11
|
-
def render(context)
|
12
|
-
'/' + File.join(context['page']['plugin']['docs_base_url'], @url)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
Liquid::Template.register_tag('doc_url', Octopress::Docs::DocUrlTag)
|