fmt key better documentation?
See original GitHub issueThe issue:
I can’t find anything in the documentation on how to format the float output of the OpenWeather widget. I tried searching for fmt
everywhere but it’s just ("fmt", "{}", "How to format the text")
.
Required:
- I have searched past issues to see if this bug has already been reported.
Issue Analytics
- State:
- Created a year ago
- Comments:16 (12 by maintainers)
Top Results From Across the Web
Improve documentation for best practices around ... - GitHub
Hi, I am new to fmt and since my small issue deals with the same section of the documentation, I decided to put...
Read more >fmt - Go Packages
Package fmt implements formatted I/O with functions analogous to C's printf and scanf. ... A newline with zero or more spaces before it...
Read more >JSTL fmt Tag message - Oracle Help Center
Maps key to localized message and performs parametric replacement. Tag Information. Tag Class, org.apache.taglibs.standard.tag.rt.fmt.MessageTag.
Read more >JSTL - Core <fmt:message> Tag - Tutorialspoint
Attribute, Description, Required, Default. key, Message key to retrieve, No, Body. bundle, Resource bundle to use, No, Default bundle.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
OK, I’ll explain:
Widgets that display text typically inherit
base._TextBox
directly, or indirectly.base_TextBox
has a property calledformatted_text
which takes the text and basically doesself.fmt.format(text)
.The output of this property is what is displayed in the widget.
So, if you’re using, say, the
OpenWeather
widget and have it set up to show the temperature, leavingfmt
as{}
will make no difference to the output. However, if you setfmt
toThe temperature is: {}
your widget will fill the curly brackets with the temperature.fmt
is therefore a way to add additional text, prefixes, markup etc to text based widget. It’s particularly useful on those widgets where you can’t edit the text. TakeCurrentScreen
for instance. That widget, by default, just shows the number of the screen. If you setfmt
toCurrent screen: {}
you now get that additional text in front of the screen number.This allows you to add extra text to the widget without needing to use a separate
TextBox
widget to add more text.If I knew what fmt does, I would submit a PR, not write an issue 😃