alula 0.4.15 → 0.4.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/alula/config.rb +2 -1
- data/lib/alula/contents/item.rb +19 -0
- data/lib/alula/core_ext/tags/image.rb +3 -3
- data/lib/alula/processors/image.rb +1 -1
- data/lib/alula/processors/magick.rb +2 -1
- data/lib/alula/version.rb +1 -1
- metadata +2 -2
    
        data/lib/alula/config.rb
    CHANGED
    
    | @@ -127,7 +127,8 @@ module Alula | |
| 127 127 | 
             
                    "image" => {
         | 
| 128 128 | 
             
                      "size"           => "800x600",
         | 
| 129 129 | 
             
                      "thumbnail"      => "300x300",
         | 
| 130 | 
            -
                      "thumbnail_mode" => : | 
| 130 | 
            +
                      "thumbnail_mode" => :aspect,
         | 
| 131 | 
            +
                      "image_mode"     => :aspect,
         | 
| 131 132 | 
             
                      "keep_tags"      => ["CopyrightNotice", "Title", "DateTimeOriginal"],
         | 
| 132 133 | 
             
                      "hires"          => true,
         | 
| 133 134 | 
             
                      "lazyload"       => true,
         | 
    
        data/lib/alula/contents/item.rb
    CHANGED
    
    | @@ -5,6 +5,7 @@ require 'kramdown' | |
| 5 5 | 
             
            require 'stringex'
         | 
| 6 6 | 
             
            require 'shellwords'
         | 
| 7 7 | 
             
            require 'htmlentities'
         | 
| 8 | 
            +
            require 'nokogiri'
         | 
| 8 9 |  | 
| 9 10 | 
             
            module Alula
         | 
| 10 11 | 
             
              class Content
         | 
| @@ -202,6 +203,23 @@ module Alula | |
| 202 203 | 
             
                  end
         | 
| 203 204 |  | 
| 204 205 | 
             
                  # Accessors
         | 
| 206 | 
            +
                  def description(locale = nil)
         | 
| 207 | 
            +
                    @description[(locale || self.current_locale || self.site.config.locale)] ||= begin
         | 
| 208 | 
            +
                      @metadata.description(locale) || begin
         | 
| 209 | 
            +
                        doc = Nokogiri::HTML(self.body(locale))
         | 
| 210 | 
            +
                        words = doc.text.split(' ')
         | 
| 211 | 
            +
                        summary = words.inject("") do |summary, word|
         | 
| 212 | 
            +
                          if (summary + " #{word}").length < 152
         | 
| 213 | 
            +
                            summary += "#{word} "
         | 
| 214 | 
            +
                          else
         | 
| 215 | 
            +
                            summary += "..." unless summary[/\.\.\.$/]
         | 
| 216 | 
            +
                          end
         | 
| 217 | 
            +
                          summary
         | 
| 218 | 
            +
                        end
         | 
| 219 | 
            +
                      end
         | 
| 220 | 
            +
                    end
         | 
| 221 | 
            +
                  end
         | 
| 222 | 
            +
                  
         | 
| 205 223 | 
             
                  def current_locale
         | 
| 206 224 | 
             
                    @@current_locale ||= nil
         | 
| 207 225 | 
             
                  end
         | 
| @@ -319,6 +337,7 @@ module Alula | |
| 319 337 | 
             
                    flush_render
         | 
| 320 338 | 
             
                    @markdown = {}
         | 
| 321 339 | 
             
                    @body = {}
         | 
| 340 | 
            +
                    @description = {}
         | 
| 322 341 | 
             
                  end
         | 
| 323 342 |  | 
| 324 343 | 
             
                  def flush_render
         | 
| @@ -16,7 +16,7 @@ module Alula | |
| 16 16 | 
             
                def content
         | 
| 17 17 | 
             
                  hires = hires_url(@source, :image)
         | 
| 18 18 | 
             
                  tag = "<a href=\"#{attachment_url(@source, :image)}\""
         | 
| 19 | 
            -
                  tag += " data-hires=\"#{hires}\"" if context.site.config.attachments["image"]["hires"] and hires and self.context.item.metadata.renderer.class.to_s | 
| 19 | 
            +
                  tag += " data-hires=\"#{hires}\"" if context.site.config.attachments["image"]["hires"] and hires and !self.context.item.metadata.renderer.class.to_s[/FeedBuilder/]
         | 
| 20 20 | 
             
                  tag += ">"
         | 
| 21 21 | 
             
                  tag += imagetag(@source, :thumbnail)
         | 
| 22 22 | 
             
                  tag += "</a>"
         | 
| @@ -32,13 +32,13 @@ module Alula | |
| 32 32 | 
             
                  tag += " alt=\"#{@options["alternative"]}\"" if @options["alternative"]
         | 
| 33 33 | 
             
                  tag += " title=\"#{@options["title"]}\"" if @options["title"]
         | 
| 34 34 | 
             
                  tag += " class=\"#{classes.join(" ")}\""
         | 
| 35 | 
            -
                  if context.site.config.attachments.image.lazyload and self.context.item.metadata.renderer.class.to_s | 
| 35 | 
            +
                  if context.site.config.attachments.image.lazyload and !self.context.item.metadata.renderer.class.to_s[/FeedBuilder/]
         | 
| 36 36 | 
             
                    tag += " src=\"#{asset_url("grey.gif")}\""
         | 
| 37 37 | 
             
                    tag += " data-original=\"#{src}\""
         | 
| 38 38 | 
             
                  else
         | 
| 39 39 | 
             
                    tag += " src=\"#{src}\""
         | 
| 40 40 | 
             
                  end
         | 
| 41 | 
            -
                  tag += " data-hires=\"#{hires}\"" if context.site.config.attachments.image.hires and hires and self.context.item.metadata.renderer.class.to_s | 
| 41 | 
            +
                  tag += " data-hires=\"#{hires}\"" if context.site.config.attachments.image.hires and hires and !self.context.item.metadata.renderer.class.to_s[/FeedBuilder/]
         | 
| 42 42 | 
             
                  tag += " width=\"#{info(source, type).width}\" height=\"#{info(source, type).height}\""
         | 
| 43 43 | 
             
                  tag += " />"
         | 
| 44 44 | 
             
                end
         | 
| @@ -28,7 +28,7 @@ module Alula | |
| 28 28 | 
             
                    next if (width > self.info.width and height > self.info.height) and size[:hires]
         | 
| 29 29 |  | 
| 30 30 | 
             
                    # Generate resized image to output path
         | 
| 31 | 
            -
                    resize_image(output: output, size: size[:size])
         | 
| 31 | 
            +
                    resize_image(output: output, size: size[:size], type: size[:type])
         | 
| 32 32 | 
             
                  end
         | 
| 33 33 |  | 
| 34 34 | 
             
                  # Cleanup ourself
         | 
| @@ -13,7 +13,8 @@ module Alula | |
| 13 13 | 
             
                  width, height = opts[:size]
         | 
| 14 14 |  | 
| 15 15 | 
             
                  # Generate resized image
         | 
| 16 | 
            -
                   | 
| 16 | 
            +
                  resize_mode = self.site.config.attachments.image["#{opts[:type]}_mode"]
         | 
| 17 | 
            +
                  resized = case resize_mode
         | 
| 17 18 | 
             
                  when :square
         | 
| 18 19 | 
             
                    self.image.resize_to_fill(width, height)
         | 
| 19 20 | 
             
                  else
         | 
    
        data/lib/alula/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: alula
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.4. | 
| 4 | 
            +
              version: 0.4.16
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2012-08- | 
| 12 | 
            +
            date: 2012-08-23 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: hashie
         |