lib/nanoc/helpers/blogging.rb in nanoc-4.9.6 vs lib/nanoc/helpers/blogging.rb in nanoc-4.9.7

- old
+ new

@@ -34,10 +34,11 @@ attr_accessor :limit attr_accessor :relevant_articles attr_accessor :preserve_order attr_accessor :content_proc attr_accessor :excerpt_proc + attr_accessor :title_proc attr_accessor :title attr_accessor :author_name attr_accessor :author_uri attr_accessor :icon attr_accessor :logo @@ -145,11 +146,11 @@ return if url.nil? xml.entry do # Add primary attributes xml.id atom_tag_for(article) - xml.title article[:title], type: 'html' + xml.title title_proc.call(article), type: 'html' # Add dates xml.published attribute_to_time(article[:created_at]).__nanoc_to_iso8601_time xml.updated attribute_to_time(article[:updated_at] || article[:created_at]).__nanoc_to_iso8601_time @@ -175,10 +176,11 @@ # @option params [Number] :limit # @option params [Array] :articles # @option params [Boolean] :preserve_order # @option params [Proc] :content_proc # @option params [Proc] :excerpt_proc + # @option params [Proc] :title_proc # @option params [String] :alt_link # @option params [String] :id # @option params [String] :title # @option params [String] :author_name # @option params [String] :author_uri @@ -198,9 +200,10 @@ builder.limit = params[:limit] || 5 builder.relevant_articles = params[:articles] || articles || [] builder.preserve_order = params.fetch(:preserve_order, false) builder.content_proc = params[:content_proc] || ->(a) { a.compiled_content(snapshot: :pre) } builder.excerpt_proc = params[:excerpt_proc] || ->(a) { a[:excerpt] } + builder.title_proc = params[:title_proc] || ->(a) { a[:title] } builder.title = params[:title] || @item[:title] || @config[:title] builder.author_name = params[:author_name] || @item[:author_name] || @config[:author_name] builder.author_uri = params[:author_uri] || @item[:author_uri] || @config[:author_uri] builder.icon = params[:icon] builder.logo = params[:logo]