New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add access to regular expressions group matches used in route #478

Merged
merged 1 commit into from Dec 6, 2014

Conversation

Projects
None yet
3 participants
@mpapis
Member

mpapis commented Sep 9, 2014

$ nanoc --version
nanoc 3.7.3 © 2007-2014 Denis Defreyne.
Running ruby 2.0.0 (2014-05-08) on x86_64-linux with RubyGems 2.2.2.

my current example:

blog_regexp = %r</blog/([0-9]+)\-([0-9]+)\-([0-9]+)\-([^\/]+)>
route blog_regexp do
  y,m,d,slug = blog_regexp.match(item.identifier)[1..-1]
  "/blog/#{y}/#{m}/#{slug}/index.html"
end

would be nice if t could be reduced to:

route %r</blog/([0-9]+)\-([0-9]+)\-([0-9]+)\-([^\/]+)> do |y, m, d, slug|
  "/blog/#{y}/#{m}/#{slug}/index.html"
end

although adding matches for simplicity would be fine with me too:

route %r</blog/([0-9]+)\-([0-9]+)\-([0-9]+)\-([^\/]+)> do
  y, m, d, slug = matches
  "/blog/#{y}/#{m}/#{slug}/index.html"
end

I did not looked in to the code yet, wanted to make sure such change would be welcome

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Sep 9, 2014

Member

Good suggestion! This is something that could be tackled for 3.8, I suppose.

If you want to implement this, be my guest!

Member

ddfreyne commented Sep 9, 2014

Good suggestion! This is something that could be tackled for 3.8, I suppose.

If you want to implement this, be my guest!

@mpapis

This comment has been minimized.

Show comment
Hide comment
@mpapis

mpapis Sep 11, 2014

Member

updated

Member

mpapis commented Sep 11, 2014

updated

@mpapis

This comment has been minimized.

Show comment
Hide comment
@mpapis

mpapis Sep 11, 2014

Member

not sure about documentation, is there anything else I should update?

Member

mpapis commented Sep 11, 2014

not sure about documentation, is there anything else I should update?

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Sep 12, 2014

Member

This PR looks quite nice now. I can handle documentation!

I’m not around in the next few days so I’ll likely only have the time to properly handle this PR some time next week.

Member

ddfreyne commented Sep 12, 2014

This PR looks quite nice now. I can handle documentation!

I’m not around in the next few days so I’ll likely only have the time to properly handle this PR some time next week.

@mpapis

This comment has been minimized.

Show comment
Hide comment
@mpapis

mpapis Nov 15, 2014

Member

rebased on top of master in case you are ready to merge it ;)

Member

mpapis commented Nov 15, 2014

rebased on top of master in case you are ready to merge it ;)

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Nov 15, 2014

Coverage Status

Coverage remained the same when pulling ddc9655 on mpapis:feature/add_group_matches_in_route_gh_478 into 01e0f37 on nanoc:master.

coveralls commented Nov 15, 2014

Coverage Status

Coverage remained the same when pulling ddc9655 on mpapis:feature/add_group_matches_in_route_gh_478 into 01e0f37 on nanoc:master.

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Nov 16, 2014

Member

Yeah, will merge this tomorrow!

Member

ddfreyne commented Nov 16, 2014

Yeah, will merge this tomorrow!

@ddfreyne ddfreyne modified the milestone: 3.8 Nov 29, 2014

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Dec 6, 2014

Member

… for a very loose definition of “tomorrow”—apologies!

Member

ddfreyne commented Dec 6, 2014

… for a very loose definition of “tomorrow”—apologies!

@ddfreyne ddfreyne removed the to review label Dec 6, 2014

@ddfreyne ddfreyne merged commit ddc9655 into nanoc:master Dec 6, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment