lib/sprockets/preprocessor.rb in sstephenson-sprockets-0.1.1 vs lib/sprockets/preprocessor.rb in sstephenson-sprockets-0.3.0
- old
+ new
@@ -28,14 +28,32 @@
def require_from_source_line(source_line)
require pathname_from(source_line).source_file
end
def record_source_line(source_line)
- unless source_line.comment? && strip_comments?
- output_file.record(source_line)
+ skip_pdoc_comments(source_line) do
+ unless source_line.comment? && strip_comments?
+ output_file.record(source_line)
+ end
end
end
-
+
+ def skip_pdoc_comments(source_line)
+ yield unless strip_comments?
+
+ @commented ||= false
+
+ if source_line.begins_multiline_comment?
+ @commented = true
+ end
+
+ yield unless @commented
+
+ if source_line.closes_multiline_comment?
+ @commented = false
+ end
+ end
+
def strip_comments?
options[:strip_comments] != false
end
def pathname_from(source_line)