ninjecto.plugins.filters.comment

Filter to comment out a section of text.

Functions

ninjecto.plugins.filters.comment.filter_comment(environment, text, style='python', **kwargs)

Filter to comment out a section of text.

Parameters
  • text (str) – Text to comment out.
  • style (str) – Formatting style for different languages. Available options are: bash, c, cblock, cdoc, cpp, cppblock, csharp, csharpblock, doxygen, erlang, html, java, javablock, javadoc, javascript, javascriptblock, js, jsblock, jsdoc, openscad, openscadblock, perl, phpdoc, powershell, python, ruby, sql, swift, swiftblock, toml, xml and yaml. You may also use None or empty string '' to not apply the comment filter at all, which can be useful when using it conditionally.
  • kwargs

    Style overrides. Possible keys are:

    • newline (str): Newline character to use. It defaults to Jinja’s Environment.newline_sequence.
    • beginning (str): String to place at the beginning of the comment. Usually for block style comments.
    • prefix (str): Decoration to use to prefix the text.
    • prefix_count (int): Number of prefixes to prepend to the text.
    • decoration (str): String to use at the beginning of each line.
    • postfix (str): Decoration to use to postfix the text.
    • postfix_count (int): Number of postfixes to append to the text.
    • end (str): String to place at the end of the comment. Usually for block style comments.
Returns

The text commented out.

Return type

str