Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix regular expression for ruby 1.8 compatibility #14

Open
wants to merge 1 commit into from

1 participant

Emiliano Ticci
Emiliano Ticci

Without escaping curly braces all commands fail with the following error on ruby 1.8:

/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': /var/lib/gems/1.8/gems/guides-0.7.2/lib/guides/indexer.rb:49: invalid regular expression; there's no previous pattern, to which '{' would define cardinality at 1: /{{(.*?)}}/ (SyntaxError)
        from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /var/lib/gems/1.8/gems/guides-0.7.2/lib/guides/generator.rb:56
        from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /var/lib/gems/1.8/gems/guides-0.7.2/lib/guides.rb:7
        from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /var/lib/gems/1.8/gems/guides-0.7.2/bin/guides:3
        from /var/lib/gems/1.8/bin/guides:19:in `load'
        from /var/lib/gems/1.8/bin/guides:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 13, 2012
  1. Emiliano Ticci
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/guides/indexer.rb
2  lib/guides/indexer.rb
View
@@ -46,7 +46,7 @@ def process(string, current_level=3, counters=[1])
header_html = Guides.config['index_header'] || "{{index}} {{title}}"
values = { 'index' => index, 'title' => title }
- header = header_html.gsub(/{{(.*?)}}/){ values[$1].to_str }
+ header = header_html.gsub(/\{\{(.*?)\}\}/){ values[$1].to_str }
raise "Parsing Fail" unless @result.sub!(s.matched, "h#{level}(#{element_id}). #{header}")
Something went wrong with that request. Please try again.