---
title: Mapping AsciiDoc ifeval to Jinja
description: ifeval couples a parent document to its modules by comparing context strings. Jinja expresses the same coupling — including the unsetting that stops it leaking.
created: "2026-08-21"
author: Gabriel McGoldrick
tags:
  - topic/asciidoc
  - topic/jinja
---

# Mapping AsciiDoc ifeval to Jinja {#mapping-asciidoc-ifeval-to-jinja}

Jinja maps AsciiDoc `ifeval::` directly, using equality comparisons of the form `{% if x == y %}`.

:::note{title="AsciiDoc to Markdown — part 6 of 7"}
1. [Migrating AsciiDoc to Markdown](/blog/migrating-asciidoc-to-markdown/)
2. [Why existing AsciiDoc converters lose your structure](/blog/why-existing-converters-lose-structure/)
3. [Why Jinja is the right target](/blog/why-jinja-is-the-right-target/)
4. [Mapping AsciiDoc variables to Jinja](/blog/asciidoc-variables-in-jinja/)
5. [Mapping AsciiDoc conditionals to Jinja](/blog/asciidoc-conditionals-in-jinja/)
6. **Mapping AsciiDoc ifeval to Jinja** — you are here
7. [Mapping AsciiDoc includes and level offsets to Jinja](/blog/asciidoc-includes-in-jinja/)
:::

The OpenShift docs use tight coupling between parent and child AsciiDoc documents. A module asks *which assembly am I being included from?* and adapts. That is replicable in Markdown with Jinja.

## Setting a flag from context {#setting-a-flag-from-context}

- AsciiDoc:

  ```asciidoc
  ifeval::["{context}" == "changing-cloud-credentials-configuration"]
  :postinstall:
  endif::[]
  ```
- Jinja:

  ```jinja
  {%- if context == "changing-cloud-credentials-configuration" %}
  {%- set postinstall = true -%}
  {% endif %}
  ```

## Unsetting it again {#unsetting-it-again}

This is the part that is easy to miss. Because AsciiDoc attributes persist once set, a module that sets a flag must also clear it — otherwise the flag leaks into every document assembled afterwards. The same discipline is required in the Jinja form:

- AsciiDoc:

  ```asciidoc
  ifeval::["{context}" == "changing-cloud-credentials-configuration"]
  :!postinstall:
  endif::[]
  ifeval::["{context}" == "preparing-manual-creds-update"]
  :!update:
  endif::[]
  ```
- Jinja:

  ```jinja
  {%- if context == "changing-cloud-credentials-configuration" %}
  {%- set postinstall = false -%}
  {% endif %}
  {% if context == "preparing-manual-creds-update" %}
  {%- set update = false -%}
  {% endif %}
  ```

Note `:!postinstall:` — the `!` is AsciiDoc's *unset*, and it becomes `set ... = false`, not a deletion. A converter that silently drops the unset produces documents that are correct in isolation and wrong in sequence, which is the hardest class of bug to spot in a migrated corpus.

Reference: [Configuring the Cloud Credential Operator utility](https://raw.githubusercontent.com/openshift/openshift-docs/refs/heads/main/modules/cco-ccoctl-configuring.adoc)

Next: [mapping AsciiDoc includes and level offsets to Jinja](/blog/asciidoc-includes-in-jinja/).
