Michael Granger avatar Michael Granger committed fbc7cfa

Various bugfixes

Comments (0)

Files changed (4)

data/strelka-cms/apps/content-feeds

 
 # The Feed applet -- generate RSS and Atom feeds for various things.
 class Strelka::CMS::ContentFeeds < Strelka::App
-	extend Configurability,
+	extend Loggability,
+	       Configurability,
 	       Strelka::MethodUtilities
 	include UUIDTools
 
 
+	# Loggability API -- log to Strelka::CMS's logger
+	log_to :strelka_cms
+
 	# Configurability API -- configure this app with the 'feeds' section of the
 	# config.
 	config_key :content_feeds
     get 'rss' do |req|
 		feedpath = req.app_path[ %r{/rss/(.*)}, 1 ]
 		newest_pages = self.find_newest_pages( feedpath, req )
+		newest_page = newest_pages.first
 
 		baseuri = req.uri
 		baseuri.path = ''
 			newest_pages.each do |page|
 				item = feed.items.new_item
 				item.title = page.title
-				item.link  = baseuri + page.relative_path.sub(/\.page$/, '.html')
+				item.link  = "%s/%s" % [ baseuri, page.relative_path.sub(/\.page$/, '.html') ]
 				item.date  = page.date
 			end
 		end
 	### Action: Return an ATOM feed for the pages under the path made up of +pathparts+.
 	get 'atom' do |req|
 		feedpath = req.app_path[ %r{/atom/(.*)}, 1 ]
-		newest_pages = self.find_newest_pages( req )
+		newest_pages = self.find_newest_pages( feedpath, req )
 		newest_page = newest_pages.first
 
 		baseuri = req.uri
 			feed.authors << Atom::Person.new( :name => 'Michael Granger' )
 			feed.id      = @site_uuid.to_uri
 
-			newest_pages.each do |page|
-				entry_url = baseuri + page.relative_path.sub(/\.page$/, '.html')
+			newest_pages.sort_by {|page| page.modified }.reverse.each do |page|
+				entry_url = "%s/%s" % [ baseuri, page.relative_path.sub(/\.page$/, '.html') ]
 
 				feed.entries << Atom::Entry.new do |entry|
 					entry.title   = page.title
   template_paths:
     - data/strelka-cms/templates
 
+content_manager:
+  pageroot: public
+
+content_feeds:
+  uuid: "b2b29bcb-2bcd-553d-aef2-d709e2ef418f"
+  entry_count: 10
+  pageroot: public
+  paths:
+    - blog
+    - poetry
+
 logging:
   __default__: debug (color)
   inversion: info

lib/strelka/cms/page.rb

 #!/usr/bin/env ruby
 
 require 'time'
+require 'date'
 require 'nokogiri'
 require 'summarize'
 require 'loggability'
 	### if neither of those are available.
 	def modified
 		if headerdate = self.options['date']
+			headerdate = headerdate.to_time if headerdate.respond_to?( :to_time )
 			headerdate = Time.parse( headerdate ) unless headerdate.is_a?( Time )
 			return headerdate
 		elsif self.path

lib/strelka/cms/pagefilter/autoindex.rb

 #!/usr/bin/env ruby
 
 require 'ostruct'
-require 'configurability'
 
 require 'strelka/cms/pagecatalog'
 require 'strelka/cms/page'
 
 	### Process the given +source+ for <?autoindex ... ?> processing-instructions
 	def process( source, page )
+		self.log.info "Looking for autoindex directives..."
+
 		if catalog = page.catalog
 			self.log.debug "Processing autoindex directives."
 			source.gsub!( PI ) do |match|
 
 	### Create an HTML fragment.
 	def generate_index( pattern, page, catalog, options )
+		self.log.debug "Generating (%p) autoindex for page = %p in catalog: %p. Options = %p" %
+			[ pattern, page, catalog, options ]
 		options = self.parse_options( options )
 		style   = options.style || DEFAULT_STYLE
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.