jekyll-v4-github-pages 232 → 233

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ec66e769e01b1d4742041cc722e946ca77166e9a0df03106688651d4455ce04
4
- data.tar.gz: 56ad6f63329c5d397c3a7f489a45c82f1e9fa5f13b59face93a07f6937ecd89b
3
+ metadata.gz: 6261b7568c6aaf356ce8046a6f73877535b2acfa3ff7e539a14c02529c546cd4
4
+ data.tar.gz: 1ca23404fd54cd61efc08c24bde40e86d5d8e2d30dae3332d771dfd95139dd16
5
5
  SHA512:
6
- metadata.gz: a930e8f7b707ae7d2c4362c7b2d9531397558361450fd53223f31619f7054a82cb265f679dc5c99a1578de68fa86093ddf492168faef476cabd601a101dd42c7
7
- data.tar.gz: 9a9763209bc8c9b64dbd40e453c29ef6f288e0297679b646da9bc515e148a251d580eb5d2ad631ed947711f1c0826ce76b65786e980bbf2ae7018488442d4f76
6
+ metadata.gz: 94c8a430291c9f6609f2175ea5d14da77222b2c3f60e5aea4d58f3e3acc745b744ff7a1f8ade3ad2f0fce59103f26c262a0465a8515c47431b12b0eb149090dd
7
+ data.tar.gz: c2b43512877eb1d2f4fb7cf44b4731bbeb6ba22f1ec44e6be3b9d46d133a1b8f67ae63ba35bd63d1a4970cc9604debfb16eb90dd4446d9401dd9dbcb73084d1a
@@ -65,8 +65,21 @@ Mercenary.program(:"jekyll-v4-github-pages") do |p|
65
65
  c.option 'source', '--source DIR', 'From where to collect the source files'
66
66
  c.option 'destination', '--destination DIR', 'To where the compiled files should be written'
67
67
  c.option 'future', '--future', 'Publishes posts with a future date'
68
+ c.option 'config', '--config FILE1[,FILE2[,FILE3]]', Array, 'Specify config files instead of using _config.yml'
68
69
 
69
70
  c.action do |_, options|
71
+ config = options["config"] || ["_config.yml"]
72
+
73
+ default_config = File.expand_path("../../lib/_default_config.yml", __FILE__)
74
+ options["config"] = [default_config]
75
+
76
+ config.each { |item|
77
+ user_config = File.join(options["source"] || Dir.pwd, item)
78
+ if File.exist?(user_config)
79
+ options["config"].push(user_config)
80
+ end
81
+ }
82
+
70
83
  Jekyll::Commands::Build.process(options)
71
84
  end
72
85
  end
@@ -0,0 +1,23 @@
1
+ # Default, user overwritable options
2
+ jailed: false
3
+ future: false
4
+ theme: jekyll-v4-theme-primer
5
+ markdown: kramdown
6
+ kramdown:
7
+ input: GFM
8
+ hard_wrap: false
9
+ gfm_quirks: paragraph_end
10
+ syntax_highlighter_opts:
11
+ default_lang: plaintext
12
+ template: ""
13
+ math_engine: mathjax
14
+ syntax_highlighter: rouge
15
+ exclude:
16
+ - CNAME
17
+
18
+ # Previously not overwritable, now these can be configured as well
19
+ lsi: false
20
+ safe: true
21
+ highlighter: rouge
22
+ gist:
23
+ noscript: false
@@ -3,7 +3,8 @@
3
3
  require "securerandom"
4
4
 
5
5
  module GitHubPages
6
- # Sets and manages Jekyll configuration defaults and overrides
6
+ # Sets and manages Jekyll configuration defaults
7
+ # Most configuration is now set in _default_config.yml
7
8
  class Configuration
8
9
  # Backward compatability of constants
9
10
  DEFAULT_PLUGINS = GitHubPages::Plugins::DEFAULT_PLUGINS
@@ -11,57 +12,13 @@ module GitHubPages
11
12
  DEVELOPMENT_PLUGINS = GitHubPages::Plugins::DEVELOPMENT_PLUGINS
12
13
  THEMES = GitHubPages::Plugins::THEMES
13
14
 
14
- # Default, user overwritable options
15
- DEFAULTS = {
16
- "jailed" => false,
17
- "plugins" => GitHubPages::Plugins::DEFAULT_PLUGINS,
18
- "future" => true,
19
- "theme" => "jekyll-v4-theme-primer",
20
- "markdown" => "kramdown",
21
- "kramdown" => {
22
- "input" => "GFM",
23
- "hard_wrap" => false,
24
- "gfm_quirks" => "paragraph_end",
25
- "syntax_highlighter_opts" => {
26
- "default_lang" => "plaintext",
27
- },
28
- },
29
- "exclude" => ["CNAME"],
30
- }.freeze
31
-
32
15
  # User-overwritable defaults used only in production for practical reasons
33
- PRODUCTION_DEFAULTS = Jekyll::Utils.deep_merge_hashes DEFAULTS, {
16
+ PRODUCTION_DEFAULTS = {
34
17
  "sass" => {
35
18
  "style" => "compressed",
36
19
  },
37
20
  }.freeze
38
21
 
39
- # Options which GitHub Pages sets, regardless of the user-specified value
40
- #
41
- # The following values are also overridden by GitHub Pages, but are not
42
- # overridden locally, for practical purposes:
43
- # * source
44
- # * destination
45
- # * jailed
46
- # * verbose
47
- # * incremental
48
- # * GH_ENV
49
- OVERRIDES = {
50
- "lsi" => false,
51
- "safe" => true,
52
- "plugins_dir" => SecureRandom.hex,
53
- "whitelist" => GitHubPages::Plugins::PLUGIN_WHITELIST,
54
- "highlighter" => "rouge",
55
- "kramdown" => {
56
- "template" => "",
57
- "math_engine" => "mathjax",
58
- "syntax_highlighter" => "rouge",
59
- },
60
- "gist" => {
61
- "noscript" => false,
62
- },
63
- }.freeze
64
-
65
22
  class << self
66
23
  def processed?(site)
67
24
  site.instance_variable_get(:@_github_pages_processed) == true
@@ -79,31 +36,19 @@ module GitHubPages
79
36
  Jekyll.env == "development"
80
37
  end
81
38
 
82
- def defaults_for_env
83
- defaults = development? ? DEFAULTS : PRODUCTION_DEFAULTS
84
- Jekyll::Utils.deep_merge_hashes Jekyll::Configuration::DEFAULTS, defaults
85
- end
86
-
87
- # Given a user's config, determines the effective configuration by building a user
88
- # configuration sandwhich with our overrides overriding the user's specified
89
- # values which themselves override our defaults.
90
- #
91
39
  # Returns the effective Configuration
92
40
  #
93
41
  # Note: this is a highly modified version of Jekyll#configuration
94
42
  def effective_config(user_config)
95
- # Merge user config into defaults
96
- config = Jekyll::Utils.deep_merge_hashes(defaults_for_env, user_config)
97
- .add_default_collections
43
+ config = user_config
44
+ if !development?
45
+ config = Jekyll::Utils.deep_merge_hashes PRODUCTION_DEFAULTS, config
46
+ end
98
47
 
99
48
  # Allow theme to be explicitly disabled via "theme: null"
100
49
  config["theme"] = user_config["theme"] if user_config.key?("theme")
101
50
 
102
51
  migrate_theme_to_remote_theme(config)
103
- exclude_cname(config)
104
-
105
- # Merge overwrites into user config
106
- config = Jekyll::Utils.deep_merge_hashes config, OVERRIDES
107
52
 
108
53
  restrict_and_config_markdown_processor(config)
109
54
 
@@ -123,7 +68,7 @@ module GitHubPages
123
68
  processed(site)
124
69
  end
125
70
 
126
- # Set the site's configuration with all the proper defaults and overrides.
71
+ # Set the site's configuration with all the proper defaults.
127
72
  # Should be called by #set to protect against multiple processings.
128
73
  def set!(site)
129
74
  site.config = effective_config(site.config)
@@ -154,17 +99,11 @@ module GitHubPages
154
99
  # This functionality has been rolled back due to complications with jekyll-remote-theme.
155
100
  end
156
101
 
157
- # If the user's 'exclude' config is the default, also exclude the CNAME
158
- def exclude_cname(config)
159
- return unless config["exclude"].eql? Jekyll::Configuration::DEFAULT_EXCLUDES
160
-
161
- config["exclude"].concat(DEFAULTS["exclude"])
162
- end
163
-
164
102
  # Requires default plugins and configures whitelist in development
165
103
  def configure_plugins(config)
166
104
  # Ensure we have those gems we want.
167
105
  config["plugins"] = Array(config["plugins"]) | DEFAULT_PLUGINS
106
+ config["whitelist"] = Array(config["whitelist"]) | PLUGIN_WHITELIST
168
107
 
169
108
  # To minimize errors, lazy-require jekyll-remote-theme if requested by the user
170
109
  config["plugins"].push("jekyll-remote-theme") if config.key? "remote_theme"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GitHubPages
4
- VERSION = 232
4
+ VERSION = 233
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-v4-github-pages
3
3
  version: !ruby/object:Gem::Version
4
- version: '232'
4
+ version: '233'
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub, Inc.
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-05-09 00:00:00.000000000 Z
12
+ date: 2023-05-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jekyll
@@ -700,6 +700,7 @@ extra_rdoc_files: []
700
700
  files:
701
701
  - ".rubocop.yml"
702
702
  - bin/jekyll-v4-github-pages
703
+ - lib/_default_config.yml
703
704
  - lib/github-pages.rb
704
705
  - lib/github-pages/configuration.rb
705
706
  - lib/github-pages/dependencies.rb