mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
Replace uses of shorthand codeblock syntax to avoid issues with localization
Previously, many paragraphs in the documentation used `::` at the end of a line as a replacement for a single colon (and `::` on the following line). Due to this, the `::` was part of the extracted string for localization. Weblate also showed a warning about the trailing `::`, as it's not normally expected to be there. This change requires translators to revalidate all modified strings. However, considering many of those have broken code blocks due to translators replacing `::` with `:`, it can be a good idea. This also adds documentation writing guidelines for code blocks and admonitions. This commit does not modify existing admonitions in any way (as this would lead to a much larger diff, and require more localizable text to be revalidated by translators).
This commit is contained in:
@@ -83,7 +83,9 @@ Passing variables to an expression
|
||||
|
||||
You can pass variables to an expression. These variables will then
|
||||
become available in the expression's "context" and will be substituted when used
|
||||
in the expression::
|
||||
in the expression:
|
||||
|
||||
::
|
||||
|
||||
var expression = Expression.new()
|
||||
# Define the variable names first in the second parameter of `parse()`.
|
||||
@@ -105,7 +107,9 @@ expression has no base instance associated to it.
|
||||
|
||||
When calling :ref:`Expression.execute() <class_Expression_method_execute>`,
|
||||
you can set the value of the ``base_instance`` parameter to a specific object
|
||||
instance such as ``self``, another script instance or even a singleton::
|
||||
instance such as ``self``, another script instance or even a singleton:
|
||||
|
||||
::
|
||||
|
||||
func double(number):
|
||||
return number * 2
|
||||
@@ -141,7 +145,9 @@ Associating a base instance allows doing the following:
|
||||
Example script
|
||||
--------------
|
||||
|
||||
The script below demonstrates what the Expression class is capable of::
|
||||
The script below demonstrates what the Expression class is capable of:
|
||||
|
||||
::
|
||||
|
||||
const DAYS_IN_YEAR = 365
|
||||
var script_member_variable = 1000
|
||||
@@ -191,7 +197,9 @@ The script below demonstrates what the Expression class is capable of::
|
||||
# The method's return value is also the expression's return value.
|
||||
return 0
|
||||
|
||||
The output from the script will be::
|
||||
The output from the script will be:
|
||||
|
||||
::
|
||||
|
||||
false
|
||||
true
|
||||
|
||||
Reference in New Issue
Block a user