single line: now newline for %-notation by default (#496)

pull/501/head
Igor Chubin 4 years ago
parent b475d5521f
commit 05f04fc272

@ -182,7 +182,7 @@ So, these two calls are the same:
``` ```
$ curl wttr.in/London?format=3 $ curl wttr.in/London?format=3
London: ⛅️ +7⁰C London: ⛅️ +7⁰C
$ curl wttr.in/London?format="%l:+%c+%t" $ curl wttr.in/London?format="%l:+%c+%t\n"
London: ⛅️ +7⁰C London: ⛅️ +7⁰C
``` ```
Keep in mind, that when using in `tmux.conf`, you have to escape `%` with `%`, i.e. write there `%%` instead of `%`. 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 from . import prometheus
PRECONFIGURED_FORMAT = { PRECONFIGURED_FORMAT = {
'1': u'%c %t', '1': r'%c %t\n',
'2': u'%c 🌡️%t 🌬️%w', '2': r'%c 🌡️%t 🌬️%w\n',
'3': u'%l: %c %t', '3': r'%l: %c %t\n',
'4': u'%l: %c 🌡️%t 🌬️%w', '4': r'%l: %c 🌡️%t 🌬️%w\n',
} }
MOON_PHASES = ( MOON_PHASES = (
@ -305,7 +305,7 @@ def render_line(line, data, query):
return '' return ''
template_regexp = r'%[^%]*[a-zA-Z]' template_regexp = r'%[a-zA-Z]'
for template_code in re.findall(template_regexp, line): for template_code in re.findall(template_regexp, line):
if template_code.lstrip("%") in FORMAT_SYMBOL_ASTRO: if template_code.lstrip("%") in FORMAT_SYMBOL_ASTRO:
local_time_of = get_local_time_of() local_time_of = get_local_time_of()
@ -358,7 +358,7 @@ def wttr_line(query, parsed_query):
data = get_weather_data(location, lang) data = get_weather_data(location, lang)
output = format_weather_data(query, parsed_query, data) output = format_weather_data(query, parsed_query, data)
return output.rstrip("\n")+"\n" return output.rstrip("\n").replace(r"\n", "\n")
def main(): def main():
""" """

Loading…
Cancel
Save