# The basics of using SSGen # (c) theokrueger 2024 # GPL-3.0 Licensed # Intro h1: Conditionals using !IF p: > SSGen allows evaluating conditional statements to choose whether to include something, or to not. Currently, no arithmetic can be performed, therefore the !IF statement only evaluates if the input is blank or not. --- # Example - p: 'Conditionals can be used like so:' - span: _class: two-column-grid-with-spacer yaml: - !DEF [NAMED_CODE_NAME, "input_directory/index.page"] - !DEF - NAMED_CODE_CONTENT - | \# Syntax: !IF ['string', 'exec if true', '?exec if false'] \# Where "?exec" is optional html: body: - !DEF ["var", "notempty"] - h1: Title - p: !IF ["\\\{var}", "Paragraph contents"] - p: !IF ["\\\{undeclared_var}", "True", "False"]; - !INCLUDE /blocks/named-code.block br: '' html: - !DEF [NAMED_CODE_NAME, "output_directory/index.html"] - !DEF - NAMED_CODE_CONTENT - | <html> <body> <h1>Title</h1> <p>Paragraph Contents</p> <p>False</p> </body> </html> - !INCLUDE /blocks/named-code.block # Clarification - p: As a reminder, SSGen only checks if the first entry in the !IF statement is blank or not. You cannot do arithmetic currently.