lib/rack/blogengine/doc_parser.rb in rack-blogengine-0.1.1 vs lib/rack/blogengine/doc_parser.rb in rack-blogengine-0.1.2
- old
+ new
@@ -16,23 +16,35 @@
next if item == '.' or item == '..' or extension != "content"
getFileContents(item)
@html = fillFileContents(@layout)
- @document = {path: @path, html: @html}
+ @document = Document.new
+ @document.path = @path
+ @document.html = @html
+ @document.title = @title
+
documents << @document
end
- return documents
+ documents.each do |document|
+ document.exec_content_operator(documents, @target)
+ end
+
+ documentshashed = documents.map do |document|
+ document.to_hash
+ end
+
+ return documentshashed
end
# Get File Contents (path, title, content)
# @param file
def self.getFileContents(file)
- # do work on real items
content_file = ::File.open("#{@target}/#{file}");
content = content_file.read
+ # Replace Closing tags
content["/path"] = "/close"
content["/title"] = "/close"
content["/content"] = "/close"
contentarray = content.split("[/close]")
\ No newline at end of file