Improve docs

This commit is contained in:
Shawn Zhong 2023-04-29 16:04:13 -05:00
parent 5bcf0d7f97
commit c9f614ed5a
5 changed files with 33 additions and 26 deletions

View File

@ -39,14 +39,14 @@ similar to that of Python's `str.format
<https://docs.python.org/3/library/stdtypes.html#str.format>`_.
They take *fmt* and *args* as arguments.
*fmt* is a format string that contains literal text and replacement fields
surrounded by braces ``{}``. The fields are replaced with formatted arguments
in the resulting string. `~fmt::format_string` is a format string which can be
implicitly constructed from a string literal or a ``constexpr`` string and is
checked at compile time in C++20. To pass a runtime format string wrap it in
`fmt::runtime`.
* *fmt* is a format string that contains literal text and replacement fields
surrounded by braces ``{}``. The fields are replaced with formatted arguments
in the resulting string. `~fmt::format_string` is a format string which can be
implicitly constructed from a string literal or a ``constexpr`` string and is
checked at compile time in C++20. To pass a runtime format string wrap it in
`fmt::runtime`.
*args* is an argument list representing objects to be formatted.
* *args* is an argument list representing objects to be formatted.
.. _format:
@ -75,7 +75,8 @@ Compile-time format string checks are enabled by default on compilers
that support C++20 ``consteval``. On older compilers you can use the
:ref:`FMT_STRING <legacy-checks>`: macro defined in ``fmt/format.h`` instead.
Unused arguments are allowed as in Python's `str.format` and ordinary functions.
Unused arguments are allowed as in Python's `str.format
<https://docs.python.org/3/library/stdtypes.html#str.format>`_ and ordinary functions.
.. doxygenclass:: fmt::basic_format_string
:members:
@ -347,13 +348,6 @@ Utilities
.. doxygenfunction:: fmt::group_digits(T value) -> group_digits_view<T>
.. doxygenclass:: fmt::detail::buffer
:members:
.. doxygenclass:: fmt::basic_memory_buffer
:protected-members:
:members:
System Errors
-------------
@ -400,6 +394,13 @@ normally don't do any allocations for built-in and string types except for
non-default floating-point formatting that occasionally falls back on
``sprintf``.
.. doxygenclass:: fmt::detail::buffer
:members:
.. doxygenclass:: fmt::basic_memory_buffer
:protected-members:
:members:
Locale
------
@ -509,6 +510,8 @@ Standard Library Types Formatting
* `std::monostate <https://en.cppreference.com/w/cpp/utility/variant/monostate>`_
* `std::variant <https://en.cppreference.com/w/cpp/utility/variant/variant>`_
* `std::optional <https://en.cppreference.com/w/cpp/utility/optional>`_
* `std::error_code <https://en.cppreference.com/w/cpp/error/error_code>`_
* `std::exception <https://en.cppreference.com/w/cpp/error/exception>`_
Formatting Variants
-------------------
@ -569,7 +572,6 @@ System APIs
:members:
.. doxygenfunction:: fmt::windows_error
:members:
.. _ostream-api:

View File

@ -41,8 +41,8 @@ div.sphinxsidebar {
text-align: center;
}
// Indent descriptions of classes, functions and macros.
.class dd, .function dd, .macro dd {
// Indent descriptions of classes, functions, macros, and structs.
.class dd, .function dd, .macro dd, .struct dd {
margin-left: 20px;
}
@ -56,6 +56,11 @@ div.sphinxsidebar {
padding: 0;
}
// Avoid the font size of API signatures being unnecessarily large.
code.descname {
font-size: 1em;
}
// Override center alignment in tables.
td {
text-align: left;

View File

@ -131,7 +131,7 @@ The library produces compact per-call compiled code. For example
compiles to just
.. code:: asm
.. code:: nasm
main: # @main
sub rsp, 24

View File

@ -21,13 +21,13 @@ __ https://github.com/fmtlib/fmt/blob/master/CMakeLists.txt
CMake works by generating native makefiles or project files that can
be used in the compiler environment of your choice. The typical
workflow starts with::
workflow starts with
mkdir build # Create a directory to hold the build output.
.. code:: sh
mkdir build # Create a directory to hold the build output.
cd build
cmake .. # Generate native build scripts.
where :file:`{<path/to/fmt>}` is a path to the ``fmt`` repository.
cmake .. # Generate native build scripts.
If you are on a \*nix system, you should now see a Makefile in the
current directory. Now you can build the library by running :command:`make`.
@ -146,7 +146,7 @@ system:
Ubuntu doesn't package the ``clean-css`` plugin so you should use ``npm``
instead of ``apt`` to install both ``less`` and the plugin::
sudo npm install -g less less-plugin-clean-css.
sudo npm install -g less less-plugin-clean-css
First generate makefiles or project files using CMake as described in
the previous section. Then compile the ``doc`` target/project, for example::

View File

@ -4126,7 +4126,7 @@ FMT_API auto vsystem_error(int error_code, string_view format_str,
\rst
Constructs :class:`std::system_error` with a message formatted with
``fmt::format(fmt, args...)``.
*error_code* is a system error code as given by ``errno``.
*error_code* is a system error code as given by ``errno``.
**Example**::