-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
lib/frise/loader.rb
Outdated
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, changed in 07a1447.
lib/frise/loader.rb
Outdated
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
9200e51
to
07a1447
Compare
No description provided.