📝 add titles to more admonitions

This commit is contained in:
Niels Lohmann 2022-04-24 22:08:55 +02:00
parent 7f76374b48
commit 13e6f6c5e5
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
11 changed files with 14 additions and 14 deletions

View File

@ -256,7 +256,7 @@ basic_json(basic_json&& other) noexcept;
cases are detected; see the description of the exceptions above. A violation of this precondition yields cases are detected; see the description of the exceptions above. A violation of this precondition yields
undefined behavior. undefined behavior.
!!! danger !!! danger "Runtime assertion"
A precondition is enforced with a [runtime assertion](../../features/assertions.md). A precondition is enforced with a [runtime assertion](../../features/assertions.md).

View File

@ -90,7 +90,7 @@ Depends on what `json_serializer<ValueType>` `from_json()` method throws
## Notes ## Notes
!!! warning !!! danger "Undefined behavior"
Writing data to the pointee (overload 3) of the result yields an undefined state. Writing data to the pointee (overload 3) of the result yields an undefined state.

View File

@ -33,7 +33,7 @@ Constant.
## Notes ## Notes
!!! warning !!! danger "Undefined behavior"
Writing data to the pointee of the result yields an undefined state. Writing data to the pointee of the result yields an undefined state.

View File

@ -38,7 +38,7 @@ Constant.
## Notes ## Notes
!!! warning !!! danger "Undefined behavior"
Writing data to the referee of the result yields an undefined state. Writing data to the referee of the result yields an undefined state.

View File

@ -24,7 +24,7 @@ Constant.
## Notes ## Notes
!!! note !!! note "Comparisons"
Discarded values are never compared equal with [`operator==`](operator_eq.md). That is, checking whether a JSON Discarded values are never compared equal with [`operator==`](operator_eq.md). That is, checking whether a JSON
value `j` is discarded will only work via: value `j` is discarded will only work via:
@ -41,7 +41,7 @@ Constant.
will always be `#!cpp false`. will always be `#!cpp false`.
!!! note !!! note "Removal during parsing with callback functions"
When a value is discarded by a callback function (see [`parser_callback_t`](parser_callback_t.md)) during parsing, When a value is discarded by a callback function (see [`parser_callback_t`](parser_callback_t.md)) during parsing,
then it is removed when it is part of a structured value. For instance, if the second value of an array is discarded, then it is removed when it is part of a structured value. For instance, if the second value of an array is discarded,

View File

@ -63,7 +63,7 @@ Constant.
When iterating over an array, `key()` will return the index of the element as string (see example). For primitive types When iterating over an array, `key()` will return the index of the element as string (see example). For primitive types
(e.g., numbers), `key()` returns an empty string. (e.g., numbers), `key()` returns an empty string.
!!! warning !!! danger "Lifetime issues"
Using `items()` on temporary objects is dangerous. Make sure the object's lifetime exceeds the iteration. See Using `items()` on temporary objects is dangerous. Make sure the object's lifetime exceeds the iteration. See
<https://github.com/nlohmann/json/issues/2040> for more information. <https://github.com/nlohmann/json/issues/2040> for more information.

View File

@ -74,7 +74,7 @@ Strong exception safety: if an exception occurs, the original value stays intact
## Notes ## Notes
!!! danger !!! danger "Undefined behavior"
1. If the element with key `idx` does not exist, the behavior is undefined. 1. If the element with key `idx` does not exist, the behavior is undefined.
2. If the element with key `key` does not exist, the behavior is undefined and is **guarded by a 2. If the element with key `key` does not exist, the behavior is undefined and is **guarded by a

View File

@ -36,7 +36,7 @@ ValueType value(const json_pointer& ptr,
} }
``` ```
!!! note !!! note "Differences to `at` and `operator[]`"
- Unlike [`at`](at.md), this function does not throw if the given `key`/`ptr` was not found. - Unlike [`at`](at.md), this function does not throw if the given `key`/`ptr` was not found.
- Unlike [`operator[]`](operator[].md), this function does not implicitly add an element to the position defined by - Unlike [`operator[]`](operator[].md), this function does not implicitly add an element to the position defined by

View File

@ -26,7 +26,7 @@ When the macro is not defined, the library will define it to its default value.
## Notes ## Notes
!!! warning !!! danger "ODR violation"
As this macro changes the definition of the `basic_json` object, it MUST be defined in the same way globally, even As this macro changes the definition of the `basic_json` object, it MUST be defined in the same way globally, even
across different compilation units; DO NOT link together code compiled with different definitions of across different compilation units; DO NOT link together code compiled with different definitions of

View File

@ -17,7 +17,7 @@ By default, the macro is not defined.
## Notes ## Notes
!!! warning !!! danger "ABI compatibility"
Mixing different library versions in the same code can be a problem as the different versions may not be ABI Mixing different library versions in the same code can be a problem as the different versions may not be ABI
compatible. compatible.

View File

@ -100,9 +100,9 @@ def check_structure():
if line == '' and previous_line == '': if line == '' and previous_line == '':
report('whitespace/blank_lines', f'{file}:{lineno}-{lineno+1}', 'consecutive blank lines') report('whitespace/blank_lines', f'{file}:{lineno}-{lineno+1}', 'consecutive blank lines')
# check that admonitions have titles # check that non-example admonitions have titles
untitled_admonition = re.match(r'^(\?\?\?|!!!) (note|info)$', line) untitled_admonition = re.match(r'^(\?\?\?|!!!) ([^ ]+)$', line)
if untitled_admonition: if untitled_admonition and untitled_admonition.group(2) != 'example':
report('style/admonition_title', f'{file}:{lineno}', f'"{untitled_admonition.group(2)}" admonitions should have a title') report('style/admonition_title', f'{file}:{lineno}', f'"{untitled_admonition.group(2)}" admonitions should have a title')
previous_line = line previous_line = line