vocco 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitmodules +3 -0
- data/Gemfile.lock +42 -0
- data/LICENSE.txt +20 -0
- data/README +83 -0
- data/Rakefile +88 -0
- data/TODO +3 -0
- data/VERSION +1 -0
- data/bin/vocco +5 -0
- data/lib/vocco.rb +59 -0
- data/lib/vocco/cli.rb +22 -0
- data/lib/vocco/generator.rb +180 -0
- data/lib/vocco/generator/css.rb +50 -0
- data/lib/vocco/generator/source_file/html_template.rb +30 -0
- data/notes/README.md +9 -0
- data/template/css.sass +56 -0
- data/template/html.slim +27 -0
- data/vocco.gemspec +91 -0
- metadata +225 -0
data/.document
ADDED
data/.gitmodules
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (3.0.5)
|
5
|
+
git (1.2.5)
|
6
|
+
haml (3.0.25)
|
7
|
+
i18n (0.5.0)
|
8
|
+
jeweler (1.5.2)
|
9
|
+
bundler (~> 1.0.0)
|
10
|
+
git (>= 1.2.5)
|
11
|
+
rake
|
12
|
+
rake (0.8.7)
|
13
|
+
rdiscount (1.6.8)
|
14
|
+
shoulda (2.11.3)
|
15
|
+
slim (0.9.0)
|
16
|
+
temple (~> 0.1.7)
|
17
|
+
tilt (~> 1.2)
|
18
|
+
temple (0.1.7)
|
19
|
+
tilt (1.2.2)
|
20
|
+
trollop (1.16.2)
|
21
|
+
vocco (0.0.0)
|
22
|
+
tilt
|
23
|
+
trollop
|
24
|
+
why-hpricot
|
25
|
+
why-hpricot (0.7.229)
|
26
|
+
|
27
|
+
PLATFORMS
|
28
|
+
ruby
|
29
|
+
|
30
|
+
DEPENDENCIES
|
31
|
+
activesupport
|
32
|
+
bundler (~> 1.0.0)
|
33
|
+
haml
|
34
|
+
i18n
|
35
|
+
jeweler (~> 1.5.2)
|
36
|
+
rdiscount
|
37
|
+
shoulda
|
38
|
+
slim
|
39
|
+
tilt
|
40
|
+
trollop
|
41
|
+
vocco
|
42
|
+
why-hpricot
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Jostein Berre Eliassen
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
|
2
|
+
,---.
|
3
|
+
/__./| ,---. ,---.
|
4
|
+
,---.; ; | ' ,'\ ' ,'\
|
5
|
+
/___/ \ | | / / | ,---. ,---. / / |
|
6
|
+
\ ; \ ' |. ; ,. : / \ / \. ; ,. :
|
7
|
+
\ \ \: |' | |: : / / ' / / '' | |: :
|
8
|
+
; \ ' .' | .; :. ' / . ' / ' | .; :
|
9
|
+
\ \ '| : |' ; :__ ' ; :__| : |
|
10
|
+
\ ` ; \ \ / ' | '.'|' | '.'|\ \ /
|
11
|
+
: \ | `----' | : :| : : `----'
|
12
|
+
'---" \ \ / \ \ /
|
13
|
+
`----' `----'
|
14
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
15
|
+
Quick and dirty documentation using Vim
|
16
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
17
|
+
|
18
|
+
Vocco is a super patchy literate programming-style
|
19
|
+
documentation generator using Vim's :TOhtml feature.
|
20
|
+
It renders groups of files as syntax highlighted HTML,
|
21
|
+
using your everyday Vim settings.
|
22
|
+
|
23
|
+
Make sure you have gvim or macvim and a nice default
|
24
|
+
color scheme installed for optimum roi.
|
25
|
+
|
26
|
+
|
27
|
+
USAGE vocco [options]
|
28
|
+
|
29
|
+
writes html to the directory
|
30
|
+
given by --out, for all files
|
31
|
+
matching the --file globs.
|
32
|
+
|
33
|
+
OPTIONS --files '**/*.rb' README LICENCE
|
34
|
+
and
|
35
|
+
defaults --out ./docs
|
36
|
+
|
37
|
+
--notes ./notes
|
38
|
+
|
39
|
+
--name from gemspec, or use
|
40
|
+
current directory name.
|
41
|
+
|
42
|
+
--site from gemspec, or none
|
43
|
+
|
44
|
+
--vim macvim gvim vim
|
45
|
+
|
46
|
+
|
47
|
+
RUBYGEM $ gem install vocco
|
48
|
+
|
49
|
+
Vocco.run :out => './website'
|
50
|
+
|
51
|
+
|
52
|
+
NOTES Vocco can include notes for
|
53
|
+
each file.
|
54
|
+
|
55
|
+
Given
|
56
|
+
-- files 'tra/la/**/*.rb'
|
57
|
+
and that there is a file at
|
58
|
+
'tra/la/bup/fum.rb',
|
59
|
+
and that
|
60
|
+
-- notes='./notes'
|
61
|
+
|
62
|
+
Then you can put notes at
|
63
|
+
'notes/bup/fum.rb.md', or
|
64
|
+
'tra/la/bup/fum.md'
|
65
|
+
|
66
|
+
Instead of .md (markdown), you
|
67
|
+
can also use .textile and
|
68
|
+
.rdoc.
|
69
|
+
|
70
|
+
Bonus points for noticing that
|
71
|
+
the static part of the globs
|
72
|
+
are automagically trimmed off
|
73
|
+
the paths.
|
74
|
+
|
75
|
+
|
76
|
+
GREETS Docco: <http://jashkenas.github.com/docco/>
|
77
|
+
Rocco: <http://rtomayko.github.com/rocco/>
|
78
|
+
Shocco: <http://rtomayko.github.com/shocco/>
|
79
|
+
|
80
|
+
|
81
|
+
COPYING Copyright (c) 2011 Jostein Berre
|
82
|
+
Eliassen. Released under an MIT
|
83
|
+
license. See LICENSE.txt for info.
|
data/Rakefile
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
#require 'bundler'
|
4
|
+
#begin
|
5
|
+
# Bundler.setup(:default, :development)
|
6
|
+
#rescue Bundler::BundlerError => e
|
7
|
+
# $stderr.puts e.message
|
8
|
+
# $stderr.puts "Run `bundle install` to install missing gems"
|
9
|
+
# exit e.status_code
|
10
|
+
#end
|
11
|
+
require 'rake'
|
12
|
+
|
13
|
+
require 'jeweler'
|
14
|
+
Jeweler::Tasks.new do |gem|
|
15
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
16
|
+
gem.name = "vocco"
|
17
|
+
gem.homepage = "http://github.com/jbe/vocco"
|
18
|
+
gem.license = "MIT"
|
19
|
+
gem.summary = %Q{vocco is an extra super quick-and-dirty documentation generator based on Vim, written in Ruby.}
|
20
|
+
gem.description = %Q{vocco is an extra super quick-and-dirty documentation generator based on Vim, written in Ruby.}
|
21
|
+
gem.email = "post@jostein.be"
|
22
|
+
gem.authors = ["jbe"]
|
23
|
+
|
24
|
+
gem.add_runtime_dependency 'trollop'
|
25
|
+
gem.add_runtime_dependency 'why-hpricot'
|
26
|
+
gem.add_runtime_dependency 'tilt'
|
27
|
+
gem.add_runtime_dependency 'rdiscount'
|
28
|
+
|
29
|
+
gem.add_development_dependency 'shoulda'
|
30
|
+
gem.add_development_dependency 'jeweler'
|
31
|
+
gem.add_development_dependency 'tilt'
|
32
|
+
gem.add_development_dependency 'slim'
|
33
|
+
gem.add_development_dependency 'haml'
|
34
|
+
#gem.add_development_dependency 'i18n'
|
35
|
+
gem.add_development_dependency 'activesupport'
|
36
|
+
gem.add_development_dependency 'vocco'
|
37
|
+
end
|
38
|
+
Jeweler::RubygemsDotOrgTasks.new
|
39
|
+
|
40
|
+
|
41
|
+
def precompile(const_name, template)
|
42
|
+
|
43
|
+
require 'active_support/inflector'
|
44
|
+
String.send :include, ActiveSupport::Inflector
|
45
|
+
|
46
|
+
path = File.join('lib', const_name.underscore + '.rb')
|
47
|
+
|
48
|
+
generated = case template
|
49
|
+
when Tilt::SassTemplate then template.render
|
50
|
+
when Slim::Template then template.send(:precompiled_template, {})
|
51
|
+
else raise 'unsupported template'
|
52
|
+
end
|
53
|
+
|
54
|
+
heredoc_str = '__YOU_ARE_SPECIAL__'
|
55
|
+
opener = "#{const_name} = <<-'#{heredoc_str}'\n"
|
56
|
+
closer = "\n#{heredoc_str}\n"
|
57
|
+
|
58
|
+
File.open(path, 'w') do |file|
|
59
|
+
file.write opener + generated + closer
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
task :docs do
|
66
|
+
require 'vocco'
|
67
|
+
Vocco.run(
|
68
|
+
:out => 'website',
|
69
|
+
:files => %w{README LICENSE lib/**/*.rb}
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
namespace :build do
|
75
|
+
task :templates do
|
76
|
+
require 'tilt'
|
77
|
+
require 'slim'
|
78
|
+
precompile(
|
79
|
+
'Vocco::Generator::CSS',
|
80
|
+
Tilt.new('template/css.sass')
|
81
|
+
)
|
82
|
+
precompile(
|
83
|
+
'Vocco::Generator::SourceFile::HTML_TEMPLATE',
|
84
|
+
Tilt.new('template/html.slim', :auto_escape => false)
|
85
|
+
)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.1
|
data/bin/vocco
ADDED
data/lib/vocco.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require 'hpricot'
|
4
|
+
require 'tilt'
|
5
|
+
require 'tempfile'
|
6
|
+
|
7
|
+
|
8
|
+
module Vocco
|
9
|
+
|
10
|
+
require 'vocco/generator'
|
11
|
+
require 'vocco/cli'
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def name_fallback
|
15
|
+
gemspec(:name) || File.basename(Dir.pwd)
|
16
|
+
end
|
17
|
+
|
18
|
+
def site_fallback
|
19
|
+
gemspec(:homepage)
|
20
|
+
end
|
21
|
+
|
22
|
+
def gemspec(prop)
|
23
|
+
begin
|
24
|
+
require 'rubygems'
|
25
|
+
@gemspec ||= Gem::Specification.load(File.basename(Dir.pwd) + '.gemspec')
|
26
|
+
@gemspec.send prop
|
27
|
+
rescue
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def run(opts)
|
33
|
+
|
34
|
+
bad_opts = opts.keys - OPTIONS.map {|line| line[0] }
|
35
|
+
|
36
|
+
unless bad_opts.empty?
|
37
|
+
raise "Invalid options: #{bad_opts}"
|
38
|
+
end
|
39
|
+
|
40
|
+
0.upto(OPTIONS.size - 1) do |n|
|
41
|
+
opts[OPTIONS[n][0]] ||= OPTIONS[n][2]
|
42
|
+
end
|
43
|
+
|
44
|
+
Generator.new(opts).run
|
45
|
+
end
|
46
|
+
alias :run! :run
|
47
|
+
end
|
48
|
+
|
49
|
+
OPTIONS = [
|
50
|
+
[:files, "File match globs", %w{**/*.rb README LICENSE} ],
|
51
|
+
[:out, "Output directory", './docs' ],
|
52
|
+
[:notes, "Note directories", ['./notes'] ],
|
53
|
+
[:name, "Project name", name_fallback ],
|
54
|
+
[:site, "Project url", site_fallback ],
|
55
|
+
[:vim, "Vim command", %w{macvim gvim vim} ]
|
56
|
+
]
|
57
|
+
end
|
58
|
+
|
59
|
+
|
data/lib/vocco/cli.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Vocco::CLI
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def start
|
7
|
+
require 'trollop'
|
8
|
+
opts = Trollop::options do
|
9
|
+
|
10
|
+
banner "Usage: vocco [options]\n\nOptions:"
|
11
|
+
|
12
|
+
::Vocco::OPTIONS.each do |name, desc, default|
|
13
|
+
opt name, desc, :default => default
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
::Vocco::Generator.new(opts).run
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
@@ -0,0 +1,180 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
class Vocco::Generator
|
4
|
+
|
5
|
+
require 'vocco/generator/css'
|
6
|
+
|
7
|
+
attr_reader :globs, :notes, :out, :name, :site
|
8
|
+
|
9
|
+
def initialize(opts)
|
10
|
+
@globs = opts[:files].map {|path| path.sub(/\/$/, '') }
|
11
|
+
@out = opts[:out]
|
12
|
+
@notes = opts[:notes]
|
13
|
+
@name = opts[:name].capitalize
|
14
|
+
@site = opts[:site]
|
15
|
+
@vim = opts[:vim]
|
16
|
+
validate_out
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
run_vim; postprocess
|
21
|
+
end
|
22
|
+
alias :run! :run
|
23
|
+
|
24
|
+
def trimmed_globs
|
25
|
+
@trimmed_globs ||= @globs.map do |glob|
|
26
|
+
glob.gsub(/(^\.\/)|(\/$)/, '')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def scopes
|
31
|
+
@scopes ||= trimmed_globs.map do |glob|
|
32
|
+
tokens = glob.split('*')
|
33
|
+
tokens.size > 1 ? tokens.first : nil
|
34
|
+
end.compact
|
35
|
+
end
|
36
|
+
|
37
|
+
def glob_regex
|
38
|
+
@glob_regex ||= begin
|
39
|
+
str = scopes.map do |scope|
|
40
|
+
Regexp::escape(scope)
|
41
|
+
end.join('|')
|
42
|
+
/^(\.\/)?(#{str})(\/)?/
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def doc_regex
|
47
|
+
@doc_regex ||= begin
|
48
|
+
str = Regexp::escape(@out) + '/'
|
49
|
+
/^#{str}/
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def files
|
54
|
+
@files ||= @globs.map do |glob|
|
55
|
+
Dir[glob]
|
56
|
+
end.flatten.uniq.map do |path|
|
57
|
+
SourceFile.new(path, self)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def validate_out
|
64
|
+
unless File.directory?(@out)
|
65
|
+
raise "#{@out} is not a valid directory."
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def run_vim
|
70
|
+
script = Tempfile.new('vimdocco')
|
71
|
+
script.write(vimscript)
|
72
|
+
script.close
|
73
|
+
puts 'Running ' + vim_command + ':'
|
74
|
+
system "#{vim_command} -f -S #{script.path}"
|
75
|
+
script.delete
|
76
|
+
end
|
77
|
+
|
78
|
+
def vim_command
|
79
|
+
@vim_command ||= @vim.detect do |c|
|
80
|
+
`which #{c}`.chomp.strip != ''
|
81
|
+
end || abort("You must install one of #{@vim.inspect}.")
|
82
|
+
end
|
83
|
+
|
84
|
+
def vimscript
|
85
|
+
@vimscript ||= begin
|
86
|
+
s = "let html_no_pre = 1\n"
|
87
|
+
files.each do |file|
|
88
|
+
s << "view! #{file.file}\n"
|
89
|
+
s << "TOhtml\n"
|
90
|
+
s << "w! #{file.doc_path}\n"
|
91
|
+
end
|
92
|
+
s << ":qall!\n"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def postprocess
|
97
|
+
hpricotify_docs do |doc, file|
|
98
|
+
doc.at('style').after('<style type="text/css">' + CSS + '</style>')
|
99
|
+
doc.at('title').inner_html = name + ' : ' + file.basename
|
100
|
+
inner = doc.at('body').inner_html
|
101
|
+
doc.at('body').swap "<body><div class='code'>#{inner}</div></body>"
|
102
|
+
doc.at('.code').after file.render_template
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def hpricotify_docs
|
107
|
+
files.each do |file|
|
108
|
+
doc = File.open(file.doc_path) {|f| Hpricot(f) }
|
109
|
+
yield(doc, file)
|
110
|
+
File.open(file.doc_path, 'w') {|f| f.write(doc.to_html) }
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
class Vocco::Generator::SourceFile
|
116
|
+
require 'vocco/generator/source_file/html_template'
|
117
|
+
|
118
|
+
def initialize(file, generator)
|
119
|
+
@file = file
|
120
|
+
@gen = generator
|
121
|
+
end
|
122
|
+
|
123
|
+
attr_reader :file
|
124
|
+
|
125
|
+
def short_path
|
126
|
+
@short_path ||= @file.sub(@gen.glob_regex, '')
|
127
|
+
end
|
128
|
+
|
129
|
+
def short_dirname
|
130
|
+
File.dirname(short_path).sub(/^\.\//, '')
|
131
|
+
end
|
132
|
+
|
133
|
+
def dirname
|
134
|
+
File.dirname(@file)
|
135
|
+
end
|
136
|
+
|
137
|
+
def basename
|
138
|
+
File.basename(@file)
|
139
|
+
end
|
140
|
+
|
141
|
+
def doc_prefix
|
142
|
+
short_dirname == '.' ? '' : short_dirname.gsub('/', '-') + '-'
|
143
|
+
end
|
144
|
+
|
145
|
+
def doc_path
|
146
|
+
File.join(@gen.out, doc_prefix + basename + '.html')
|
147
|
+
end
|
148
|
+
|
149
|
+
def doc_link
|
150
|
+
'./' + doc_path.sub(@gen.doc_regex, '')
|
151
|
+
end
|
152
|
+
|
153
|
+
def notes
|
154
|
+
rendered = render_notes
|
155
|
+
rendered.any? ?
|
156
|
+
rendered.join("\n") : nil
|
157
|
+
end
|
158
|
+
|
159
|
+
def render_notes
|
160
|
+
Dir[note_glob].map do |path|
|
161
|
+
Tilt.new(path).render
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def note_glob
|
166
|
+
dirs = [dirname]
|
167
|
+
@gen.notes.each do |dir|
|
168
|
+
dirs << File.join(dir, short_dirname)
|
169
|
+
end
|
170
|
+
ext = '.{textile,md,mkd,markdowb,rdoc}'
|
171
|
+
dir_glob = '{' + dirs.join(',') + '}/'
|
172
|
+
dir_glob + basename + ext
|
173
|
+
end
|
174
|
+
|
175
|
+
class_eval <<-EOF, '(template)'
|
176
|
+
def render_template
|
177
|
+
#{HTML_TEMPLATE}
|
178
|
+
end
|
179
|
+
EOF
|
180
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
Vocco::Generator::CSS = <<-'__YOU_ARE_SPECIAL__'
|
2
|
+
body {
|
3
|
+
font-family: "Palatino Linotype", "Book Antiqua", Palatino, FreeSerif, serif;
|
4
|
+
font-size: 15px; }
|
5
|
+
|
6
|
+
html, body {
|
7
|
+
height: 100%; }
|
8
|
+
|
9
|
+
body {
|
10
|
+
padding: 1em; }
|
11
|
+
|
12
|
+
.code {
|
13
|
+
font-family: Menlo, Monaco, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace;
|
14
|
+
font-size: 16px;
|
15
|
+
padding: 1em;
|
16
|
+
width: 50%; }
|
17
|
+
|
18
|
+
.nav {
|
19
|
+
width: 40%;
|
20
|
+
position: fixed;
|
21
|
+
top: 0;
|
22
|
+
left: 55%;
|
23
|
+
height: 100%;
|
24
|
+
font-size: 15px;
|
25
|
+
line-height: 22px;
|
26
|
+
color: #252519; }
|
27
|
+
.nav .wrapper {
|
28
|
+
color: black;
|
29
|
+
height: 100%; }
|
30
|
+
.nav .wrapper .area {
|
31
|
+
background-color: #cccccc;
|
32
|
+
padding: 1em 1em 1em 1em;
|
33
|
+
border-bottom: 1px dashed #bbbbbb;
|
34
|
+
border-top: 1px dashed #666666; }
|
35
|
+
.nav .wrapper .area .autohide {
|
36
|
+
opacity: 0;
|
37
|
+
height: 0px;
|
38
|
+
-webkit-transition: all 0.2s linear;
|
39
|
+
overflow: auto; }
|
40
|
+
.nav .wrapper .area:hover .autohide {
|
41
|
+
height: 150px;
|
42
|
+
opacity: 1; }
|
43
|
+
.nav .wrapper .notes {
|
44
|
+
max-height: 40%;
|
45
|
+
overflow: auto; }
|
46
|
+
|
47
|
+
table th {
|
48
|
+
text-align: right; }
|
49
|
+
|
50
|
+
__YOU_ARE_SPECIAL__
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Vocco::Generator::SourceFile::HTML_TEMPLATE = <<-'__YOU_ARE_SPECIAL__'
|
2
|
+
_buf = [] ; _temple_pre_tags = /<pre|<textarea/ ; _buf << ("<div class=\"nav\"><div class=\"wrapper\"><div class=\"area\"><h3><strong>") ;
|
3
|
+
;
|
4
|
+
;
|
5
|
+
;
|
6
|
+
;
|
7
|
+
; if @gen.site ;
|
8
|
+
; _buf << ("<a href=\"#{@gen.site}\">#{@gen.name}"\
|
9
|
+
"</a>") ; else ;
|
10
|
+
; _buf << (@gen.name) ;
|
11
|
+
; end ; _buf << ("</strong><span>#{' : '}"\
|
12
|
+
"</span><span>#{basename}"\
|
13
|
+
""\
|
14
|
+
"</span></h3>") ; if @gen.files.size > 1 ;
|
15
|
+
; _buf << ("<p class=\"autohide\">") ;
|
16
|
+
; @gen.files.each do |file| ;
|
17
|
+
; _buf << ("#{file.short_dirname == '.' ? '' : file.short_dirname + '/'}"\
|
18
|
+
"<a href=\"#{file.doc_link}\">#{file.basename}"\
|
19
|
+
"</a><br>"\
|
20
|
+
""\
|
21
|
+
"") ; end ; _buf << ("</p>") ; end ; _buf << ("</div>") ; if notes ;
|
22
|
+
; _buf << ("<div class=\"notes area\">#{notes}"\
|
23
|
+
""\
|
24
|
+
"</div>") ; end ; _buf << ("<div class=\"area\"><table><tr><th>Generated:</th><td>"\
|
25
|
+
""\
|
26
|
+
""\
|
27
|
+
""\
|
28
|
+
"#{Time.now.to_s}"\
|
29
|
+
"</td></tr></table></div></div></div>") ; _buf = _buf.join
|
30
|
+
__YOU_ARE_SPECIAL__
|
data/notes/README.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
This webpage was generated by running Vocco on its own source code.
|
4
|
+
|
5
|
+
These paragraphs are actually "notes" attached to the README -- they were automatically generated and included from `./notes/README.md`. Notes can also be kept in the same directory as the source files, as long as their names correspond; like `app.rb.md` or `config.yml.textile`.
|
6
|
+
|
7
|
+
The supported note format extensions are: md, mkd, markdown, textile and rdoc.
|
8
|
+
|
9
|
+
Have a great day. ♥
|
data/template/css.sass
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
|
2
|
+
body
|
3
|
+
:font-family 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif
|
4
|
+
:font-size 15px
|
5
|
+
|
6
|
+
html, body
|
7
|
+
:height 100%
|
8
|
+
|
9
|
+
body
|
10
|
+
:padding 1em
|
11
|
+
|
12
|
+
.code
|
13
|
+
:font-family Menlo, Monaco, 'DejaVu Sans Mono', Consolas, "Lucida Console", monospace
|
14
|
+
:font-size 16px
|
15
|
+
:padding 1em
|
16
|
+
:width 50%
|
17
|
+
//:white-space normal
|
18
|
+
|
19
|
+
.nav
|
20
|
+
:width 40%
|
21
|
+
:position fixed
|
22
|
+
:top 0
|
23
|
+
:left 55%
|
24
|
+
:height 100%
|
25
|
+
|
26
|
+
font-size: 15px
|
27
|
+
line-height: 22px
|
28
|
+
color: #252519
|
29
|
+
|
30
|
+
|
31
|
+
.wrapper
|
32
|
+
:color black
|
33
|
+
:height 100%
|
34
|
+
.area
|
35
|
+
:background-color #ccc
|
36
|
+
:padding 1em 1em 1em 1em
|
37
|
+
:border-bottom 1px dashed #bbb
|
38
|
+
:border-top 1px dashed #666
|
39
|
+
.autohide
|
40
|
+
:opacity 0
|
41
|
+
:height 0px
|
42
|
+
:-webkit-transition all 0.2s linear
|
43
|
+
:overflow auto
|
44
|
+
&:hover .autohide
|
45
|
+
:height 150px
|
46
|
+
:opacity 1
|
47
|
+
.notes
|
48
|
+
:max-height 40%
|
49
|
+
:overflow auto
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
table th
|
56
|
+
:text-align right
|
data/template/html.slim
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
.nav
|
2
|
+
.wrapper
|
3
|
+
.area
|
4
|
+
h3
|
5
|
+
strong
|
6
|
+
- if @gen.site
|
7
|
+
a href=@gen.site = @gen.name
|
8
|
+
- else
|
9
|
+
= @gen.name
|
10
|
+
span = ' : '
|
11
|
+
span = basename
|
12
|
+
|
13
|
+
- if @gen.files.size > 1
|
14
|
+
p.autohide
|
15
|
+
- @gen.files.each do |file|
|
16
|
+
= file.short_dirname == '.' ? '' : file.short_dirname + '/'
|
17
|
+
a href="#{file.doc_link}" = file.basename
|
18
|
+
br
|
19
|
+
|
20
|
+
- if notes
|
21
|
+
.notes.area = notes
|
22
|
+
|
23
|
+
.area
|
24
|
+
table
|
25
|
+
tr
|
26
|
+
th Generated:
|
27
|
+
td = Time.now.to_s
|
data/vocco.gemspec
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{vocco}
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["jbe"]
|
12
|
+
s.date = %q{2011-03-02}
|
13
|
+
s.default_executable = %q{vocco}
|
14
|
+
s.description = %q{vocco is an extra super quick-and-dirty documentation generator based on Vim, written in Ruby.}
|
15
|
+
s.email = %q{post@jostein.be}
|
16
|
+
s.executables = ["vocco"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE.txt",
|
19
|
+
"README",
|
20
|
+
"TODO"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
".document",
|
24
|
+
".gitmodules",
|
25
|
+
"Gemfile.lock",
|
26
|
+
"LICENSE.txt",
|
27
|
+
"README",
|
28
|
+
"Rakefile",
|
29
|
+
"TODO",
|
30
|
+
"VERSION",
|
31
|
+
"bin/vocco",
|
32
|
+
"lib/vocco.rb",
|
33
|
+
"lib/vocco/cli.rb",
|
34
|
+
"lib/vocco/generator.rb",
|
35
|
+
"lib/vocco/generator/css.rb",
|
36
|
+
"lib/vocco/generator/source_file/html_template.rb",
|
37
|
+
"notes/README.md",
|
38
|
+
"template/css.sass",
|
39
|
+
"template/html.slim",
|
40
|
+
"vocco.gemspec"
|
41
|
+
]
|
42
|
+
s.homepage = %q{http://github.com/jbe/vocco}
|
43
|
+
s.licenses = ["MIT"]
|
44
|
+
s.require_paths = ["lib"]
|
45
|
+
s.rubygems_version = %q{1.3.7}
|
46
|
+
s.summary = %q{vocco is an extra super quick-and-dirty documentation generator based on Vim, written in Ruby.}
|
47
|
+
|
48
|
+
if s.respond_to? :specification_version then
|
49
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
50
|
+
s.specification_version = 3
|
51
|
+
|
52
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
53
|
+
s.add_runtime_dependency(%q<trollop>, [">= 0"])
|
54
|
+
s.add_runtime_dependency(%q<why-hpricot>, [">= 0"])
|
55
|
+
s.add_runtime_dependency(%q<tilt>, [">= 0"])
|
56
|
+
s.add_runtime_dependency(%q<rdiscount>, [">= 0"])
|
57
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
58
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
59
|
+
s.add_development_dependency(%q<tilt>, [">= 0"])
|
60
|
+
s.add_development_dependency(%q<slim>, [">= 0"])
|
61
|
+
s.add_development_dependency(%q<haml>, [">= 0"])
|
62
|
+
s.add_development_dependency(%q<activesupport>, [">= 0"])
|
63
|
+
s.add_development_dependency(%q<vocco>, [">= 0"])
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<trollop>, [">= 0"])
|
66
|
+
s.add_dependency(%q<why-hpricot>, [">= 0"])
|
67
|
+
s.add_dependency(%q<tilt>, [">= 0"])
|
68
|
+
s.add_dependency(%q<rdiscount>, [">= 0"])
|
69
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
70
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
71
|
+
s.add_dependency(%q<tilt>, [">= 0"])
|
72
|
+
s.add_dependency(%q<slim>, [">= 0"])
|
73
|
+
s.add_dependency(%q<haml>, [">= 0"])
|
74
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
75
|
+
s.add_dependency(%q<vocco>, [">= 0"])
|
76
|
+
end
|
77
|
+
else
|
78
|
+
s.add_dependency(%q<trollop>, [">= 0"])
|
79
|
+
s.add_dependency(%q<why-hpricot>, [">= 0"])
|
80
|
+
s.add_dependency(%q<tilt>, [">= 0"])
|
81
|
+
s.add_dependency(%q<rdiscount>, [">= 0"])
|
82
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
83
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
84
|
+
s.add_dependency(%q<tilt>, [">= 0"])
|
85
|
+
s.add_dependency(%q<slim>, [">= 0"])
|
86
|
+
s.add_dependency(%q<haml>, [">= 0"])
|
87
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
88
|
+
s.add_dependency(%q<vocco>, [">= 0"])
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
metadata
ADDED
@@ -0,0 +1,225 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vocco
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- jbe
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-03-02 00:00:00 +01:00
|
18
|
+
default_executable: vocco
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: trollop
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :runtime
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: why-hpricot
|
35
|
+
prerelease: false
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
version: "0"
|
44
|
+
type: :runtime
|
45
|
+
version_requirements: *id002
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: tilt
|
48
|
+
prerelease: false
|
49
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
segments:
|
55
|
+
- 0
|
56
|
+
version: "0"
|
57
|
+
type: :runtime
|
58
|
+
version_requirements: *id003
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: rdiscount
|
61
|
+
prerelease: false
|
62
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
segments:
|
68
|
+
- 0
|
69
|
+
version: "0"
|
70
|
+
type: :runtime
|
71
|
+
version_requirements: *id004
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: shoulda
|
74
|
+
prerelease: false
|
75
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
segments:
|
81
|
+
- 0
|
82
|
+
version: "0"
|
83
|
+
type: :development
|
84
|
+
version_requirements: *id005
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: jeweler
|
87
|
+
prerelease: false
|
88
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
version: "0"
|
96
|
+
type: :development
|
97
|
+
version_requirements: *id006
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: tilt
|
100
|
+
prerelease: false
|
101
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
version: "0"
|
109
|
+
type: :development
|
110
|
+
version_requirements: *id007
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: slim
|
113
|
+
prerelease: false
|
114
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
segments:
|
120
|
+
- 0
|
121
|
+
version: "0"
|
122
|
+
type: :development
|
123
|
+
version_requirements: *id008
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: haml
|
126
|
+
prerelease: false
|
127
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
segments:
|
133
|
+
- 0
|
134
|
+
version: "0"
|
135
|
+
type: :development
|
136
|
+
version_requirements: *id009
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: activesupport
|
139
|
+
prerelease: false
|
140
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
141
|
+
none: false
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
segments:
|
146
|
+
- 0
|
147
|
+
version: "0"
|
148
|
+
type: :development
|
149
|
+
version_requirements: *id010
|
150
|
+
- !ruby/object:Gem::Dependency
|
151
|
+
name: vocco
|
152
|
+
prerelease: false
|
153
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
154
|
+
none: false
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
segments:
|
159
|
+
- 0
|
160
|
+
version: "0"
|
161
|
+
type: :development
|
162
|
+
version_requirements: *id011
|
163
|
+
description: vocco is an extra super quick-and-dirty documentation generator based on Vim, written in Ruby.
|
164
|
+
email: post@jostein.be
|
165
|
+
executables:
|
166
|
+
- vocco
|
167
|
+
extensions: []
|
168
|
+
|
169
|
+
extra_rdoc_files:
|
170
|
+
- LICENSE.txt
|
171
|
+
- README
|
172
|
+
- TODO
|
173
|
+
files:
|
174
|
+
- .document
|
175
|
+
- .gitmodules
|
176
|
+
- Gemfile.lock
|
177
|
+
- LICENSE.txt
|
178
|
+
- README
|
179
|
+
- Rakefile
|
180
|
+
- TODO
|
181
|
+
- VERSION
|
182
|
+
- bin/vocco
|
183
|
+
- lib/vocco.rb
|
184
|
+
- lib/vocco/cli.rb
|
185
|
+
- lib/vocco/generator.rb
|
186
|
+
- lib/vocco/generator/css.rb
|
187
|
+
- lib/vocco/generator/source_file/html_template.rb
|
188
|
+
- notes/README.md
|
189
|
+
- template/css.sass
|
190
|
+
- template/html.slim
|
191
|
+
- vocco.gemspec
|
192
|
+
has_rdoc: true
|
193
|
+
homepage: http://github.com/jbe/vocco
|
194
|
+
licenses:
|
195
|
+
- MIT
|
196
|
+
post_install_message:
|
197
|
+
rdoc_options: []
|
198
|
+
|
199
|
+
require_paths:
|
200
|
+
- lib
|
201
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
202
|
+
none: false
|
203
|
+
requirements:
|
204
|
+
- - ">="
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
segments:
|
207
|
+
- 0
|
208
|
+
version: "0"
|
209
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
210
|
+
none: false
|
211
|
+
requirements:
|
212
|
+
- - ">="
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
segments:
|
215
|
+
- 0
|
216
|
+
version: "0"
|
217
|
+
requirements: []
|
218
|
+
|
219
|
+
rubyforge_project:
|
220
|
+
rubygems_version: 1.3.7
|
221
|
+
signing_key:
|
222
|
+
specification_version: 3
|
223
|
+
summary: vocco is an extra super quick-and-dirty documentation generator based on Vim, written in Ruby.
|
224
|
+
test_files: []
|
225
|
+
|