Modding Jinja

Jinja is a template language that lets you plug variables and such into an HTML page.

What it looks like
{# I'm a comment #} {% for nipple in nipples %} {% if nipple.damageLevel > 3 %} NIPPLE CRISIS:  {% endif %} {% endfor %}

Not to be confused with Python format strings, which only use one set of curly braces around a variable:

Adding to a page with blocks
This is the preferred way to edit Fleshcult's HTML because different mods can add stuff to the same pages without replacing each other's work.

Every page in Fleshcult is split into a series of named blocks: {% block heading %} ... {% endblock %}

These provide landmarks which let you specify where in the page your mod content should go. An easy way to find out what you should name your block filename is to open the page in developer tools and look for comments near where you want to add that say something like:

Displaying variables
As in Python you can use dots to access the variables inside objects.

Here's a horribly incomplete list of variables you can use:
 * player - The current game state.
 * player.doms[0] - The player character


 * encounter - The current sex scene. Not available at the lair.
 * encounter.dom - The player character, again.
 * encounter.sub - The mortal character in a sex scene.
 * Note: Each character has a bunch of Character Variables inside it.


 * messages - When something happens in a sex scene, it's described in the messages list. This is a list of paragraphs which each have a list of sentences.


 * strx.format - The string translator. This is the thing that fills in variables for dialogue editor content, so you can use those same variables (e.g. {obj.name}) from inside a Jinja template.


 * flashmessages - The error messages that appear in the bright orange box

Find out more

 * Reference documentation
 * https://jinja.palletsprojects.com/en/2.11.x/templates/