-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Allow to override default template placeholder value with #define during compilation #366
Conversation
…ing compilation. Signed-off-by: Alexandr Zarubkin <me21@yandex.ru>
Er, the build error seems to have nothing to do with the changes. |
I would really love to see this pulled. @me-no-dev any chance you can make this change for us? It's a big help for other people who I ask to install this library in order to compile the projects I'm sending them. |
I have a concern, confusion about this. Does the Arduino IDE re-compile a library if a define related to the library changes in the main .INO? I don't think it will. Triggering a re-compile of a library is a royal pain, as far as I can tell. Even just changing the library src doesn't update the code until you trackdown the arduinobuild folder and delete the .o file, right? So this isn't going to work. The only way to fix this is to make the template character a variable, which then needs a user interface to set it to other than the default. I hope I'm wrong here. |
The #define should change not in the main .INO file, it should be passed as -D flag to the compiler during build. Or #defined directly in the library header file, but that's less suitable, I think. Both ways should trigger library recompiling. |
Sorry :( ESP32 things have been keeping me quite busy. |
still a relevant thread! i solve it for now by putting my css Putting the #define TEMPLATE_PLACEHOLDER in my main code doesn't work. Due to the scope of #define? Changing it in the library itself is annoying when it gets updated. |
You need to define that symbol as a build flag passed to the compiler. That's not easy to do in Arduino, but trivial in more sophisticated build systems (Platformio, etc.) |
@me21, thanks for your reply! Why not pass it like ps: Platformio seems to have sold there soul to Microsoft, so for me that's a nogo. (i know about Atom, but it's looks they are moving away from it) |
I'm afraid this repo is not actively maintained, at least currently :-(. So doing it yourself may be quicker. |
There was a number of complaints from library users who needed to use the symbol of template placeholder in their data as-is. It seems that doubling the symbol (
%%
to get a single%
in the output) doesn't work. While that should be fixed, the code of template engine is convoluted, so the proper fix might take some time.This is a simple workaround: if the user #defines
TEMPLATE_PLACEHOLDER
during build, its value will be used. If not, default value of%
is used.