mirror of
https://github.com/chubin/wttr.in
synced 2025-01-12 03:58:45 +00:00
single line: now newline for %-notation by default (#496)
This commit is contained in:
parent
b475d5521f
commit
05f04fc272
2 changed files with 7 additions and 7 deletions
|
@ -182,7 +182,7 @@ So, these two calls are the same:
|
|||
```
|
||||
$ curl wttr.in/London?format=3
|
||||
London: ⛅️ +7⁰C
|
||||
$ curl wttr.in/London?format="%l:+%c+%t"
|
||||
$ curl wttr.in/London?format="%l:+%c+%t\n"
|
||||
London: ⛅️ +7⁰C
|
||||
```
|
||||
Keep in mind, that when using in `tmux.conf`, you have to escape `%` with `%`, i.e. write there `%%` instead of `%`.
|
||||
|
|
|
@ -31,10 +31,10 @@ from . import v2
|
|||
from . import prometheus
|
||||
|
||||
PRECONFIGURED_FORMAT = {
|
||||
'1': u'%c %t',
|
||||
'2': u'%c 🌡️%t 🌬️%w',
|
||||
'3': u'%l: %c %t',
|
||||
'4': u'%l: %c 🌡️%t 🌬️%w',
|
||||
'1': r'%c %t\n',
|
||||
'2': r'%c 🌡️%t 🌬️%w\n',
|
||||
'3': r'%l: %c %t\n',
|
||||
'4': r'%l: %c 🌡️%t 🌬️%w\n',
|
||||
}
|
||||
|
||||
MOON_PHASES = (
|
||||
|
@ -305,7 +305,7 @@ def render_line(line, data, query):
|
|||
|
||||
return ''
|
||||
|
||||
template_regexp = r'%[^%]*[a-zA-Z]'
|
||||
template_regexp = r'%[a-zA-Z]'
|
||||
for template_code in re.findall(template_regexp, line):
|
||||
if template_code.lstrip("%") in FORMAT_SYMBOL_ASTRO:
|
||||
local_time_of = get_local_time_of()
|
||||
|
@ -358,7 +358,7 @@ def wttr_line(query, parsed_query):
|
|||
|
||||
data = get_weather_data(location, lang)
|
||||
output = format_weather_data(query, parsed_query, data)
|
||||
return output.rstrip("\n")+"\n"
|
||||
return output.rstrip("\n").replace(r"\n", "\n")
|
||||
|
||||
def main():
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue