Skip to content

Commit

Permalink
Handle windows case where tty is redirected.
Browse files Browse the repository at this point in the history
Make github actions handle push.
  • Loading branch information
fire authored and maiself committed Oct 16, 2024
1 parent 3eb39bd commit cb651ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Build

on:
push:
pull_request:
workflow_dispatch:
inputs:
Expand Down
10 changes: 4 additions & 6 deletions lib/godot/_internal/utils/doc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _remove_sgr(text: str) -> str:

def reformat_doc_bbcode(text: str, for_tty: None | bool = None) -> str:
if for_tty is None:
for_tty = sys.stdout.isatty()
for_tty = sys.stdout.isatty() if sys.stdout else False

replacements = _replacements_for_tty if for_tty else _replacements

Expand All @@ -82,11 +82,9 @@ def replace(match_):
return f'{replacements.get("b", "")}{name}{replacements.get("_b", "")}'

text = re.sub(r'\[(?P<close>/)?(?P<name>[-_.\w/]+)( (?P<value>[-_.\w/]+))?\]', replace, text)
text = text.replace('\n', '\n\n', 1) # separate first line from the rest by one blank line
text = text.replace('\n', '\n\n', 1) # Separate first line from the rest by one blank line

# TODO: urls
# TODO: word wrap
# TODO: Handle URLs
# TODO: Implement word wrap if necessary

return text


0 comments on commit cb651ca

Please sign in to comment.