Permalink
Browse files

Do not make TOC entries for directories inside _static. Fixes #24

  • Loading branch information...
1 parent 89c801c commit 63408b9c0aea46e85487dd6cc8b425bafb2feb8b @Phrogz committed Jun 25, 2012
View
5 CHANGES.md
@@ -1,3 +1,8 @@
+# 0.7.1 : 2012-June-25
+
+* Fixed bug where directories inside _static created TOC entries.
+ [Issue #24](https://github.com/Phrogz/docubot/issues/24)
+
# 0.7.0 : 2012-May-24
* Switched to using kramdown instead of BlueCloth for Markdown conversion
View
2 lib/docubot.rb
@@ -20,7 +20,7 @@ def self.win_path( path )
end
module DocuBot
- VERSION = '0.7.0'
+ VERSION = '0.7.1'
DIR = File.expand_path( File.dirname( __FILE__ ) )
TEMPLATE_DIR = DIR / 'docubot/templates'
View
4 lib/docubot/bundle.rb
@@ -32,8 +32,8 @@ def initialize( source_directory )
# All files in the _templates directory should be ignored
files_and_folders.reject!{ |f| f =~ /(?:^|\/)_/ }
- files_and_folders.concat Dir[ '_static/**/*' ]
- files_and_folders.concat Dir[ '_glossary/**/*' ]
+ files_and_folders.concat Dir[ '_static/**/*' ].reject{ |f| File.directory?(f) }
+ files_and_folders.concat Dir[ '_glossary/**/*' ].reject{ |f| File.directory?(f) }
@global.ignore.as_list.each do |glob|
files_and_folders = files_and_folders - Dir[glob]
View
25 spec/bundle.rb
@@ -219,6 +219,31 @@
end
end
+describe "Bundle with Skipped Files" do
+ before do
+ @out, @err = capture_io do
+ @bundle = DocuBot::Bundle.new( SAMPLES/'underscores' )
+ end
+ end
+
+ it "should not include files that start with an underscore" do
+ titles = @bundle.pages.map(&:title)
+ titles.wont_include "ignoreme"
+ titles.wont_include "andignoreme"
+ titles.wont_include " ignoreme"
+ titles.wont_include " andignoreme"
+ end
+
+ it "should not include folders inside _static" do
+ titles = @bundle.pages.map(&:title)
+ titles.wont_include "Foo"
+ titles.wont_include " Foo"
+ titles.wont_include "Bar"
+ titles.wont_include " Bar"
+ end
+
+end
+
describe "Pages in bundles" do
before do
@titles = [ 'First One', 'Second One', 'Third One', 'Fourth One', 'Fifth One', '911' ]
View
1 spec/samples/underscores/Home.md
@@ -0,0 +1 @@
+_Hello_, **World!**
View
1 spec/samples/underscores/_ignoreme.md
@@ -0,0 +1 @@
+_Hello_, **World!**
View
1 spec/samples/underscores/subsection/_andignoreme.md
@@ -0,0 +1 @@
+_Hello_, **World!**

0 comments on commit 63408b9

Please sign in to comment.