|
From: Guenter M. <mi...@us...> - 2021-01-15 21:38:09
|
On 2021-01-15, Clément Pit-Claudel wrote:
> On 1/15/21 6:18 AM, Guenter Milde via Docutils-users wrote:
>>> At the moment, users of the directive just call
>>> docutils.directives.register_directive('foo', FooDirective).
>> Where is this done? A custom front-end?
> Exactly.
>>> How can I register a directive that always runs?
>>> I'm aware of the get_transform method on components, but I don't have a
>>> custom component; I'm just writing a directive.
>> I have never done this, but I'd try to get inspiration from the function
>> that processes the list returned by component.get_transform(). This is
>> transforms.Transformer.populate_from_components() where you will find::
>> So, maybe calling ::
>> document.transformer.add_transform(FooTransform)
> This looks good, but how would I get a handle on the `document` object?
Here, you may have to re-create the working of the `publish_*()` function.
It may turn out that a custom component may be easier...
... or a post-processing step that removes not-required cache files.
Günter
|