Closed rhdtownsend closed 3 years ago
Indeed, the current API does not allow for customizing on the Fypp
object level. The Fypp
object initializes the parser, the builder and the render, based on the options it gets via the FyppOptions
object (the command line arguments) and then creates a Processor
object with them. So, depending what you are planning to do, you have two options:
Processor
with a customized parser, builder or renderer. Then you had full flexibility, but you would have to take the settings in FyppOptions
(the command line options) into account manually.Fypp
to accept optional factory functions for the parser, the builder and the renderer. Then you could write and pass a function, which generates a modified parser when called. The signature of the function would have to resemble the signature of the respective __init__()
functions.In case you choose the 2nd option, you might consider to make a PR on the API change of Fypp
.
Implemented in f97100b5f
Is there a straightfoward way for fypp to generate dependency information? That is, process a file and print out a list of other files that get in included by #:include directives.
It looks like this can be done by subclassing Parser and overriding handle_include(), but how do I then get the Fypp class to use my Parser subclass rather than the default class?
Thanks!
Rich