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

Permit included rules files to define their own preprocess block #420

Merged
merged 1 commit into from May 1, 2014

Conversation

@gpakosz
Copy link
Member

@gpakosz gpakosz commented Apr 13, 2014

Within a rules file, behavior when defining two preprocessor blocks is unchanged: defining another processor block overrides the previous one.

This follows up on #413.

dsl.instance_eval(@data, "./#{rules_filename}")
dsl.rules_filename = old_rules_filename
Copy link
Member

@ddfreyne ddfreyne Apr 13, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why od you change the rules_filename here?

Loading

Copy link
Member Author

@gpakosz gpakosz Apr 13, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dsl.rules_filename is the name of the rules file being parsed. Upon include_rules completion, dsl.rules_filename should be reset to the parent file.

Loading

Within a rules file, behavior when defining two preprocessor blocks is
unchanged: defining another processor block overrides the previous one.
@ddfreyne
Copy link
Member

@ddfreyne ddfreyne commented Apr 16, 2014

Looks good so far. Will probably play around with this and merge it later this week.

Loading

@gpakosz
Copy link
Member Author

@gpakosz gpakosz commented Apr 16, 2014

@ddfreyne If you look at the implementation of parse, you'll notice rules_filename is an absolute path (because I need to identify various rules files to ensure per file preprocessor block unicity). Are you fine with this? From within Rules, if you puts __FILE__, dsl.instance_eval(@data, rules_filename) makes __FILE__ being an absolute path instead of ./Rules.

Should I make it relative to the site directory?

Loading

@ddfreyne
Copy link
Member

@ddfreyne ddfreyne commented Apr 17, 2014

@gpakosz I think it is fine the way it is now.

Loading

@gpakosz
Copy link
Member Author

@gpakosz gpakosz commented Apr 17, 2014

👌

Loading

ddfreyne added a commit that referenced this issue May 1, 2014
Permit included rules files to define their own preprocess block
@ddfreyne ddfreyne merged commit 6751628 into nanoc:master May 1, 2014
1 check passed
Loading
@ddfreyne ddfreyne removed the to review label May 1, 2014
@gpakosz gpakosz deleted the per-rules-file-preprocessor branch Jul 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants