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 support for inclusions of files as text #8

Merged
merged 4 commits into from
Apr 12, 2018
Merged

Conversation

ruippeixotog
Copy link
Contributor

No description provided.

content_include_confs.each do |include_conf|
extra_vars = (include_conf['vars'] || {}).map { |k, v| [k, root_config.dig(*v.split('.'))] }.to_h
extra_consts = include_conf['constants'] || {}
symbol_table = merge_at(root_config, at_path, config).merge(global_vars).merge(extra_vars).merge(extra_consts)
Copy link
Member

Choose a reason for hiding this comment

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

The logic for building the symbol table for $include and $content_include is very similar. Can we extract this to a method?

Copy link
Contributor Author

@ruippeixotog ruippeixotog Apr 11, 2018

Choose a reason for hiding this comment

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

Sure, changed in 07a1447.

extra_vars = (include_conf['vars'] || {}).map { |k, v| [k, root_config.dig(*v.split('.'))] }.to_h
extra_consts = include_conf['constants'] || {}
symbol_table = merge_at(root_config, at_path, config).merge(global_vars).merge(extra_vars).merge(extra_consts)
content += Parser.parse_as_text(include_conf['file'], symbol_table)
Copy link
Member

Choose a reason for hiding this comment

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

If the file doesn't exist we have a no implicit conversion of nil into String error here. Perhaps we can have a more specific error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The behavior most consistent with the renaming parts of Frise is to treat non-existing files as empty content (in this case, an empty string). Fixed in 07a1447.

@jcazevedo jcazevedo merged commit cf68b0e into 0.3.0 Apr 12, 2018
@jcazevedo jcazevedo deleted the content_includes branch April 12, 2018 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants