Skip to content

Commit 4a8b7be

Browse files
committed
Exclude TAGS files that may have been included in gems from parsing. Issue #81
1 parent cd8af04 commit 4a8b7be

File tree

4 files changed

+46
-3
lines changed

4 files changed

+46
-3
lines changed

History.rdoc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
=== 3.10 / ??
1+
=== 3.11 / 2011/10-17
2+
3+
* Bug fixes
4+
* Avoid parsing TAGS files included in gems. Issue #81 by Santiago
5+
Pastorino.
6+
7+
=== 3.10 / 2011-10-08
28

39
* Major enhancements
410
* RDoc HTML output has been improved:

TODO.rdoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ API changes to RDoc
3030
* Rename Context to Container
3131
* Rename NormalClass to Class
3232

33+
=== Crazy Ideas
34+
35+
* Auto-normalize heading levels to look OK. It's weird to see an <h1> in
36+
the middle of a method section.

lib/rdoc/rdoc.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,11 +402,16 @@ def parse_files files
402402
end
403403

404404
##
405-
# Removes file extensions known to be unparseable from +files+
405+
# Removes file extensions known to be unparseable from +files+ and TAGS
406+
# files for emacs and vim.
406407

407408
def remove_unparseable files
408409
files.reject do |file|
409-
file =~ /\.(?:class|eps|erb|scpt\.txt|ttf|yml)$/i
410+
file =~ /\.(?:class|eps|erb|scpt\.txt|ttf|yml)$/i or
411+
(file =~ /tags$/i and
412+
open(file, 'rb') { |io|
413+
io.read(100) =~ /\A(\f\n[^,]+,\d+$|!_TAG_)/
414+
})
410415
end
411416
end
412417

test/test_rdoc_rdoc.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,34 @@ def test_remove_unparseable
122122
assert_empty @rdoc.remove_unparseable file_list
123123
end
124124

125+
def test_remove_unparseable_tags_emacs
126+
temp_dir do
127+
open 'TAGS', 'w' do |io| # emacs
128+
io.write "\f\nlib/foo.rb,43\n"
129+
end
130+
131+
file_list = %w[
132+
TAGS
133+
]
134+
135+
assert_empty @rdoc.remove_unparseable file_list
136+
end
137+
end
138+
139+
def test_remove_unparseable_tags_vim
140+
temp_dir do
141+
open 'TAGS', 'w' do |io| # emacs
142+
io.write "!_TAG_"
143+
end
144+
145+
file_list = %w[
146+
TAGS
147+
]
148+
149+
assert_empty @rdoc.remove_unparseable file_list
150+
end
151+
end
152+
125153
def test_setup_output_dir
126154
Dir.mktmpdir {|d|
127155
path = File.join d, 'testdir'

0 commit comments

Comments
 (0)