Permalink
Browse files

Fixing bug with multiple file comment

The problem occurred when you were using more then one file comment in your sass document.  The root cause was the fact that the FileDocumentation's raw_documentation method was depending on Documentation's raw_documentation (through super).  Documentation's raw_documentation method is designed to cache it's response therefore causing all file comments looked identical to the first one.  Instead of making it so that it does not cache itself, I changed FileDocumentation's raw_documentation logic to not depend on super.
  • Loading branch information...
1 parent 47ca60b commit b2b8ffa0241d7720ef65cc7c0ac7d24c59daf6dd @richardaday richardaday committed Mar 2, 2009
Showing with 25 additions and 10 deletions.
  1. +7 −1 README.markdown
  2. +1 −1 lib/sass_doc/documentation.rb
  3. +17 −8 lib/sass_doc/file_documentation.rb
View
@@ -15,6 +15,9 @@ Parameters are documented with an `@parameter` declaration and the value of the
Example
-------
+ //**\\
+ This file handles how to handle the styles of tables.
+
//**
The odd row color for a table
!odd_row_color = red
@@ -43,6 +46,10 @@ Example
Example Output (Plain Text)
---------------------------
+ File: FileName
+ --------------
+ This file handles how to handle the styles of tables.
+
Mixin: +alternating-rows-and-columns(even_row_color, odd_row_color, dark_intersection[, header_color, footer_color])
--------------------------------------------------------------------------------------------------------------------
Sets background colors for a table so that rows and columns alternate and are shaded
@@ -63,7 +70,6 @@ Example Output (Plain Text)
-------------------------
The odd row color for a table
-
Variable: !even_row_color
--------------------------
The even row color for a table
@@ -16,7 +16,7 @@ def general_doc
protected
- def raw_documentation(comment = self.comment)
+ def raw_documentation
@raw_documentation ||= begin
unless comment && comment.value =~ /^\*\*+/
[]
@@ -14,14 +14,6 @@ def signature
name
end
- def raw_documentation
- raw_file_documentation = []
- @comments.each {|comment|
- raw_file_documentation += super(comment)
- }
- raw_file_documentation
- end
-
def to_plain_text
sig = signature
separator = "-" * (sig.length + 6)
@@ -35,5 +27,22 @@ def to_plain_text
end
lines.join("\n")
end
+
+protected
+
+ def raw_documentation
+ @raw_documentation ||= begin
+ raw_documentation = []
+ @comments.each {|comment|
+ unless comment && comment.value =~ /^\*\*+\\\\/
+ []
+ else
+ raw_documentation += raw_lines(comment, :first => true, :indent => -1)
+ end
+ }
+ raw_documentation
+ end
+ end
+
end
end

0 comments on commit b2b8ffa

Please sign in to comment.