📝 add titles to more admonitions
This commit is contained in:
parent
7f76374b48
commit
13e6f6c5e5
@ -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
|
||||
undefined behavior.
|
||||
|
||||
!!! danger
|
||||
!!! danger "Runtime assertion"
|
||||
|
||||
A precondition is enforced with a [runtime assertion](../../features/assertions.md).
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@ Depends on what `json_serializer<ValueType>` `from_json()` method throws
|
||||
|
||||
## Notes
|
||||
|
||||
!!! warning
|
||||
!!! danger "Undefined behavior"
|
||||
|
||||
Writing data to the pointee (overload 3) of the result yields an undefined state.
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ Constant.
|
||||
|
||||
## Notes
|
||||
|
||||
!!! warning
|
||||
!!! danger "Undefined behavior"
|
||||
|
||||
Writing data to the pointee of the result yields an undefined state.
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ Constant.
|
||||
|
||||
## Notes
|
||||
|
||||
!!! warning
|
||||
!!! danger "Undefined behavior"
|
||||
|
||||
Writing data to the referee of the result yields an undefined state.
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ Constant.
|
||||
|
||||
## Notes
|
||||
|
||||
!!! note
|
||||
!!! note "Comparisons"
|
||||
|
||||
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:
|
||||
@ -41,7 +41,7 @@ Constant.
|
||||
|
||||
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,
|
||||
then it is removed when it is part of a structured value. For instance, if the second value of an array is discarded,
|
||||
|
||||
@ -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
|
||||
(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
|
||||
<https://github.com/nlohmann/json/issues/2040> for more information.
|
||||
|
||||
@ -74,7 +74,7 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
||||
|
||||
## Notes
|
||||
|
||||
!!! danger
|
||||
!!! danger "Undefined behavior"
|
||||
|
||||
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
|
||||
|
||||
@ -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 [`operator[]`](operator[].md), this function does not implicitly add an element to the position defined by
|
||||
|
||||
@ -26,7 +26,7 @@ When the macro is not defined, the library will define it to its default value.
|
||||
|
||||
## 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
|
||||
across different compilation units; DO NOT link together code compiled with different definitions of
|
||||
|
||||
@ -17,7 +17,7 @@ By default, the macro is not defined.
|
||||
|
||||
## 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
|
||||
compatible.
|
||||
|
||||
@ -100,9 +100,9 @@ def check_structure():
|
||||
if line == '' and previous_line == '':
|
||||
report('whitespace/blank_lines', f'{file}:{lineno}-{lineno+1}', 'consecutive blank lines')
|
||||
|
||||
# check that admonitions have titles
|
||||
untitled_admonition = re.match(r'^(\?\?\?|!!!) (note|info)$', line)
|
||||
if untitled_admonition:
|
||||
# check that non-example admonitions have titles
|
||||
untitled_admonition = re.match(r'^(\?\?\?|!!!) ([^ ]+)$', line)
|
||||
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')
|
||||
|
||||
previous_line = line
|
||||
|
||||
Loading…
Reference in New Issue
Block a user