mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-15 23:22:53 +08:00
Clean up man page parser output a bit
This commit is contained in:
parent
2b35b3f06e
commit
cddf7e0986
@ -138,7 +138,15 @@ def builtcommand(options, description):
|
||||
truncation_suffix = u'… [See Man Page]'
|
||||
|
||||
# Try to include as many whole sentences as will fit
|
||||
sentences = description.split('.')
|
||||
# Clean up some probably bogus escapes in the process
|
||||
clean_desc = description.replace("\\'", "'").replace("\\.", ".")
|
||||
sentences = clean_desc.split('.')
|
||||
|
||||
# Clean up "sentences" that are just whitespace
|
||||
# But don't let it be empty
|
||||
sentences = [x for x in sentences if x.strip()]
|
||||
if not sentences: sentences = ['']
|
||||
|
||||
truncated_description = sentences[0] + '.'
|
||||
for line in sentences[1:]:
|
||||
if not line: continue
|
||||
|
Loading…
x
Reference in New Issue
Block a user