diff options
| author | Poommetee Ketson | 2017-07-22 21:22:38 +0700 |
|---|---|---|
| committer | Rémi Verschelde | 2017-07-30 21:25:11 +0200 |
| commit | 9e8a8619a153185eaaec3752130643fffe5b1ded (patch) | |
| tree | ba60918d74a39aa5905df90ffb9470022b57c901 | |
| parent | e06ce9565533953d17eacc8bec70129e4d80797e (diff) | |
| download | godot-9e8a8619a153185eaaec3752130643fffe5b1ded.tar.gz godot-9e8a8619a153185eaaec3752130643fffe5b1ded.tar.zst godot-9e8a8619a153185eaaec3752130643fffe5b1ded.zip | |
Docs: ignore tags inside code,codeblock tag
(cherry picked from commit 5bbbecc3156eb98ad9b69a89419b276c78c7acdc)
| -rw-r--r-- | doc/tools/makerst.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py index 84d22c5ed..d2e204626 100644 --- a/doc/tools/makerst.py +++ b/doc/tools/makerst.py @@ -172,6 +172,7 @@ def rstize_text(text, cclass): pos += 1 # Handle [tags] + inside_code = False pos = 0 while True: pos = text.find('[', pos) @@ -191,7 +192,18 @@ def rstize_text(text, cclass): else: # command cmd = tag_text space_pos = tag_text.find(' ') - if cmd.find('html') == 0: + if cmd == '/codeblock': + tag_text = '' + inside_code = False + # Strip newline if the tag was alone on one + if pre_text[-1] == '\n': + pre_text = pre_text[:-1] + elif cmd == '/code': + tag_text = '``' + inside_code = False + elif inside_code: + tag_text = '[' + tag_text + ']' + elif cmd.find('html') == 0: cmd = tag_text[:space_pos] param = tag_text[space_pos + 1:] tag_text = param @@ -216,11 +228,7 @@ def rstize_text(text, cclass): tag_text = '' elif cmd == 'codeblock': tag_text = '\n::\n' - elif cmd == '/codeblock': - tag_text = '' - # Strip newline if the tag was alone on one - if pre_text[-1] == '\n': - pre_text = pre_text[:-1] + inside_code = True elif cmd == 'br': # Make a new paragraph instead of a linebreak, rst is not so linebreak friendly tag_text = '\n\n' @@ -233,10 +241,11 @@ def rstize_text(text, cclass): tag_text = '**' elif cmd == 'u' or cmd == '/u': tag_text = '' - elif cmd == 'code' or cmd == '/code': + elif cmd == 'code': tag_text = '``' + inside_code = True else: - tag_text = ':ref:`' + tag_text + '<class_' + tag_text.lower() + '>`' + tag_text = make_type(tag_text) text = pre_text + tag_text + post_text pos = len(pre_text) + len(tag_text) |
