From 95779899e956ed11125801245ce73348ec5f9c00 Mon Sep 17 00:00:00 2001 From: lfenzo Date: Mon, 13 Nov 2023 19:23:35 -0300 Subject: [PATCH] docs: small fixes for docs --- docs/src/api_reference.md | 2 -- docs/src/index.md | 4 +-- src/providers/identity.jl | 51 ++++++++++++++++++--------------------- 3 files changed, 26 insertions(+), 31 deletions(-) diff --git a/docs/src/api_reference.md b/docs/src/api_reference.md index 3b97fe2..bdece29 100755 --- a/docs/src/api_reference.md +++ b/docs/src/api_reference.md @@ -22,9 +22,7 @@ Order = [:function] ```@index Pages = [ - "utilities/impostor_template.md", "utilities/templatization.md", - "utilities/utility_functions.md", ] Depth = 1 Order = [:function] diff --git a/docs/src/index.md b/docs/src/index.md index af138bf..1212b65 100755 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -101,8 +101,8 @@ In order to facilitate naming and referencing later on the major concepts implem | Implementation | Method Signature | Desctiption | |:---------------|:-----------------|:------------| | *Value-based* | `func(n::Int)` | Simply generate an output with `n` entries produced by `func`. | - | *Option-based* | `func(v::Vector, n::Int)` | Generates an output with `n` entries produced by `func` but **restricting the generated entries to specified options in `v`**, which specific contents will depend on `func`. Generator functions taking on options in different levels accept the `optionlevel` kwarg, when that is the case, docstrings will explain each specific behavior. | - | *Mask-based* | `func(v::Vector)` | Generates an output with `length(v)` entries produced by `func`. **The contents of `v` specify element-wise options to restrict the output of `func`.** Equivalent *in terms of output* with calling `[func(opt, 1) for opt in v]` (*i.e.* the option-based generation), but sub-optimal in terms of performance. Generator functions taking on masks in different levels accept the `masklevel` kwarg, when it is the case, docstrings will explain each specific behavior.| + | *Option-based* | `func(v::Vector, n::Int)` | Generates an output with `n` entries produced by `func` but **restricting the generated entries to specified options in `v`**, which specific contents will depend on `func`. Generator functions taking on options in different levels accept the `level` kwarg, when that is the case, docstrings will explain each specific behavior. | + | *Mask-based* | `func(v::Vector)` | Generates an output with `length(v)` entries produced by `func`. **The contents of `v` specify element-wise options to restrict the output of `func`.** Equivalent *in terms of output* with calling `[func(opt, 1) for opt in v]` (*i.e.* the option-based generation), but sub-optimal in terms of performance. Generator functions taking on masks in different levels accept the `level` kwarg, when it is the case, docstrings will explain each specific behavior.| ```@repl using Impostor # hide diff --git a/src/providers/identity.jl b/src/providers/identity.jl index 5c75d5c..a8d38c8 100644 --- a/src/providers/identity.jl +++ b/src/providers/identity.jl @@ -49,9 +49,9 @@ end """ - prefix(n::Integer = 1; kwargs...) - prefix(options::Vector{String}, n::Integer; kwargs...) - prefix(mask::Vector{<:AbstractString}; kwargs...) + prefix(n::Integer = 1; kws...) + prefix(options::Vector{String}, n::Integer; kws...) + prefix(mask::Vector{<:AbstractString}; kws...) Generate `n` name prefixes, *e.g.* `"Mr."` and `"Ms."`, from a given locale. @@ -70,7 +70,7 @@ The valid options values for `options` and `mask` are: # Example ```@juliarepl -julia> prefix(["female", "male", "female"]) +julia> prefix(["F", "M", "F"]) 3-element Vector{String}: "Ms." "Mr." @@ -105,9 +105,9 @@ end """ - firstname(n::Integer = 1; kwargs...) - firstname(sexes::Vector{<:AbstractString}, n::Integer; kwargs...) - firstname(sexes::Vector{<:AbstractString}; kargs...)) + firstname(n::Integer = 1; kws...) + firstname(sexes::Vector{<:AbstractString}, n::Integer; kws...) + firstname(sexes::Vector{<:AbstractString}; kws...)) Generate `n` or `length(mask)` first names. @@ -170,7 +170,7 @@ end """ - surname(n::Integer = 1; kwargs...) + surname(n::Integer = 1; kws...) Generate a `surname` using the provided `locale` as source. @@ -188,9 +188,9 @@ end """ - complete_name(n::Integer = 1; kwargs...) - complete_name(sexes::Vector{<:AbstractString}, n::Integer; kwargs...) - complete_name(sexes::Vector{<:AbstractString}; kwargs...) + complete_name(n::Integer = 1; kws...) + complete_name(options::Vector{<:AbstractString}, n::Integer; kws...) + complete_name(mask::Vector{<:AbstractString}; kws...) Generate `n` or `length(mask)` full (complete) names from a given locale. @@ -203,8 +203,8 @@ The valid options values for `options` and `mask` are: - `"F"` for "female" # Kwargs -- `max_surnames::Integer = 3`: maximum number of surnames in each of the generated entries, note that the actual number may be smaller than `max_surnames`. - `locale::Vector{String}`: locale(s) from which entries are sampled. If no `locale` is provided, the current session locale is used. +- `max_surnames::Integer = 3`: maximum number of surnames in each of the generated entries, note that the actual number may be smaller than `max_surnames`. # Examples ```@juliarepl @@ -225,10 +225,7 @@ julia> complete_name(["F", "M", "F", "F", "M"]) "Alfred Fraser Collins" ``` """ -function complete_name(n::Integer = 1; - max_surnames::Integer = 3, - locale = session_locale() -) +function complete_name(n::Integer = 1; locale = session_locale(), max_surnames::Integer = 3) complete_names = Vector{String}() for _ in 1:n fname = Impostor.firstname(; locale = locale) @@ -242,8 +239,8 @@ function complete_name(n::Integer = 1; end function complete_name(sexes::Vector{<:AbstractString}, n::Integer; + locale = session_locale(), max_surnames::Integer = 3, - locale = session_locale() ) complete_names = Vector{String}() for _ in 1:n @@ -258,8 +255,8 @@ function complete_name(sexes::Vector{<:AbstractString}, n::Integer; end function complete_name(mask::Vector{<:AbstractString}; + locale = session_locale(), max_surnames::Integer = 3, - locale = session_locale() ) complete_names = Vector{String}() for value in mask @@ -276,9 +273,9 @@ end """ - occupation(n::Integer = 1; kwargs...) - occupation(options::Vector{<:AbstractString}, n::Integer; kwargs...) - occupation(mask::Vector{<:AbstractString}; kwargs...) + occupation(n::Integer = 1; kws...) + occupation(options::Vector{<:AbstractString}, n::Integer; kws...) + occupation(mask::Vector{<:AbstractString}; kws...) Generate `n` or `length(mask)` occupation entries. @@ -328,9 +325,9 @@ end """ - university(n::Integer = 1; kwargs...) - university(fields::Vector{<:AbstractString}, n::Integer; kwargs...) - university(field_mask::Vector{<:AbstractString}; kwargs...) + university(n::Integer = 1; kws...) + university(fields::Vector{<:AbstractString}, n::Integer; kws...) + university(field_mask::Vector{<:AbstractString}; kws...) # Parameters - `n::Integer = 1`: number of university entries to generate. @@ -378,9 +375,9 @@ end """ - nationality(n::Integer = 1; kwargs...) - nationality(options::Vector{<:AbstractString}, n::Integer; level::Symbol, kwargs...) - nationality(mask::Vector{<:AbstractString}; level::Symbol, kwargs...) + nationality(n::Integer = 1; kws...) + nationality(options::Vector{<:AbstractString}, n::Integer; level::Symbol, kws...) + nationality(mask::Vector{<:AbstractString}; level::Symbol, kws...) # Parameters - `n::Integer = 1`: number of nationality entries to generate.