Commit Graph

49 Commits

Author SHA1 Message Date
atomicules e4aa45b03f Fix titleize_slug so already capitalized words are not dropped
Previously `titleize` used `capitalize!` which has the side effect of
returning `nil` for anything already starting with a capital letter. This
commit changes it to just `capitalize`.

Example, before:

A file "2016-01-01-This-is-a-title-with-Capitals.markdown" would return "Is A
Title With" for `post.title`

Example, after:

A file "2016-01-01-This-is-a-title-with-Capitals.markdown" will return "This Is A
Title With Capitals" for `post.title`

Tests added for `titleize_slug` in test_utils.rb

Fix problem introduced in 67f842546e

References #4525
2016-02-15 21:22:50 +00:00
Parker Moore aad54c9a87 Add Utils.merged_file_read_opts to unify reading & strip the BOM 2016-01-26 17:08:54 -08:00
Parker Moore 8204e479c3 add Utils.strip_heredoc 2016-01-22 09:11:56 -08:00
Jordon Bedwell 67f842546e Fix #4191: Reduce Document#post_read complexity slightly. 2016-01-22 09:11:56 -08:00
Parker Moore 5d79c55b2c Fix deep_merge_hashes! handling of drops and hashes 2016-01-15 11:22:39 -08:00
Parker Moore 3e81331af1 Utils: don't require mime/types 2016-01-15 10:00:45 -08:00
Parker Moore b6c283a4ae wip: allow custom extensions 2016-01-04 17:42:06 -08:00
Parker Moore cb5bc1093e utils: has_yaml_header? should accept files with extraneous spaces
Occasionally, extra spaces at the end of the YAML front matter prologue are
saved to a file and it goes missing without telling the user why. This
should simply accept those changes without any detriment to the user,
allowing anyone to add as many spaces as they like to the end of their
front matter prologues.
2016-01-04 14:09:30 -08:00
Pat Hawks ab3d906e04
Rubocop: Style/ParenthesesAroundCondition
- Don't use parentheses around the condition of an if
2016-01-04 12:14:00 -08:00
Pat Hawks f6fd9014ba
Rubocop: Style/CaseIndentation
- Indent when as deep as case
2016-01-04 11:15:37 -08:00
Pat Hawks 4c5d77a4b5 Rubocop: Style/EmptyLines 2016-01-04 11:08:18 -08:00
Pat Hawks 98a19cdf2b
Rubocop: Style/PercentLiteralDelimiters
- %w-literals should be delimited by ( and )
Rubocop: Style/WordArray
 - Use %w or %W for array of words
2016-01-03 15:32:11 -08:00
Pat Hawks fb0457bf3d
Rubocop: Style/AndOr
- Use && instead of and
 - Use || instead of or
2016-01-03 15:30:26 -08:00
Parker Moore 5bf596b239 utils/drops: update Drop to support Utils.deep_merge_hashes
Fixes #4287
2015-12-27 08:06:37 -05:00
Parker Moore d070a77716 url: fix issue with bad URL escaping when using Drop 2015-12-24 15:07:20 -05:00
Jordon Bedwell 28c568386d Merge pull request #4220 from jekyll/pull/enable-codeclimate-platform
Fix: #4219: Add CodeClimate Platform.
2015-12-04 12:08:00 -06:00
Jordon Bedwell b6de905ee4 Fix: #4219: Add CodeClimate Platform. 2015-12-04 11:42:52 -06:00
Parker Moore 6cbd06ea85 Merge pull request #4109 from jekyll/cleanup-kramdown-converter
Merge pull request 4109
2015-12-04 09:21:22 -08:00
Jordon Bedwell 3432fd2c2d Modernize Kramdown for Markdown converter. 2015-12-04 08:09:08 -06:00
Parker Moore b90f8e048a Merge pull request #4150 from ducktyper/master
Merge pull request 4150
2015-11-30 19:57:01 -08:00
ducksan cho e9f8b4df74 Add Windows support to Utils.safe_glob 2015-11-19 17:15:51 +13:00
Ducksan Cho a168edae45 Add Utils.safe_glob method
which works the same way as Dir.glob but seperating the input
into two parts ('dir' + '/' + 'pattern') to make sure
the first part('dir') does not act as a pattern.
2015-11-19 00:46:46 +13:00
rebornix 6a98ab2a15 Make `:title` cased for backwards compability and add `:slug` for uncased usage. 2015-11-18 10:43:13 +08:00
Parker Moore 45f69bb8cd Utils: deep_merge_hashes should also merge default_proc
If the target hash's default_proc isn't set, overwrite with the new hash's default_proc.

/cc #4064
2015-10-26 17:27:36 -07:00
Parker Moore b89f943bf2 collections: posts as collection 2015-10-26 00:29:14 -07:00
Jordon Bedwell ae11cae659 Fix #3653: Add a doctor helper to test pwd's. 2015-05-17 02:46:40 -05:00
Will Norris 0d1586a5c4 Improved permalinks for pages and collections
This updates the default permalink style for pages and collections to
match the site-wide 'permalink' setting.  If the permalink setting
contains a trailing slash, either explicitly or by being set to
':pretty', then pages and collections permalinks will contain trailing
slashes by default as well.  Similarly, if the permalink setting
contains a trailing ':output_ext', so will pages and collections.  If
the permalink setting contains neither a trailing slash or extension,
neither will pages or collections.

This impacts only the default permalink structure for pages and
collections.  Permalinks set in the frontmatter of an individual page
take precedence, as does the permalink setting for a specific
collection.

Fixes #2691
2015-03-04 09:38:23 -08:00
Parker Moore aaf0ba15cc Use frozen regular expressions for Utils#slugify 2015-01-17 16:25:33 -08:00
Parker Moore 10659e1eef Merge branch 'nitoyon-slugify-new-param'
* nitoyon-slugify-new-param:
  Remove superfluous Sass declarations.
  Move the slugify options out to their own section so as to fix the formatting.
  Document the mode parameter of slugify Liquid filter
  Add tests for mode parameters of slugify Liquid filter
  Add mode parameter to slugify Liquid filter

Conflicts:
	lib/jekyll/utils.rb

        ---> Hadn't added UTF-8 support in nitoyon's PR.
2015-01-17 16:06:10 -08:00
Parker Moore a098dc80cd Merge pull request #3234 from jekyll/ruby-2-2 2014-12-29 20:49:04 -05:00
Parker Moore 7bcf8d689e Always call Time#localtime to translate to TZ'd time. 2014-12-29 20:12:35 -05:00
Renaud Martinet f9e249ae20 Generalize Utils#slugify for any scripts
It replaces any non alphanumeric glyphs by an hyphen.
2014-10-31 15:56:03 +01:00
Parker Moore 7fd9f102c0 Merge pull request #2997 from jekyll/utils-slugify 2014-10-20 20:11:04 -07:00
Glauco Custódio 68c0e8f847 Hash#each_key instead of Hash#keys.each. Faster code. 2014-10-20 10:10:29 -02:00
Parker Moore 9f5835871b Utils.slugify: Don't create new objects when gsubbing 2014-10-12 16:18:40 -07:00
nitoyon 46e76bde3f Add mode parameter to slugify Liquid filter 2014-10-12 02:44:58 +09:00
Chris Frederick 4adc35aaf3 Revise Utils#slugify with inspiration from Rails 2014-09-02 14:32:14 +09:00
Chris Frederick 702b39dec5 Replace the 'name' parameter with 'string' 2014-09-02 13:34:44 +09:00
Chris Frederick 3ca1245027 Move Document#sluggify to Utils#slugify 2014-09-02 13:29:28 +09:00
Parker Moore f16a5cbae1 Add Utils.has_yaml_header? so we can check the front matter existence in one place 2014-08-12 15:58:02 -04:00
Alfred Xing 4cfbdb07bb Show input in error message
Show date input in error message to make it easier for user
to find infringing date/file
2014-08-02 11:51:04 -07:00
Alfred Xing d5322a73bf Move instances of `Time.parse` into a Utils method 2014-08-02 09:38:50 -07:00
Alfred Xing 6d62dbbafc Replace deprecated Ruby methods
Replace `Hash#has_key?` and `File.exists?` with `Hash#key?`
and `File.exist?`
2014-07-31 12:50:20 -07:00
Terry Schmidt c76e41d157 Update `Utils#pluralized_array_from_hash` and `Utils#value_from_singular_key` per suggestion from @parkr
Switched to using the `#tap` method for more concise code. Also returning the value from
`value_from_singular_key` instead of returning an array wrapped presentation of the value.
This allows for a one-liner in `pluralized_array_from_hash`.
2014-05-20 12:32:59 -05:00
Terry Schmidt 0371b69952 Set categor[y|ies] on post if they appear in site frontmatter defaults 2014-05-09 13:34:13 -05:00
John Piasetzki 3e6a6ffb52 Update util functions
Cribbed from http://api.rubyonrails.org/classes/Hash.html#method-i-symbolize_keys
2014-04-28 02:06:41 -04:00
Parker Moore 7787d64bce Rename those Utils functions. 2014-03-04 15:52:05 -05:00
Parker Moore 5e8643d855 Add Utils.stringify_hash_keys 2014-03-04 15:44:53 -05:00
Parker Moore e2af1b547b Extract core extensions into a Utils module
Fixes #2111
2014-03-03 22:13:03 -05:00