Given that EEx.compile_string/2 already has an optional *options* parameter
I don't think adding a third one would be wise as that would definitely
start breaking stuff.
Maybe add something like :parser_options as a possible option you can pass
in?
The call would look something like: *EEx.compile_string("something here",
[parser_options: [**static_atoms_encoder: fn (a, b) -> something end]])*
If you think that works I'll get going on a PR!
On Saturday, 19 June 2021 at 20:21:19 UTC+2 José Valim wrote:
> Makes total sense. A PR for "parser_options" is welcome!
>
> On Sat, Jun 19, 2021 at 7:42 PM Wannes Gennar <[email protected]> wrote:
>
>>
>> Currently the only way to modify the options passed into EEx's
>> Code.string_to_quoted!/2 call is by calling Code.put_compiler_option/2 for
>> :parser_options.
>>
>> Specifically I'd want to pass in a custom :static_atoms_encoder function
>> while compiling certain EEx templates. However Code.put_compiler_option
>> feels a bit hackey and it modifies configuration that not only affects the
>> compilation of my specific EEx templates.
>>
>> Ideally you'd be able to pass along options to EEx.compile_* that get
>> passed down to Code.string_to_quoted to allow for more fine grained control
>> over the code generation.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "elixir-lang-core" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/elixir-lang-core/85799e27-9ec8-4579-9790-75150d73a57cn%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/elixir-lang-core/85799e27-9ec8-4579-9790-75150d73a57cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-core/05fd053d-a81b-4117-acba-91dbc5d63fa7n%40googlegroups.com.