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
merged 1 commit into from Jun 9, 2018

Conversation

Projects
None yet
2 participants
@ddfreyne
Member

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 merged commit fdc2f88 into master Jun 9, 2018

1 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@ddfreyne ddfreyne deleted the relativize-paths-exclude branch Jun 9, 2018

@DaveEveritt

This comment has been minimized.

Show comment
Hide comment
@DaveEveritt

DaveEveritt Jun 10, 2018

Contributor

👍

Contributor

DaveEveritt commented Jun 10, 2018

👍

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