double_doc 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/Guardfile +3 -0
- data/Rakefile +29 -0
- data/doc/license.md +9 -0
- data/doc/readme.md +72 -0
- data/doc/todo.md +2 -0
- data/double_doc.gemspec +27 -0
- data/lib/double_doc/doc_extractor.rb +36 -0
- data/lib/double_doc/html_generator.rb +102 -0
- data/lib/double_doc/html_renderer.rb +37 -0
- data/lib/double_doc/import_handler.rb +52 -0
- data/lib/double_doc/task.rb +41 -0
- data/lib/double_doc/version.rb +4 -0
- data/lib/double_doc.rb +5 -0
- data/readme.md +79 -0
- data/templates/default.html.erb +39 -0
- data/templates/screen.css +362 -0
- metadata +119 -0
data/Gemfile
ADDED
data/Guardfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift 'lib'
|
4
|
+
|
5
|
+
require 'double_doc/task'
|
6
|
+
|
7
|
+
desc "Generate documentation"
|
8
|
+
DoubleDoc::Task.new(:doc,
|
9
|
+
:sources => 'doc/readme.md',
|
10
|
+
:md_destination => '.',
|
11
|
+
:html_destination => 'site',
|
12
|
+
:title => 'API Documentaion'
|
13
|
+
)
|
14
|
+
|
15
|
+
desc "Publish docs to github"
|
16
|
+
task :publish => :doc do
|
17
|
+
`git add doc`
|
18
|
+
`git add readme.md`
|
19
|
+
`git commit -m 'Updated documentation'`
|
20
|
+
`git push origin master`
|
21
|
+
`git checkout gh-pages`
|
22
|
+
`cp site/screen.css .`
|
23
|
+
`cp site/readme.html index.html`
|
24
|
+
`git commit -a -m 'Updated site'`
|
25
|
+
`git push origin gh-pages`
|
26
|
+
`git co master`
|
27
|
+
end
|
28
|
+
|
29
|
+
task :default => [:doc]
|
data/doc/license.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
#### The MIT License
|
2
|
+
|
3
|
+
Copyright © 2012 [Mick Staugaard](mailto:mick@staugaard.com)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS,” WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/doc/readme.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
@import lib/double_doc/version.rb
|
2
|
+
|
3
|
+
One of the challenges you face when writing public documention for code or APIs, is that you have to remember to update the documentation
|
4
|
+
when ever you change the API. The main reason why this is a problem is that very often the documentation lives very for from your code.
|
5
|
+
|
6
|
+
This is the problem DoubleDoc tries to solve.
|
7
|
+
|
8
|
+
DoubleDoc allows you to write the documentation right where your code is, and you can combine it all into a well structured document.
|
9
|
+
|
10
|
+
### Format
|
11
|
+
You write your documentation in markdown right in your source code files by double commenting it:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
class User < ActiveRecord::Base
|
15
|
+
|
16
|
+
## ```js
|
17
|
+
## {
|
18
|
+
## "id": 1,
|
19
|
+
## "name": "Mick Staugaard"
|
20
|
+
## }
|
21
|
+
## ```
|
22
|
+
def as_json
|
23
|
+
# this comment will not be included in the documentation
|
24
|
+
# as it only has a single # character
|
25
|
+
super(:only => [:id, :name])
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
class UsersController < ApplicationController
|
31
|
+
## ### Getting a User
|
32
|
+
## `GET /users/{id}.json`
|
33
|
+
##
|
34
|
+
## #### Format
|
35
|
+
## @@import app/models/user.rb
|
36
|
+
def show
|
37
|
+
render :json => User.find(params[:id])
|
38
|
+
end
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
You would then write a markdown document about your User API:
|
43
|
+
|
44
|
+
## Users
|
45
|
+
You can acces users in our system by using our REST API, blah blah blah...
|
46
|
+
|
47
|
+
@@import app/controllers/users_controller.rb
|
48
|
+
|
49
|
+
And DoubleDoc will generate this markdown document for you:
|
50
|
+
|
51
|
+
## Users
|
52
|
+
You can acces users in our system by using our REST API, blah blah blah...
|
53
|
+
|
54
|
+
### Getting a User
|
55
|
+
`GET /users/{id}.json`
|
56
|
+
|
57
|
+
#### Format
|
58
|
+
```js
|
59
|
+
{
|
60
|
+
"id": 1,
|
61
|
+
"name": "Mick Staugaard"
|
62
|
+
}
|
63
|
+
```
|
64
|
+
|
65
|
+
### Rake Task
|
66
|
+
@import lib/double_doc/task.rb
|
67
|
+
|
68
|
+
### TODO
|
69
|
+
@import doc/todo.md
|
70
|
+
|
71
|
+
### License
|
72
|
+
@import doc/license.md
|
data/doc/todo.md
ADDED
data/double_doc.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "double_doc/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "double_doc"
|
7
|
+
s.version = DoubleDoc::VERSION
|
8
|
+
s.authors = ["Mick Staugaard"]
|
9
|
+
s.email = ["mick@staugaard.com"]
|
10
|
+
s.homepage = "http://staugaard.github.com/double_doc"
|
11
|
+
s.summary = "Documentation right where you want it"
|
12
|
+
s.description = "A simple framework for writing and generating beautiful documentation for your code"
|
13
|
+
|
14
|
+
s.rubyforge_project = "double_doc"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_development_dependency "guard"
|
22
|
+
s.add_development_dependency "guard-rake"
|
23
|
+
|
24
|
+
s.add_runtime_dependency "erubis"
|
25
|
+
s.add_runtime_dependency "redcarpet"
|
26
|
+
s.add_runtime_dependency "pygments.rb"
|
27
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module DoubleDoc
|
2
|
+
class DocExtractor
|
3
|
+
def self.extract(source)
|
4
|
+
case source
|
5
|
+
when String
|
6
|
+
extract_from_lines(source.split("\n"))
|
7
|
+
when File
|
8
|
+
extract_from_lines(source.readlines)
|
9
|
+
when Array
|
10
|
+
extract_from_lines(source)
|
11
|
+
else
|
12
|
+
raise "can't extract docs from #{source}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.extract_from_lines(lines)
|
17
|
+
doc = []
|
18
|
+
add_empty_line = false
|
19
|
+
lines.each do |line|
|
20
|
+
if match = line.match(/\s*##\s?(.*)$/)
|
21
|
+
if add_empty_line
|
22
|
+
doc << ''
|
23
|
+
add_empty_line = false
|
24
|
+
end
|
25
|
+
doc << match[1].rstrip
|
26
|
+
else
|
27
|
+
add_empty_line = true
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
return '' if doc.empty? || doc.all?(&:empty?)
|
32
|
+
|
33
|
+
return doc.join("\n")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'erubis'
|
2
|
+
require 'pathname'
|
3
|
+
require 'double_doc/html_renderer'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
module DoubleDoc
|
7
|
+
class HtmlGenerator
|
8
|
+
def initialize(sources, options)
|
9
|
+
@sources = sources
|
10
|
+
@template_file = options[:html_template] || File.expand_path("../../templates/default.html.erb", File.dirname(__FILE__))
|
11
|
+
@output_directory = Pathname.new(options[:html_destination])
|
12
|
+
@html_renderer = options[:html_renderer] || HtmlRenderer
|
13
|
+
@title = options[:title] || 'Documentation'
|
14
|
+
end
|
15
|
+
|
16
|
+
def generate
|
17
|
+
copy_assets
|
18
|
+
|
19
|
+
@sources.each do |src|
|
20
|
+
dst = @output_directory + File.basename(src).sub(/\.md$/, '.html')
|
21
|
+
puts "#{src} -> #{dst}"
|
22
|
+
FileUtils.mkdir_p(File.dirname(dst))
|
23
|
+
File.open(dst, 'w') do |out|
|
24
|
+
markdown = File.new(src).read
|
25
|
+
body = @html_renderer.render(markdown)
|
26
|
+
html = template.result(
|
27
|
+
:title => @title,
|
28
|
+
:body => body,
|
29
|
+
:highlight_css => @html_renderer.stylesheet,
|
30
|
+
:sitemap => sitemap
|
31
|
+
)
|
32
|
+
out.write(html)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def sitemap
|
38
|
+
return @sitemap unless @sitemap.nil?
|
39
|
+
|
40
|
+
@sitemap = []
|
41
|
+
|
42
|
+
@sources.each do |src|
|
43
|
+
path = File.basename(src).sub(/\.md$/, '.html')
|
44
|
+
lines = File.readlines(src)
|
45
|
+
|
46
|
+
item = nil
|
47
|
+
lines.each do |line|
|
48
|
+
if line =~ /^\#\#\s/
|
49
|
+
title = line.sub(/^\#+\s*/, '').strip
|
50
|
+
@sitemap << item if item
|
51
|
+
item = SitemapItem.new(title, path)
|
52
|
+
elsif line =~ /^\#\#\#\s/
|
53
|
+
item ||= SitemapItem.new(path, path)
|
54
|
+
title = line.sub(/^\#+\s*/, '').strip
|
55
|
+
item.add_child(SitemapItem.new(title, path, DoubleDoc::HtmlRenderer.generate_id(title)))
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
@sitemap << item if item
|
60
|
+
end
|
61
|
+
|
62
|
+
@sitemap
|
63
|
+
end
|
64
|
+
|
65
|
+
def copy_assets
|
66
|
+
if @html_renderer == HtmlRenderer
|
67
|
+
FileUtils.cp(File.expand_path("../../templates/screen.css", File.dirname(__FILE__)), @output_directory)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def template
|
72
|
+
@template ||= Erubis::Eruby.new(File.read(@template_file))
|
73
|
+
end
|
74
|
+
|
75
|
+
class SitemapItem
|
76
|
+
attr_reader :title, :path, :id, :children
|
77
|
+
attr_accessor :parent
|
78
|
+
|
79
|
+
def initialize(title, path, id = nil)
|
80
|
+
@title = title
|
81
|
+
@path = path
|
82
|
+
@id = id
|
83
|
+
@children = []
|
84
|
+
end
|
85
|
+
|
86
|
+
def add_child(child)
|
87
|
+
child.parent = self
|
88
|
+
children << child
|
89
|
+
child
|
90
|
+
end
|
91
|
+
|
92
|
+
def href
|
93
|
+
if id
|
94
|
+
"#{path}##{id}"
|
95
|
+
else
|
96
|
+
path
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'redcarpet'
|
2
|
+
require 'pygments'
|
3
|
+
|
4
|
+
module DoubleDoc
|
5
|
+
class HtmlRenderer
|
6
|
+
|
7
|
+
def self.render(text)
|
8
|
+
markdown = Redcarpet::Markdown.new(RedcarpetRenderer, :fenced_code_blocks => true)
|
9
|
+
markdown.render(text)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.generate_id(text)
|
13
|
+
text.strip.downcase.gsub(/\s+/, '-')
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.stylesheet
|
17
|
+
Pygments.css('.highlight')
|
18
|
+
end
|
19
|
+
|
20
|
+
class RedcarpetRenderer < Redcarpet::Render::HTML
|
21
|
+
def header(text, level)
|
22
|
+
"<h#{level} id=\"#{DoubleDoc::HtmlRenderer.generate_id(text)}\">#{text}</h#{level}>"
|
23
|
+
end
|
24
|
+
|
25
|
+
def block_code(code, language)
|
26
|
+
if language
|
27
|
+
Pygments.highlight(code, :lexer => language)
|
28
|
+
else
|
29
|
+
"<pre>#{code}</pre>"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'double_doc/doc_extractor'
|
3
|
+
|
4
|
+
module DoubleDoc
|
5
|
+
class ImportHandler
|
6
|
+
def initialize(root)
|
7
|
+
@root = Pathname.new(root)
|
8
|
+
@docs = {}
|
9
|
+
end
|
10
|
+
|
11
|
+
def resolve_imports(source)
|
12
|
+
case source
|
13
|
+
when String
|
14
|
+
resolve_imports_from_lines(source.split("\n"))
|
15
|
+
when File
|
16
|
+
resolve_imports_from_lines(source.readlines)
|
17
|
+
when Array
|
18
|
+
resolve_imports_from_lines(source)
|
19
|
+
else
|
20
|
+
raise "can't extract docs from #{source}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
def resolve_imports_from_lines(lines)
|
27
|
+
doc = []
|
28
|
+
|
29
|
+
lines.each do |line|
|
30
|
+
if match = line.match(/(^|\s+)@import\s+([^\s]+)\s*$/)
|
31
|
+
doc << get_doc(match[2])
|
32
|
+
else
|
33
|
+
doc << line.gsub('@@import', '@import')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
doc.join()
|
38
|
+
end
|
39
|
+
|
40
|
+
def get_doc(path)
|
41
|
+
return @docs[path] if @docs[path]
|
42
|
+
|
43
|
+
file = File.new(@root + path)
|
44
|
+
|
45
|
+
if path =~ /\.md$/
|
46
|
+
@docs[path] = resolve_imports(file)
|
47
|
+
else
|
48
|
+
@docs[path] = resolve_imports(DocExtractor.extract(file))
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'double_doc/import_handler'
|
3
|
+
require 'double_doc/html_generator'
|
4
|
+
|
5
|
+
module DoubleDoc
|
6
|
+
|
7
|
+
## You can easly use DoubleDoc from Rake, and soon I'll tell you how...
|
8
|
+
class Task
|
9
|
+
include Rake::DSL if defined?(Rake::DSL)
|
10
|
+
|
11
|
+
def initialize(task_name, options)
|
12
|
+
md_dst = Pathname.new(options[:md_destination])
|
13
|
+
html_dst = Pathname.new(options[:html_destination]) if options[:html_destination]
|
14
|
+
sources = FileList[*options[:sources]]
|
15
|
+
import_handler = DoubleDoc::ImportHandler.new(options[:root] || Rake.original_dir)
|
16
|
+
|
17
|
+
destinations = [md_dst, html_dst].compact
|
18
|
+
destinations.each do |dst|
|
19
|
+
directory(dst.to_s)
|
20
|
+
end
|
21
|
+
|
22
|
+
task(task_name => destinations) do
|
23
|
+
|
24
|
+
sources.each do |src|
|
25
|
+
dst = md_dst + File.basename(src)
|
26
|
+
puts "#{src} -> #{dst}"
|
27
|
+
File.open(dst, 'w') do |out|
|
28
|
+
out.write(import_handler.resolve_imports(File.new(src)))
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
if html_dst
|
33
|
+
html_generator = DoubleDoc::HtmlGenerator.new(FileList[(md_dst + '*.md').to_s].sort, options)
|
34
|
+
html_generator.generate
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
data/lib/double_doc.rb
ADDED
data/readme.md
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
## DoubleDoc 1.0
|
2
|
+
One of the challenges you face when writing public documention for code or APIs, is that you have to remember to update the documentation
|
3
|
+
when ever you change the API. The main reason why this is a problem is that very often the documentation lives very for from your code.
|
4
|
+
|
5
|
+
This is the problem DoubleDoc tries to solve.
|
6
|
+
|
7
|
+
DoubleDoc allows you to write the documentation right where your code is, and you can combine it all into a well structured document.
|
8
|
+
|
9
|
+
### Format
|
10
|
+
You write your documentation in markdown right in your source code files by double commenting it:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
class User < ActiveRecord::Base
|
14
|
+
|
15
|
+
## ```js
|
16
|
+
## {
|
17
|
+
## "id": 1,
|
18
|
+
## "name": "Mick Staugaard"
|
19
|
+
## }
|
20
|
+
## ```
|
21
|
+
def as_json
|
22
|
+
# this comment will not be included in the documentation
|
23
|
+
# as it only has a single # character
|
24
|
+
super(:only => [:id, :name])
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
class UsersController < ApplicationController
|
30
|
+
## ### Getting a User
|
31
|
+
## `GET /users/{id}.json`
|
32
|
+
##
|
33
|
+
## #### Format
|
34
|
+
## @import app/models/user.rb
|
35
|
+
def show
|
36
|
+
render :json => User.find(params[:id])
|
37
|
+
end
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
You would then write a markdown document about your User API:
|
42
|
+
|
43
|
+
## Users
|
44
|
+
You can acces users in our system by using our REST API, blah blah blah...
|
45
|
+
|
46
|
+
@import app/controllers/users_controller.rb
|
47
|
+
|
48
|
+
And DoubleDoc will generate this markdown document for you:
|
49
|
+
|
50
|
+
## Users
|
51
|
+
You can acces users in our system by using our REST API, blah blah blah...
|
52
|
+
|
53
|
+
### Getting a User
|
54
|
+
`GET /users/{id}.json`
|
55
|
+
|
56
|
+
#### Format
|
57
|
+
```js
|
58
|
+
{
|
59
|
+
"id": 1,
|
60
|
+
"name": "Mick Staugaard"
|
61
|
+
}
|
62
|
+
```
|
63
|
+
|
64
|
+
### Rake Task
|
65
|
+
You can easly use DoubleDoc from Rake, and soon I'll tell you how...
|
66
|
+
### TODO
|
67
|
+
* Tests
|
68
|
+
* Support for directory structures
|
69
|
+
|
70
|
+
### License
|
71
|
+
#### The MIT License
|
72
|
+
|
73
|
+
Copyright © 2012 [Mick Staugaard](mailto:mick@staugaard.com)
|
74
|
+
|
75
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
76
|
+
|
77
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
78
|
+
|
79
|
+
THE SOFTWARE IS PROVIDED “AS IS,” WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7
|
+
<title><%= title %></title>
|
8
|
+
<link href="http://fonts.googleapis.com/css?family=Droid+Sans+Mono" rel="stylesheet" type="text/css">
|
9
|
+
<link rel="stylesheet" href="screen.css">
|
10
|
+
<style type="text/css">
|
11
|
+
<%= highlight_css %>
|
12
|
+
</style>
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
<div id="nav">
|
16
|
+
<div id="header">
|
17
|
+
<a href="#" id="logo"><%= title %></a>
|
18
|
+
</div>
|
19
|
+
<ul id="sections">
|
20
|
+
<% sitemap.each do |item| %>
|
21
|
+
<li>
|
22
|
+
<a class="source" href="<%= item.href %>"><%= item.title %></a>
|
23
|
+
<% if item.children.any? %>
|
24
|
+
<ul>
|
25
|
+
<% item.children.each do |child| %>
|
26
|
+
<li><a href="<%= child.href %>"><%= child.title %></a></li>
|
27
|
+
<% end %>
|
28
|
+
</ul>
|
29
|
+
<% end %>
|
30
|
+
</li>
|
31
|
+
<% end %>
|
32
|
+
|
33
|
+
</ul>
|
34
|
+
</div>
|
35
|
+
<div id="content">
|
36
|
+
<%= body %>
|
37
|
+
</div>
|
38
|
+
</body>
|
39
|
+
</html>
|
@@ -0,0 +1,362 @@
|
|
1
|
+
html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,code,del,dfn,em,img,q,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td {
|
2
|
+
margin: 0;
|
3
|
+
padding: 0;
|
4
|
+
border: 0;
|
5
|
+
font-weight: inherit;
|
6
|
+
font-style: inherit;
|
7
|
+
font-size: 100%;
|
8
|
+
font-family: inherit;
|
9
|
+
vertical-align: baseline
|
10
|
+
|
11
|
+
}
|
12
|
+
|
13
|
+
table {
|
14
|
+
border-collapse: separate;
|
15
|
+
border-spacing:0
|
16
|
+
}
|
17
|
+
|
18
|
+
caption, th, td {
|
19
|
+
text-align: left;
|
20
|
+
font-weight: normal
|
21
|
+
}
|
22
|
+
|
23
|
+
table, td, th {
|
24
|
+
vertical-align: middle;
|
25
|
+
}
|
26
|
+
|
27
|
+
blockquote:before, blockquote:after, q:before, q:after {
|
28
|
+
content: "";
|
29
|
+
}
|
30
|
+
|
31
|
+
blockquote, q {
|
32
|
+
quotes: "" "";
|
33
|
+
}
|
34
|
+
|
35
|
+
a img {
|
36
|
+
border: none;
|
37
|
+
}
|
38
|
+
|
39
|
+
body {
|
40
|
+
margin: 10px;
|
41
|
+
}
|
42
|
+
|
43
|
+
html {
|
44
|
+
height: 100%;
|
45
|
+
}
|
46
|
+
|
47
|
+
body {
|
48
|
+
padding: 0;
|
49
|
+
margin: 0;
|
50
|
+
font: 18px/1.4em "Minion Pro",Times,"Times New Roman",serif;
|
51
|
+
font-size-adjust: none;
|
52
|
+
font-style: normal;
|
53
|
+
font-variant: normal;
|
54
|
+
font-weight: normal;
|
55
|
+
}
|
56
|
+
|
57
|
+
h1, h2, h3, h4,#header,#nav,#loader {
|
58
|
+
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
|
59
|
+
}
|
60
|
+
|
61
|
+
a {
|
62
|
+
color: #369;
|
63
|
+
}
|
64
|
+
|
65
|
+
#header {
|
66
|
+
border-bottom: 1px solid #ccc;
|
67
|
+
}
|
68
|
+
|
69
|
+
#header #logo {
|
70
|
+
color: #333;
|
71
|
+
font-size: 18px;
|
72
|
+
font-weight: bold;
|
73
|
+
padding: 10px 15px;
|
74
|
+
line-height: 1.2em;
|
75
|
+
text-decoration: none;
|
76
|
+
}
|
77
|
+
|
78
|
+
#nav {
|
79
|
+
position: fixed;
|
80
|
+
top: 0;
|
81
|
+
left: 0;
|
82
|
+
width: 250px;
|
83
|
+
height: 100%;
|
84
|
+
background: #f9f9f9;
|
85
|
+
background: rgba(0,0,0,0.10);
|
86
|
+
border-right: 1px solid rgba(0,0,0,0.20);
|
87
|
+
-webkit-box-shadow: rgba(0,0,0,0.10) -1px 0 3px 0 inset;
|
88
|
+
-moz-box-shadow: rgba(0,0,0,0.10) -1px 0 3px 0 inset;
|
89
|
+
box-shadow: rgba(0,0,0,0.10) -1px 0 3px 0 inset;
|
90
|
+
text-shadow: rgba(255,255,255,0.70) 0 1px 0;
|
91
|
+
overflow-x: hidden;
|
92
|
+
overflow-y: auto;
|
93
|
+
}
|
94
|
+
|
95
|
+
#nav a {
|
96
|
+
display: block;
|
97
|
+
font-weight: bold;
|
98
|
+
text-decoration: none
|
99
|
+
}
|
100
|
+
|
101
|
+
#nav #sections {
|
102
|
+
margin-bottom: 5px;
|
103
|
+
border-bottom: 1px solid #ccc;
|
104
|
+
background: #f1f1f1;
|
105
|
+
-webkit-box-shadow: rgba(0,0,0,0.15) 0 0 5px;
|
106
|
+
-moz-box-shadow: rgba(0,0,0,0.15) 0 0 5px;
|
107
|
+
box-shadow: rgba(0,0,0,0.15) 0 0 5px;
|
108
|
+
}
|
109
|
+
|
110
|
+
#nav #sections > li {
|
111
|
+
border-bottom: 1px solid rgba(0,0,0,0.05);
|
112
|
+
border-top: 1px solid rgba(255,255,255,0.50);
|
113
|
+
}
|
114
|
+
|
115
|
+
#nav #sections > li > a {
|
116
|
+
padding: 5px 15px;
|
117
|
+
color: #555;
|
118
|
+
font-size: 14px;
|
119
|
+
}
|
120
|
+
|
121
|
+
#nav #sections > li > a:hover {
|
122
|
+
background: #ddd;
|
123
|
+
background: rgba(0,0,0,0.05);
|
124
|
+
}
|
125
|
+
|
126
|
+
#nav #sections > li:last-child {
|
127
|
+
border-bottom: 1px solid rgba(255,255,255,0.50);
|
128
|
+
}
|
129
|
+
|
130
|
+
#nav #sections ul {
|
131
|
+
margin-bottom: 6px;
|
132
|
+
}
|
133
|
+
|
134
|
+
#nav #sections ul li a {
|
135
|
+
padding: 1px 25px;
|
136
|
+
font-size: 13px;
|
137
|
+
}
|
138
|
+
|
139
|
+
#nav #sections ul li a:hover {
|
140
|
+
background: #ddd;
|
141
|
+
background: rgba(0,0,0,0.05);
|
142
|
+
}
|
143
|
+
|
144
|
+
#nav .extra{
|
145
|
+
padding: 5px 15px;
|
146
|
+
min-height: 1.4em;
|
147
|
+
}
|
148
|
+
|
149
|
+
#nav .extra a {
|
150
|
+
color: #555;
|
151
|
+
font-size: 14px;
|
152
|
+
}
|
153
|
+
|
154
|
+
#content {
|
155
|
+
margin: 0 40px 0 290px;
|
156
|
+
padding: 20px 0;
|
157
|
+
min-height: 100px;
|
158
|
+
max-width: 688px;
|
159
|
+
}
|
160
|
+
|
161
|
+
#content p {
|
162
|
+
padding: 0 0 .8125em 0;
|
163
|
+
color: #111;
|
164
|
+
font-weight: 300;
|
165
|
+
zoom: 1;
|
166
|
+
}
|
167
|
+
|
168
|
+
#content p:before, #content p:after {
|
169
|
+
content: "";
|
170
|
+
display: table;
|
171
|
+
}
|
172
|
+
|
173
|
+
#content p:after {
|
174
|
+
clear: both;
|
175
|
+
}
|
176
|
+
|
177
|
+
#content p img {
|
178
|
+
float: left;
|
179
|
+
margin: .5em .8125em .8125em 0;
|
180
|
+
padding: 0;
|
181
|
+
}
|
182
|
+
|
183
|
+
#content img {
|
184
|
+
max-width: 100%;
|
185
|
+
}
|
186
|
+
|
187
|
+
#content h1, #content h2, #content h3, #content h4, #content h5, #content h6 {
|
188
|
+
font-weight: normal;
|
189
|
+
color: #333;
|
190
|
+
line-height: 1.2em;
|
191
|
+
}
|
192
|
+
|
193
|
+
#content h1 {
|
194
|
+
font-size: 2.125em;
|
195
|
+
margin-bottom: .765em;
|
196
|
+
}
|
197
|
+
|
198
|
+
#content h2 {
|
199
|
+
font-size: 1.7em;
|
200
|
+
margin: .855em 0;
|
201
|
+
}
|
202
|
+
|
203
|
+
#content h3 {
|
204
|
+
font-size: 1.3em;
|
205
|
+
margin: .956em 0;
|
206
|
+
}
|
207
|
+
|
208
|
+
#content h4 {
|
209
|
+
font-size: 1.1em;
|
210
|
+
margin: 1.161em 0;
|
211
|
+
}
|
212
|
+
|
213
|
+
#content h5, #content h6 {
|
214
|
+
font-size: 1em;
|
215
|
+
font-weight: bold;
|
216
|
+
margin: 1.238em 0;
|
217
|
+
}
|
218
|
+
|
219
|
+
#content ul {
|
220
|
+
list-style-position: outside;
|
221
|
+
}
|
222
|
+
|
223
|
+
#content li ul, #content li ol {
|
224
|
+
margin: 0 1.625em;
|
225
|
+
}
|
226
|
+
|
227
|
+
#content ul, #content ol {
|
228
|
+
margin: 0 0 1.625em 1em;
|
229
|
+
}
|
230
|
+
|
231
|
+
#content dl {
|
232
|
+
margin: 0 0 1.625em 0;
|
233
|
+
}
|
234
|
+
|
235
|
+
#content dl dt {
|
236
|
+
font-weight: bold;
|
237
|
+
}
|
238
|
+
|
239
|
+
#content dl dd {
|
240
|
+
margin-left: 1.625em;
|
241
|
+
}
|
242
|
+
|
243
|
+
#content a {
|
244
|
+
text-decoration: none;
|
245
|
+
}
|
246
|
+
|
247
|
+
#content a:hover {
|
248
|
+
text-decoration: underline;
|
249
|
+
}
|
250
|
+
|
251
|
+
#content table {
|
252
|
+
margin-bottom: 1.625em;
|
253
|
+
border-collapse: collapse;
|
254
|
+
}
|
255
|
+
|
256
|
+
#content th {
|
257
|
+
font-weight: bold;
|
258
|
+
}
|
259
|
+
|
260
|
+
#content tr, #content th, #content td {
|
261
|
+
margin: 0;
|
262
|
+
padding: 0 1.625em 0 1em;
|
263
|
+
height: 26px;
|
264
|
+
}
|
265
|
+
|
266
|
+
#content tfoot {
|
267
|
+
font-style: italic;
|
268
|
+
}
|
269
|
+
|
270
|
+
#content caption {
|
271
|
+
text-align: center;
|
272
|
+
font-family: Georgia, serif;
|
273
|
+
}
|
274
|
+
|
275
|
+
#content abbr, #content acronym {
|
276
|
+
border-bottom: 1px dotted #000;
|
277
|
+
}
|
278
|
+
|
279
|
+
#content address {
|
280
|
+
margin-top: 1.625em;
|
281
|
+
font-style: italic;
|
282
|
+
}
|
283
|
+
|
284
|
+
#content del {
|
285
|
+
color: #000;
|
286
|
+
}
|
287
|
+
|
288
|
+
#content blockquote {
|
289
|
+
padding: 1em 1em 1.625em 1em;
|
290
|
+
font-family: georgia, serif;
|
291
|
+
font-style: italic;
|
292
|
+
}
|
293
|
+
|
294
|
+
#content blockquote:before {
|
295
|
+
content: "\201C";
|
296
|
+
font-size: 3em;
|
297
|
+
margin-left: -.625em;
|
298
|
+
font-family: georgia, serif;
|
299
|
+
color: #aaa;
|
300
|
+
line-height: 0;
|
301
|
+
}
|
302
|
+
|
303
|
+
#content blockquote > p {
|
304
|
+
padding: 0;
|
305
|
+
margin: 0;
|
306
|
+
}
|
307
|
+
|
308
|
+
#content strong {
|
309
|
+
font-weight: bold;
|
310
|
+
}
|
311
|
+
|
312
|
+
#content em, #content dfn {
|
313
|
+
font-style: italic;
|
314
|
+
}
|
315
|
+
|
316
|
+
#content dfn {
|
317
|
+
font-weight: bold;
|
318
|
+
}
|
319
|
+
|
320
|
+
#content pre, #content code {
|
321
|
+
margin: 0 0 1.625em;
|
322
|
+
white-space: pre;
|
323
|
+
}
|
324
|
+
|
325
|
+
#content pre, #content code, #content tt {
|
326
|
+
font: .7em "Droid Sans Mono", Monaco, monospace;
|
327
|
+
line-height: 1.5;
|
328
|
+
}
|
329
|
+
|
330
|
+
#content pre {
|
331
|
+
background: #f8f8ff;
|
332
|
+
padding: 1px 2px;
|
333
|
+
border: 1px solid #ddd;
|
334
|
+
word-wrap: break-word;
|
335
|
+
}
|
336
|
+
|
337
|
+
#content tt {
|
338
|
+
display: block;
|
339
|
+
margin: 1.625em 0;
|
340
|
+
}
|
341
|
+
|
342
|
+
#content hr {
|
343
|
+
margin-bottom: 1.625em;
|
344
|
+
}
|
345
|
+
|
346
|
+
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min--moz-device-pixel-ratio: 1.5), only screen and (min-device-pixel-ratio: 1.5), only screen and (max-width : 480px) {
|
347
|
+
#nav {
|
348
|
+
position: static;
|
349
|
+
width: 100%;
|
350
|
+
height: auto;
|
351
|
+
-webkit-box-shadow: none;
|
352
|
+
-moz-box-shadow: none;
|
353
|
+
box-shadow: none;
|
354
|
+
border-bottom: 1px solid #aaa;
|
355
|
+
}
|
356
|
+
|
357
|
+
#content {
|
358
|
+
margin: 0;
|
359
|
+
padding: 30px;
|
360
|
+
position: relative;
|
361
|
+
}
|
362
|
+
}
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: double_doc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Mick Staugaard
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-02-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: guard
|
16
|
+
requirement: &70354882327720 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70354882327720
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: guard-rake
|
27
|
+
requirement: &70354882327160 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70354882327160
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: erubis
|
38
|
+
requirement: &70354882326540 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70354882326540
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: redcarpet
|
49
|
+
requirement: &70354882325760 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70354882325760
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: pygments.rb
|
60
|
+
requirement: &70354882325200 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70354882325200
|
69
|
+
description: A simple framework for writing and generating beautiful documentation
|
70
|
+
for your code
|
71
|
+
email:
|
72
|
+
- mick@staugaard.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- Gemfile
|
79
|
+
- Guardfile
|
80
|
+
- Rakefile
|
81
|
+
- doc/license.md
|
82
|
+
- doc/readme.md
|
83
|
+
- doc/todo.md
|
84
|
+
- double_doc.gemspec
|
85
|
+
- lib/double_doc.rb
|
86
|
+
- lib/double_doc/doc_extractor.rb
|
87
|
+
- lib/double_doc/html_generator.rb
|
88
|
+
- lib/double_doc/html_renderer.rb
|
89
|
+
- lib/double_doc/import_handler.rb
|
90
|
+
- lib/double_doc/task.rb
|
91
|
+
- lib/double_doc/version.rb
|
92
|
+
- readme.md
|
93
|
+
- templates/default.html.erb
|
94
|
+
- templates/screen.css
|
95
|
+
homepage: http://staugaard.github.com/double_doc
|
96
|
+
licenses: []
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ! '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ! '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
requirements: []
|
114
|
+
rubyforge_project: double_doc
|
115
|
+
rubygems_version: 1.8.10
|
116
|
+
signing_key:
|
117
|
+
specification_version: 3
|
118
|
+
summary: Documentation right where you want it
|
119
|
+
test_files: []
|