Skip to content

Commit 7602103

Browse files
danielwestevengj
authored andcommitted
Update annotated.jl docstrings according to #55741 (#56736)
Annotations now use a NamedTuple
1 parent a9b95f1 commit 7602103

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

base/strings/annotated.jl

+8-8
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ like [`string`](@ref) but preserves any annotations present in the arguments.
5555
5656
# Examples
5757
58-
```julia-repl
58+
```jldoctest; setup=:(using Base: AnnotatedString)
5959
julia> AnnotatedString("this is an example annotated string",
60-
[(1:18, :A => 1), (12:28, :B => 2), (18:35, :C => 3)])
60+
[(1:18, :A, 1), (12:28, :B, 2), (18:35, :C, 3)])
6161
"this is an example annotated string"
6262
```
6363
"""
@@ -87,8 +87,8 @@ AnnotatedChar(s::S, annotations::Vector{$Annotation})
8787
8888
# Examples
8989
90-
```julia-repl
91-
julia> AnnotatedChar('j', :label => 1)
90+
```jldoctest; setup=:(using Base: AnnotatedChar)
91+
julia> AnnotatedChar('j', [(:label, 1)])
9292
'j': ASCII/Unicode U+006A (category Ll: Letter, lowercase)
9393
```
9494
"""
@@ -232,11 +232,11 @@ See also [`AnnotatedString`](@ref) and [`AnnotatedChar`](@ref).
232232
233233
## Examples
234234
235-
```julia-repl
235+
```jldoctest; setup=:(using Base: AnnotatedString, annotatedstring)
236236
julia> annotatedstring("now a AnnotatedString")
237237
"now a AnnotatedString"
238238
239-
julia> annotatedstring(AnnotatedString("annotated", [(1:9, :label => 1)]), ", and unannotated")
239+
julia> annotatedstring(AnnotatedString("annotated", [(1:9, :label, 1)]), ", and unannotated")
240240
"annotated, and unannotated"
241241
```
242242
"""
@@ -344,7 +344,7 @@ end
344344
annotate!(str::AnnotatedString, [range::UnitRange{Int}], label::Symbol, value)
345345
annotate!(str::SubString{AnnotatedString}, [range::UnitRange{Int}], label::Symbol, value)
346346
347-
Annotate a `range` of `str` (or the entire string) with a labeled value (`label` => `value`).
347+
Annotate a `range` of `str` (or the entire string) with a labeled value `(label, value)`.
348348
To remove existing `label` annotations, use a value of `nothing`.
349349
350350
The order in which annotations are applied to `str` is semantically meaningful,
@@ -365,7 +365,7 @@ annotate!(s::SubString{<:AnnotatedString}, label::Symbol, @nospecialize(val::Any
365365
"""
366366
annotate!(char::AnnotatedChar, label::Symbol, value::Any)
367367
368-
Annotate `char` with the pair `label => value`.
368+
Annotate `char` with the labeled value `(label, value)`.
369369
"""
370370
annotate!(c::AnnotatedChar, label::Symbol, @nospecialize(val::Any)) =
371371
(push!(c.annotations, Annotation((; label, val))); c)

0 commit comments

Comments
 (0)