Skip to content

jinjaconfig

Class info

Classes

Name Children Inherits
JinjaConfig
mkdocs_mknodes.appconfig.jinjaconfig
    JinjaLoader
    mkdocs_mknodes.appconfig.jinjaconfig

      🛈 DocStrings

      JinjaConfig

      Bases: BaseModel

      Parameters:

      Name Type Description Default
      jinja_block_start_string str | None
      None
      jinja_block_end_string str | None
      None
      jinja_variable_start_string str | None
      None
      jinja_variable_end_string str | None
      None
      jinja_on_undefined str
      'strict'
      jinja_loaders list[JinjaLoader] | None
      None
      jinja_extensions list[str] | None
      None
      Source code in mkdocs_mknodes/appconfig/jinjaconfig.py
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45
      46
      47
      48
      49
      50
      51
      52
      53
      54
      55
      class JinjaConfig(BaseModel):
          jinja_block_start_string: str | None = None
          """Jinja block start string."""
          jinja_block_end_string: str | None = None
          """Jinja block end string."""
          jinja_variable_start_string: str | None = None
          """Jinja variable start string."""
          jinja_variable_end_string: str | None = None
          """Jinja variable end string."""
          jinja_on_undefined: str = Field("strict")
          """Jinja undefined macro behavior."""
          jinja_loaders: list[JinjaLoader] | None = None
          """List containing additional jinja loaders to use.
      
          Dictionaries must have the `type` key set to either "filesystem" or "fsspec".
      
          Examples:
              ``` yaml
              plugins:
              - mknodes:
                  jinja_loaders:
                  - type: fsspec
                    path: github://
                    repo: mknodes
                    org: phil65
              ```
          """
          jinja_extensions: list[str] | None = None
          """List containing additional jinja extensions to use.
      
          Examples:
              ``` yaml
              plugins:
              - mknodes:
                  jinja_extensions:
                  - jinja2_ansible_filters.AnsibleCoreFiltersExtension
              ```
          """
      
          def get_jinja_config(self) -> jinjarope.EnvConfig:
              return jinjarope.EnvConfig(
                  block_start_string=self.jinja_block_start_string or "{%",
                  block_end_string=self.jinja_block_end_string or "%}",
                  variable_start_string=self.jinja_variable_start_string or r"{{",
                  variable_end_string=self.jinja_variable_end_string or r"}}",
                  # undefined=self.jinja_on_undefined,
                  loader=jinjarope.loaders.from_json(self.jinja_loaders),
                  extensions=self.jinja_extensions or [],
              )
      

      jinja_block_end_string class-attribute instance-attribute

      jinja_block_end_string: str | None = None
      

      Jinja block end string.

      jinja_block_start_string class-attribute instance-attribute

      jinja_block_start_string: str | None = None
      

      Jinja block start string.

      jinja_extensions class-attribute instance-attribute

      jinja_extensions: list[str] | None = None
      

      List containing additional jinja extensions to use.

      Examples:

      plugins:
      - mknodes:
          jinja_extensions:
          - jinja2_ansible_filters.AnsibleCoreFiltersExtension
      

      jinja_loaders class-attribute instance-attribute

      jinja_loaders: list[JinjaLoader] | None = None
      

      List containing additional jinja loaders to use.

      Dictionaries must have the type key set to either "filesystem" or "fsspec".

      Examples:

      plugins:
      - mknodes:
          jinja_loaders:
          - type: fsspec
            path: github://
            repo: mknodes
            org: phil65
      

      jinja_on_undefined class-attribute instance-attribute

      jinja_on_undefined: str = Field('strict')
      

      Jinja undefined macro behavior.

      jinja_variable_end_string class-attribute instance-attribute

      jinja_variable_end_string: str | None = None
      

      Jinja variable end string.

      jinja_variable_start_string class-attribute instance-attribute

      jinja_variable_start_string: str | None = None
      

      Jinja variable start string.

      JinjaLoader

      Bases: BaseModel

      Parameters:

      Name Type Description Default
      typ str
      required
      path str
      required
      Source code in mkdocs_mknodes/appconfig/jinjaconfig.py
      58
      59
      60
      class JinjaLoader(BaseModel):
          typ: str
          path: str