public
Rubygem
Fork of lsegal/yard
Description: Official repository for YARD: Yay! A Ruby Documentation-tool.
Homepage: http://yard.soen.ca / IRC: #yard on irc.freenode.net
Clone URL: git://github.com/tmm1/yard.git
Fix recognition of markdown in readme's, move default :readme option out 
of CLI into FullDocGenerator and convert README to markdown.
lsegal (author)
Sat Jun 21 13:03:53 -0700 2008
commit  7910f847d576c68ad08e4aeb8d81dc97fe1c5e45
tree    a0369dc02785e36c3dd3e03447d83b0d790ccfb9
parent  476f224254c01797575696448186d444acbf303d
...
13
14
15
16
17
18
19
...
13
14
15
 
16
17
18
0
@@ -13,7 +13,6 @@ module YARD
0
           :format => :html,
0
           :template => :default,
0
           :serializer => YARD::Serializers::FileSystemSerializer.new,
0
- :readme => ['README', 'README.txt'],
0
           :verifier => lambda do |gen, obj|
0
             return false if gen.respond_to?(:visibility) && !visibilities.include?(gen.visibility)
0
           end
...
2
3
4
 
5
6
7
...
16
17
18
 
 
 
 
19
20
21
...
58
59
60
61
 
62
63
64
...
2
3
4
5
6
7
8
...
17
18
19
20
21
22
23
24
25
26
...
63
64
65
 
66
67
68
69
0
@@ -2,6 +2,7 @@ module YARD
0
   module Generators
0
     class FullDocGenerator < Base
0
       before_generate :is_namespace?
0
+ before_list :setup_options
0
       before_list :generate_assets
0
       before_list :generate_index
0
       before_list :generate_readme
0
@@ -16,6 +17,10 @@ module YARD
0
       end
0
       
0
       protected
0
+
0
+ def setup_options
0
+ options[:readme] ||= Dir['{README,README.*}']
0
+ end
0
     
0
       def css_file; 'style.css' end
0
       def css_syntax_file; 'syntax_highlight.css' end
0
@@ -58,7 +63,7 @@ module YARD
0
       end
0
       
0
       def readme_markup
0
- if File.extname(readme_file) == /^\.(?:mdown|markdown|markdn|md)$/
0
+ if File.extname(readme_file) =~ /^\.(?:mdown|markdown|markdn|md)$/
0
           :markdown
0
         elsif File.extname(readme_file) == ".textile"
0
           :textile
...
24
25
26
27
 
28
29
30
31
32
33
34
 
35
36
37
...
40
41
42
43
44
45
46
 
 
 
 
47
48
49
...
24
25
26
 
27
28
29
30
31
32
33
 
34
35
36
37
...
40
41
42
 
 
 
43
44
45
46
47
48
49
50
0
@@ -24,14 +24,14 @@ module YARD
0
         case markup
0
         when :markdown
0
           begin
0
- BlueCloth.new(text).to_html
0
+ html = BlueCloth.new(text).to_html
0
           rescue NameError
0
             STDERR.puts "Missing BlueCloth gem for Markdown formatting. Install it with `gem install BlueCloth`"
0
             exit
0
           end
0
         when :textile
0
           begin
0
- RedCloth.new(text).to_html
0
+ html = RedCloth.new(text).to_html
0
           rescue NameError
0
             STDERR.puts "Missing RedCloth gem for Textile formatting. Install it with `gem install RedCloth`"
0
             exit
0
@@ -40,10 +40,11 @@ module YARD
0
           html = SimpleMarkup.convert(text, SimpleMarkupHtml)
0
           html = fix_dash_dash(html)
0
           html = fix_typewriter(html)
0
- html = resolve_links(html)
0
- html = html.gsub(/<pre>(.+?)<\/pre>/m) { '<pre class="code">' + html_syntax_highlight(CGI.unescapeHTML($1)) + '</pre>' }
0
- html
0
         end
0
+
0
+ html = resolve_links(html)
0
+ html = html.gsub(/<pre>(?:\s*<code>)?(.+?)(?:<\/code>\s*)?<\/pre>/m) { '<pre class="code">' + html_syntax_highlight(CGI.unescapeHTML($1)) + '</pre>' }
0
+ html
0
       end
0
       
0
       # @todo Refactor into own SimpleMarkup subclass
...
7
8
9
10
 
11
12
13
...
7
8
9
 
10
11
12
13
0
@@ -7,7 +7,7 @@ SPEC = Gem::Specification.new do |s|
0
   s.homepage = "http://yard.soen.ca"
0
   s.platform = Gem::Platform::RUBY
0
   s.summary = "Documentation tool for consistent and usable documentation in Ruby."
0
- s.files = Dir.glob("{bin,lib,spec,templates,benchmarks}/**/*") + ['LICENSE', 'README', 'Rakefile']
0
+ s.files = Dir.glob("{bin,lib,spec,templates,benchmarks}/**/*") + ['LICENSE', 'README.markdown', 'Rakefile']
0
   s.require_paths = ['lib']
0
   s.executables = [ 'yardoc', 'yri', 'yard-graph' ]
0
   s.has_rdoc = false

Comments

    No one has commented yet.