Skip to content
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 exclude: param to relativize_paths filter #1340

merged 1 commit into from Jun 9, 2018


Copy link

@ddfreyne ddfreyne commented Jun 9, 2018

Implements nanoc/features/issues/41.

Detailed description

This allows specifying a list of excludes in the relativize_paths filter, e.g.

# excludes /foo, /foo/bar, …
# does not exclude /fooooo, /qux/foo, /qux/foo/asdf, …
filter :relativize_paths, type: :html, exclude: '/foo'

# excludes /foo, /foo/asdf, /bar, /bar/asdf, …
# does not exclude /fooooo, /qux/foo, /qux/foo/asdf, /qux/bar, …
filter :relativize_paths, type: :html, exclude: ['/foo', '/bar']

# excludes /foo/bar, /bar, /archive, /blog/archive/something, …
filter :relativize_paths, type: :html, exclude: /ar/

It can be used in different ways:

  • string vs. regexp: When given a regular expression, the path will not be relativized if the regular expression matches. When given a string, the path will not be relativized when the path starts with one or more components that matches the given string.

  • single object vs. array: The parameter can be either a single string or regexp, or an array of them.

To do

  • Exclude only when fully matching a path component
  • Allow specifying string instead of an array of strings
  • Allow specifying an (array of) regex instead of an (array of) strings

After merge, before release:

  • Document
@ddfreyne ddfreyne force-pushed the relativize-paths-exclude branch 3 times, most recently from bfbb4df to 47e13e1 Jun 9, 2018
@ddfreyne ddfreyne force-pushed the relativize-paths-exclude branch from 47e13e1 to 256cdbd Jun 9, 2018
@ddfreyne ddfreyne merged commit fdc2f88 into master Jun 9, 2018
1 of 2 checks passed
@ddfreyne ddfreyne deleted the relativize-paths-exclude branch Jun 9, 2018
Copy link

@DaveEveritt DaveEveritt commented Jun 10, 2018



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants