Commits

Michael Granger committed 8d4142b Merge

Merged with a31949150348

  • Participants
  • Parent commits a319491, 69163c4

Comments (0)

Files changed (5)

File 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 = ''
 		res = req.response
 
 		# Set the cache header and set the mimetype
-		res.headers.last_modified = newest_pages.first.date.httpdate
+		res.headers.last_modified = newest_page.date.httpdate
 		res.content_type = 'application/rss+xml'
 		res.body = feed.to_s
 
 			feed.authors << Atom::Person.new( :name => 'Michael Granger' )
 			feed.id      = @site_uuid.to_uri
 
-			newest_pages.each do |page|
+			newest_pages.sort_by {|page| page.modified }.reverse.each do |page|
 				entry_url = baseuri.dup
 				entry_url.path = '/' + File.join( feedpath, page.relative_html_path )
 

File etc/config.yml

   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

File 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

File 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
 

File lib/strelka/cms/pagefilter/example.rb

 	### Highlights the given +content+ in language +lang+.
 	def highlight( content, lang )
 		source = ERB::Util.html_escape( content )
-		return %Q{\n\n<pre class="brush: #{lang}">#{source}</pre>\n\n}
+		return %Q{\n\n<pre><code class="#{lang}">#{source}</code></pre>\n\n}
 	end
 
 end # class Strelka::CMS::PageFilter::Example