jekyll_picture_tag 1.14.0 → 2.0.0pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.envrc +2 -0
- data/.github/workflows/code-checks.yml +2 -12
- data/.rubocop.yml +2 -0
- data/.ruby-version +1 -1
- data/docs/devs/contributing/code.md +11 -3
- data/docs/devs/contributing/testing.md +0 -11
- data/docs/devs/releases.md +20 -0
- data/docs/index.md +32 -17
- data/docs/logo.png +0 -0
- data/docs/logo.svg +880 -0
- data/docs/users/getting_started.md +55 -0
- data/docs/users/installation.md +17 -38
- data/docs/users/liquid_tag/argument_reference/crop.md +21 -36
- data/docs/users/liquid_tag/examples.md +13 -25
- data/docs/users/liquid_tag/index.md +1 -1
- data/docs/users/notes/{migration.md → migration_1.md} +1 -1
- data/docs/users/notes/migration_2.md +99 -0
- data/docs/users/presets/cropping.md +21 -22
- data/docs/users/presets/default.md +11 -3
- data/docs/users/presets/examples.md +77 -45
- data/docs/users/presets/fallback_image.md +1 -1
- data/docs/users/presets/html_attributes.md +1 -1
- data/docs/users/presets/image_formats.md +3 -3
- data/docs/users/presets/image_quality.md +70 -55
- data/docs/users/presets/index.md +78 -42
- data/docs/users/presets/link_source.md +1 -1
- data/docs/users/presets/media_queries.md +1 -1
- data/docs/users/presets/nomarkdown_override.md +1 -1
- data/docs/users/presets/pixel_ratio_srcsets.md +1 -1
- data/docs/users/presets/width_height_attributes.md +1 -1
- data/docs/users/presets/width_srcsets.md +61 -23
- data/docs/users/tutorial.md +97 -0
- data/jekyll_picture_tag.gemspec +33 -23
- data/lib/jekyll_picture_tag.rb +8 -6
- data/lib/jekyll_picture_tag/cache.rb +64 -3
- data/lib/jekyll_picture_tag/defaults/global.rb +18 -0
- data/lib/jekyll_picture_tag/defaults/presets.rb +57 -0
- data/lib/jekyll_picture_tag/images.rb +1 -0
- data/lib/jekyll_picture_tag/images/generated_image.rb +25 -63
- data/lib/jekyll_picture_tag/images/image_file.rb +90 -0
- data/lib/jekyll_picture_tag/images/img_uri.rb +3 -12
- data/lib/jekyll_picture_tag/images/source_image.rb +44 -9
- data/lib/jekyll_picture_tag/instructions.rb +70 -6
- data/lib/jekyll_picture_tag/instructions/children/config.rb +128 -0
- data/lib/jekyll_picture_tag/instructions/children/context.rb +24 -0
- data/lib/jekyll_picture_tag/instructions/children/params.rb +90 -0
- data/lib/jekyll_picture_tag/instructions/children/parsers.rb +41 -0
- data/lib/jekyll_picture_tag/instructions/children/preset.rb +182 -0
- data/lib/jekyll_picture_tag/instructions/parents/conditional_instruction.rb +69 -0
- data/lib/jekyll_picture_tag/instructions/parents/env_instruction.rb +29 -0
- data/lib/jekyll_picture_tag/output_formats/basic.rb +5 -17
- data/lib/jekyll_picture_tag/parsers.rb +5 -0
- data/lib/jekyll_picture_tag/{instructions → parsers}/arg_splitter.rb +1 -1
- data/lib/jekyll_picture_tag/parsers/configuration.rb +28 -0
- data/lib/jekyll_picture_tag/{instructions → parsers}/html_attributes.rb +1 -1
- data/lib/jekyll_picture_tag/parsers/preset.rb +43 -0
- data/lib/jekyll_picture_tag/{instructions → parsers}/tag_parser.rb +15 -12
- data/lib/jekyll_picture_tag/router.rb +35 -93
- data/lib/jekyll_picture_tag/srcsets/basic.rb +4 -10
- data/lib/jekyll_picture_tag/utils.rb +10 -20
- data/lib/jekyll_picture_tag/version.rb +1 -1
- data/readme.md +2 -0
- metadata +124 -106
- data/Dockerfile +0 -9
- data/docs/users/notes/input_checking.md +0 -6
- data/docs/users/presets/strip_metadata.md +0 -13
- data/install_imagemagick.sh +0 -23
- data/jekyll-picture-tag.gemspec +0 -52
- data/lib/jekyll-picture-tag.rb +0 -25
- data/lib/jekyll_picture_tag/cache/base.rb +0 -61
- data/lib/jekyll_picture_tag/cache/generated.rb +0 -20
- data/lib/jekyll_picture_tag/cache/source.rb +0 -19
- data/lib/jekyll_picture_tag/defaults/global.yml +0 -13
- data/lib/jekyll_picture_tag/defaults/presets.yml +0 -12
- data/lib/jekyll_picture_tag/instructions/configuration.rb +0 -121
- data/lib/jekyll_picture_tag/instructions/preset.rb +0 -122
- data/lib/jekyll_picture_tag/instructions/set.rb +0 -75
@@ -1,75 +0,0 @@
|
|
1
|
-
module PictureTag
|
2
|
-
module Instructions
|
3
|
-
# Supervisor class, which manages all input handling and high level decision
|
4
|
-
# making which depends on it.
|
5
|
-
class Set
|
6
|
-
def initialize(raw_tag_params)
|
7
|
-
@raw_tag_params = raw_tag_params
|
8
|
-
end
|
9
|
-
|
10
|
-
def config
|
11
|
-
@config ||= Configuration.new
|
12
|
-
end
|
13
|
-
|
14
|
-
def params
|
15
|
-
@params ||= TagParser.new @raw_tag_params
|
16
|
-
end
|
17
|
-
|
18
|
-
def preset
|
19
|
-
@preset ||= Preset.new params.preset_name
|
20
|
-
end
|
21
|
-
|
22
|
-
def html_attributes
|
23
|
-
# Depends on both the preset and tag params.
|
24
|
-
@html_attributes ||= HTMLAttributeSet.new params.leftovers
|
25
|
-
end
|
26
|
-
|
27
|
-
# These are our Media Query presets. It's really just a hash, and there
|
28
|
-
# are no default values, so extracting this to its own class is overkill.
|
29
|
-
def media_presets
|
30
|
-
search_data('media_queries') || search_data('media_presets') || {}
|
31
|
-
end
|
32
|
-
|
33
|
-
def source_images
|
34
|
-
@source_images ||= build_source_images
|
35
|
-
end
|
36
|
-
|
37
|
-
def crop(media = nil)
|
38
|
-
params.geometries[media] || preset.crop(media)
|
39
|
-
end
|
40
|
-
|
41
|
-
def gravity(media = nil)
|
42
|
-
params.gravities[media] || preset.gravity(media)
|
43
|
-
end
|
44
|
-
|
45
|
-
# Returns a class constant for the selected output format, which is used
|
46
|
-
# to dynamically instantiate it.
|
47
|
-
def output_class
|
48
|
-
Object.const_get(
|
49
|
-
'PictureTag::OutputFormats::' + Utils.titleize(preset['markup'])
|
50
|
-
)
|
51
|
-
end
|
52
|
-
|
53
|
-
private
|
54
|
-
|
55
|
-
def search_data(key)
|
56
|
-
PictureTag.site.data.dig('picture', key)
|
57
|
-
end
|
58
|
-
|
59
|
-
def build_source_images
|
60
|
-
source_names = params.source_names
|
61
|
-
media_presets = params.media_presets
|
62
|
-
|
63
|
-
sources = [SourceImage.new(source_names.shift)]
|
64
|
-
|
65
|
-
while params.source_names.any?
|
66
|
-
sources << SourceImage.new(
|
67
|
-
source_names.shift, media_presets.shift
|
68
|
-
)
|
69
|
-
end
|
70
|
-
|
71
|
-
sources
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|