diff --git a/docs/features/gcode_scripts.rst b/docs/features/gcode_scripts.rst index e19f0199..7450ff7b 100644 --- a/docs/features/gcode_scripts.rst +++ b/docs/features/gcode_scripts.rst @@ -13,11 +13,19 @@ Unless :ref:`configured otherwise `, OctoP the ``scripts/gcode`` folder in OctoPrint configuration directory (per default ``~/.octoprint`` on Linux, ``%APPDATA%\OctoPrint`` on Windows and ``~/Library/Application Support/OctoPrint`` on MacOS). -These GCODE scripts are backed by the templating engine `Jinja2 `_, allowing more than just +These GCODE scripts are backed by the templating engine Jinja2, allowing more than just simple "send-as-is" scripts but making use of a full blown templating language in order to create your scripts. To this end, OctoPrint injects some variables into the :ref:`template rendering context ` as described below. +You can find the docs on the Jinja templating engine as used in OctoPrint at `jinja.octoprint.org `_. + +.. note:: + + Due to backwards compatibility issues with Jinja versions 2.9+, OctoPrint currently only supports Jinja 2.8. For this + reason use the template documentation at `jinja.octoprint.org `_ instead of the + documentation of current stable Jinja versions. + .. _sec-features-gcode_scripts-predefined: Predefined Scripts @@ -150,6 +158,7 @@ to 0 if a heated bed is configured. .. seealso:: - `Jinja Template Designer Documentation `_ + `Jinja Template Designer Documentation `_ Jinja's Template Designer Documentation describes the syntax and semantics of the template language used - also by OctoPrint's GCODE scripts. + also by OctoPrint's GCODE scripts. Linked here are the docs for Jinja 2.8.1, which OctoPrint still + relies on for backwards compatibility reasons. diff --git a/docs/plugins/gettingstarted.rst b/docs/plugins/gettingstarted.rst index fe38ab6b..ca4f3935 100644 --- a/docs/plugins/gettingstarted.rst +++ b/docs/plugins/gettingstarted.rst @@ -490,7 +490,7 @@ Also adjust your plugin's ``templates/helloworld_navbar.jinja2`` like this: OctoPrint injects the template variables that your plugin defines prefixed with ``plugin__`` into the template renderer, so your ``url`` got turned into ``plugin_helloworld_url`` which you can now use as a simple -`Jinja2 Variable `_ in your plugin's template. +`Jinja2 Variable `_ in your plugin's template. Restart OctoPrint and shift-reload the page in your browser (to make sure you really get a fresh copy). The link should still work and point to the URL we defined as default. @@ -1078,8 +1078,14 @@ For some insight on how to create plugins that react to various events within Oc add support for a slicer, OctoPrint's own bundled `CuraEngine plugin `_ might give some hints. For extending OctoPrint's interface, the `NavbarTemp plugin `_ might show what's possible with a few lines of code already. Finally, just take a look at the -`list of available plugins `_ on the OctoPrint wiki if you are -looking for examples. +`official Plugin Repository `_ if you are looking for examples. + +.. seealso:: + + `Jinja Template Designer Documentation `_ + Jinja's Template Designer Documentation describes the syntax and semantics of the template language used + by OctoPrint's frontend. Linked here are the docs for Jinja 2.8.1, which OctoPrint still + relies on for backwards compatibility reasons [#f3]_. .. rubric:: Footnotes @@ -1092,3 +1098,7 @@ looking for examples. .. [#f2] Refer to the `LESS documentation `_ on how to do that. If you are developing your plugin under Windows you might also want to give `WinLESS `_ a look which will run in the background and keep your CSS files up to date with your various project's LESS files automatically. +.. [#f3] Please always consult the Jinja documentation at `jinja.octoprint.org `_ instead of + the current stable documentation available at Jinja's project page. The reason for that is that for backwards + compatibility reasons OctoPrint currently sadly has to rely on an older version of Jinja. The documentation + available at `jinja.octoprint.org `_ matches that older version.