summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYeongho Kim <yeonghoey@gmail.com>2019-09-28 09:21:58 +0900
committerYeongho Kim <yeonghoey@gmail.com>2019-10-01 23:39:45 +0900
commitd4a55fb6397053119fecc67006284cc81b908100 (patch)
tree16dfaf9bbd00224329c6ad9df5c6fc18f853048c
parent871a9d5d56ead0b640618762cd945be0fb2cff97 (diff)
Print errors when tab indent found in [codeblock]
-rw-r--r--doc/classes/HTTPClient.xml2
-rw-r--r--doc/classes/SceneTree.xml6
-rwxr-xr-xdoc/tools/makerst.py5
-rw-r--r--modules/gdscript/doc_classes/@GDScript.xml8
4 files changed, 13 insertions, 8 deletions
diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml
index c91ddccaa4..1a2d5cab81 100644
--- a/doc/classes/HTTPClient.xml
+++ b/doc/classes/HTTPClient.xml
@@ -69,7 +69,7 @@
[codeblock]
{
"content-length": 12,
- "Content-Type": "application/json; charset=UTF-8",
+ "Content-Type": "application/json; charset=UTF-8",
}
[/codeblock]
</description>
diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml
index ed43f83f05..bd81a48ff5 100644
--- a/doc/classes/SceneTree.xml
+++ b/doc/classes/SceneTree.xml
@@ -69,9 +69,9 @@
Commonly used to create a one-shot delay timer as in the following example:
[codeblock]
func some_function():
- print("start")
- yield(get_tree().create_timer(1.0), "timeout")
- print("end")
+ print("start")
+ yield(get_tree().create_timer(1.0), "timeout")
+ print("end")
[/codeblock]
</description>
</method>
diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py
index 8eddc35352..1b27e4a35a 100755
--- a/doc/tools/makerst.py
+++ b/doc/tools/makerst.py
@@ -608,8 +608,10 @@ def rstize_text(text, state): # type: (str, State) -> str
break
pre_text = text[:pos]
+ indent_level = 0
while text[pos + 1] == '\t':
pos += 1
+ indent_level += 1
post_text = text[pos + 1:]
# Handle codeblocks
@@ -633,6 +635,9 @@ def rstize_text(text, state): # type: (str, State) -> str
while code_pos + to_skip + 1 < len(code_text) and code_text[code_pos + to_skip + 1] == '\t':
to_skip += 1
+ if to_skip > indent_level:
+ print_error("Four spaces should be used for indentation within [codeblock], file: {}".format(state.current_class), state)
+
if len(code_text[code_pos + to_skip + 1:]) == 0:
code_text = code_text[:code_pos] + "\n"
code_pos += 1
diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml
index 788db7fb86..1d0567dd8d 100644
--- a/modules/gdscript/doc_classes/@GDScript.xml
+++ b/modules/gdscript/doc_classes/@GDScript.xml
@@ -590,10 +590,10 @@
extends Sprite
var elapsed = 0.0
func _process(delta):
- var min_angle = deg2rad(0.0)
- var max_angle = deg2rad(90.0)
- rotation = lerp_angle(min_angle, max_angle, elapsed)
- elapsed += delta
+ var min_angle = deg2rad(0.0)
+ var max_angle = deg2rad(90.0)
+ rotation = lerp_angle(min_angle, max_angle, elapsed)
+ elapsed += delta
[/codeblock]
</description>
</method>