TWIG Template Filters in World Anvil Codex | World Anvil

TWIG Template Filters

Restructuring the Codex

We are currently moving articles around and changing the general structure of the Codex. Please come back later if you get lost!

Twig Filter

When creating stablocks you have access to a series of filters. Most these filters can be found on Twig's Filters page. Filters can be used to alter the display or properties of variables for example the upper filter allows you to convert the following variable to upper case  
 variables.name|upper 

World Anvil Custom Filters

The following filters are custom to World Anvil and specialised to work on your statblocks and custom article templates.  

Parse BBcode

Warning: DO NOT use this code in Block Templates, this is meant to be used only when creating custom article templates
 
 variables.table_content|BBcode 
  Parse BBcode allows the parser to render BBcode (World Anvil Tags) in your templates.    

Parse Table

 variables.table_content|ParseTable 
  Parse table receives a string which is separated by "|" (pipe) delimiters and new lines in order to create a html table. The first line of the table will automatically become a table header (using <th> )   Example String
Weapon|Damage|Special
Longsword|1d8|Versatile   The string above will be formatted into a table with the first line being displayed as a table header while all consecutive lines will be rendered as rows of that table.  

Parse List

 variables.table_content|ParseList 
  Parse list receives a string which is separated by "|" (pipe) delimiters and new lines in order to create a key/value unordered list. This is a very special case that is needed for some types of sheets to display information in an organized fashion   Example string
Strength|12
Dexterity|15

Navigation


Comments

Please Login in order to comment!