How to extend a core template macro

In some cases we need to customise part of a template, the template block mechanism is not granular enough. I noticed that in several cases there is some widget template, which contains a lot of macros. I don’t want to override the whole template, which implies all the widgets in the template. I need to override a couple of line in the macro.
Is there a way to import the core-template from the plugin-template?

An example:

from Indico-core you have a template A with the following content:

{% from 'B.html' import foo %}
{% macro A %} 
  {{ B() }}
{% endmacro %}
{% macro B %} .... {% endmacro %}

I want to change do_this, so in my template_override i would need something like:

{% from 'core:A' import B %}
{% macro A %} 
   {{ B() }}
{% endmacro %}

In this way if from another core-template someone uses {% from ‘A’ import A %} will be call the plugin-template A macro, which uses other parts of core-template A macro

Is it possible? is there some special convention to invoke explicitly a core-template?


If you enable CUSTOMIZATION_DEBUG in indico.conf you should see the information on the original path of each overridden template.

If the template is called as a.html, then you’ll import the original macro from '~a.html'.

Good, thank You very much, it worked, it worked!
Is there a way to force a jinja-template to import a macro starting with underscore?

or alternatively, is there a way to replace a single macro from another template?

no, i don’t think so