Limnoria-doc/use/plugins/format.rst

155 lines
3.2 KiB
ReStructuredText
Raw Normal View History

2011-06-28 08:11:32 +02:00
.. _plugin-format:
The Format plugin
=================
2011-06-28 17:29:38 +02:00
Capitals
--------
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
.. _command-format-upper:
format upper <text>
^^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
Returns *<text>* uppercased.
2011-06-28 17:29:38 +02:00
.. _command-format-capitalize:
format capitalize <text>
^^^^^^^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
Returns *<text>* capitalized.
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
.. _command-format-lower:
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
format lower <text>
^^^^^^^^^^^^^^^^^^^
Returns *<text>* lowercased.
.. _command-format-title:
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
format title <text>
^^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
Returns *<text>* titlecased.
Text modifications
------------------
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
.. _command-format-format:
format format <format string> [<arg> ...]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
Expands a Python-style format string using the remaining args. Just be
sure always to use %s, not %d or %f or whatever, because all the args
are strings.
2011-06-28 17:29:38 +02:00
.. _command-format-color:
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
format color <foreground> [<background>] <text>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
Returns *<text>* with foreground color *<foreground>* and background color
*<background>* (if given)
2011-06-28 17:29:38 +02:00
.. _command-format-repr:
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
format repr <text>
^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
Returns the text surrounded by double quotes.
2011-06-28 17:29:38 +02:00
.. _command-format-replace:
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
format replace <substring to translate> <substring to replace it with> <text>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
Replaces all non-overlapping occurrences of *<substring to translate>*
with *<substring to replace it with>* in *<text>*.
2011-06-28 17:29:38 +02:00
.. _command-format-field:
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
format field <number> <text>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
Returns the *<number>th* space-separated field of *<text>*. I.e., if text
is "foo bar baz" and *<number>* is 2, "bar" is returned.
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
.. _command-format-concat:
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
format concat <string 1> <string 2>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
Concatenates two strings. Do keep in mind that this is *not* the same
thing as join "", since if *<string 2>* contains spaces, they won't be
removed by concat.
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
.. _command-format-translate:
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
format translate <chars to translate> <chars to replace those with> <text>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
Replaces *<chars to translate>* with *<chars to replace those with>* in
*<text>*. The first and second arguments must necessarily be the same
length.
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
.. _command-format-cut:
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
format cut <size> <text>
^^^^^^^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
Cuts *<text>* down to *<size>* by chopping off the rightmost characters in
excess of *<size>*. If *<size>* is a negative number, it chops that many
characters off the end of *<text>*.
2011-06-28 17:29:38 +02:00
.. _command-format-join:
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
format join <separator> <string 1> [<string> ...]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
Joins all the arguments together with *<separator>*.
2011-06-28 17:29:38 +02:00
.. _command-format-reverse:
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
format reverse <text>
2011-06-28 08:11:32 +02:00
^^^^^^^^^^^^^^^^^^^^^
2011-06-28 17:29:38 +02:00
Returns *<text>* in reverse-video.
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
Text properties
---------------
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
.. _command-format-bold:
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
format bold <text>
^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
Returns *<text>* bolded.
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
.. _command-format-underline:
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
format underline <text>
^^^^^^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
Returns *<text>* underlined.
2011-06-28 08:11:32 +02:00
.. _plugin-format-config:
Configuration
-------------
.. _supybot.plugins.Format.public:
supybot.plugins.Format.public
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Default value: True
Determines whether this plugin is publicly visible.