diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index b510d306..d9298f4f 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -47,7 +47,7 @@ module Jekyll merged_file_read_opts(opts)) if content =~ /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m self.content = $POSTMATCH - self.data = SafeYAML.load($1) + self.data = SafeYAML.load(Regexp.last_match(1)) end rescue SyntaxError => e Jekyll.logger.warn "YAML Exception reading #{File.join(base, name)}: #{e.message}" diff --git a/lib/jekyll/document.rb b/lib/jekyll/document.rb index 42881309..8d7c92f4 100644 --- a/lib/jekyll/document.rb +++ b/lib/jekyll/document.rb @@ -263,7 +263,7 @@ module Jekyll self.content = File.read(path, merged_file_read_opts(opts)) if content =~ YAML_FRONT_MATTER_REGEXP self.content = $POSTMATCH - data_file = SafeYAML.load($1) + data_file = SafeYAML.load(Regexp.last_match(1)) merge_data!(data_file) if data_file end diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index 5881fa58..a7dbd519 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -13,11 +13,11 @@ module Jekyll def initialize(tag_name, markup, tokens) super if markup.strip =~ SYNTAX - @lang = $1.downcase + @lang = Regexp.last_match(1).downcase @highlight_options = {} - if defined?($2) && $2 != '' + if defined?(Regexp.last_match(2)) && Regexp.last_match(2) != '' # Split along 3 possible forms -- key="", key=value, or key - $2.scan(/(?:\w="[^"]*"|\w=\w|\w)+/) do |opt| + Regexp.last_match(2).scan(/(?:\w="[^"]*"|\w=\w|\w)+/) do |opt| key, value = opt.split('=') # If a quoted list, convert to array if value && value.include?("\"")