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

Conversation

denisdefreyne
Copy link
Member

@denisdefreyne denisdefreyne 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

@DaveEveritt
Copy link

👍

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

Successfully merging this pull request may close these issues.

None yet

2 participants