Skip to content

Commit a281844

Browse files
Update Static_blocks.md
Add note about defining templates in the question variables re: #1081
1 parent 9a9fd55 commit a281844

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

doc/en/Authoring/Question_blocks/Static_blocks.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ The template block has two parameters, the first being a name which should be a
9292

9393
Note in the background templates are just functions with CASText values. You can do the same with inline CASText and more importantly building your own functions allows you to use arguments for them and thus makes repetition with varying parameters simpler. For templates no arguments exist, for them the values come from the context where they get placed in, and must therefore be controlled though other means.
9494

95+
Note that if you wish to use a template in both the question text and in the PRT feedback, you will need to define it in the question variables (in particular, if you define the template in the question text, it will not work in the PRT feedback since the PRT feedback is evaluated in a different scope from the question text). For instance:
96+
97+
define_my_template: castext("[[template name="foobar"]]Whatever is {@whatever@}[[/template]]");
98+
99+
You can then use `[[template name="foobar"/]]` throughout the question.
100+
95101
## Entity escape block ##
96102

97103
Sometimes one needs to author content that uses characters that are sensitive in HTML syntax. If one wraps that content in this block those characters will be automatically converted to HTML-entities during output. Can be very useful when including sample blocks of code, that includes certain operators. `[[entityescape]] code with some less than chars [[/entityescape]]`.

0 commit comments

Comments
 (0)