# Unable to use common filters in custom templates

**URL:** <https://forum.opencyphal.org/t/unable-to-use-common-filters-in-custom-templates/1910>\
**Category:** Nunavut\
**Created:** [June 13, 2023, 4:40pm UTC](https://forum.opencyphal.org/t/unable-to-use-common-filters-in-custom-templates/1910 "2023-06-13T16:40:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![willeccles](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/willeccles/32/1400_2.png) [@willeccles](https://forum.opencyphal.org/u/willeccles)\
**Post date:** [June 13, 2023, 4:40pm UTC](https://forum.opencyphal.org/t/unable-to-use-common-filters-in-custom-templates/1910/1 "2023-06-13T16:40:58Z")

</div>

I intended to write my own templates for C generation, so I went ahead and copied the contents of `lang/c/templates` to a new directory. Before attempting to modify them, I tried to generate C headers with these new templates. The command I am running is as follows (I am testing with the `public_regulated_data_types`):

```auto
nnvg --target-language c --target-endianness=little --enable-serialization-asserts --templates templates public_regulated_data_types/reg --lookup-dir public_regulated_data_types/uavcan

```

If I simply remove `--templates`, all is well and it generates normally. However, after adding the template directory, I get the following:

```auto
nunavut.jinja.jinja2.exceptions.TemplateAssertionError: no filter named 'remove_blank_lines'

```

What am I missing? I can’t seem to make this work at all. The documentation suggests that I should be able to use these just fine.

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [June 13, 2023, 4:45pm UTC](https://forum.opencyphal.org/t/unable-to-use-common-filters-in-custom-templates/1910/2 "2023-06-13T16:45:31Z")

</div>

I think this might be worthy of opening a new issue on GitHub. Sorry.

---

<div class="post-metadata">

**Author:** ![willeccles](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/willeccles/32/1400_2.png) [@willeccles](https://forum.opencyphal.org/u/willeccles)\
**Post date:** [June 13, 2023, 4:58pm UTC](https://forum.opencyphal.org/t/unable-to-use-common-filters-in-custom-templates/1910/3 "2023-06-13T16:58:30Z")

</div>

Ironically, I was writing the issue on GitHub and then decided it might be better off here. I’ll go ahead and open one there.

---

<div class="post-metadata">

**Author:** ![willeccles](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/willeccles/32/1400_2.png) [@willeccles](https://forum.opencyphal.org/u/willeccles)\
**Post date:** [June 13, 2023, 5:01pm UTC](https://forum.opencyphal.org/t/unable-to-use-common-filters-in-custom-templates/1910/4 "2023-06-13T17:01:07Z")

</div>

For potential future readers, the GitHub issue: [Unable to use common filters in custom templates · Issue #310 · OpenCyphal/nunavut · GitHub](https://github.com/OpenCyphal/nunavut/issues/310)

---

<div class="post-metadata">

**Author:** ![scottdixon](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/scottdixon/32/39_2.png) [@scottdixon](https://forum.opencyphal.org/u/scottdixon)\
**Post date:** [June 14, 2023, 6:09am UTC](https://forum.opencyphal.org/t/unable-to-use-common-filters-in-custom-templates/1910/5 "2023-06-14T06:09:53Z")

</div>

A fix is building now: [fix for #310 by thirtytwobits · Pull Request #311 · OpenCyphal/nunavut · GitHub](https://github.com/OpenCyphal/nunavut/pull/311)

Thanks for reporting this.

---

<div class="post-metadata">

**Author:** ![willeccles](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/willeccles/32/1400_2.png) [@willeccles](https://forum.opencyphal.org/u/willeccles)\
**Post date:** [June 14, 2023, 4:37pm UTC](https://forum.opencyphal.org/t/unable-to-use-common-filters-in-custom-templates/1910/6 "2023-06-14T16:37:29Z")

</div>

Thank you for fixing it so quickly!

---

<div class="post-metadata">

**Author:** ![scottdixon](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/scottdixon/32/39_2.png) [@scottdixon](https://forum.opencyphal.org/u/scottdixon)\
**Post date:** [June 14, 2023, 9:59pm UTC](https://forum.opencyphal.org/t/unable-to-use-common-filters-in-custom-templates/1910/7 "2023-06-14T21:59:35Z")

</div>

NP. Fix is now release: [nunavut · PyPI](https://pypi.org/project/nunavut/)
