Refactoring: function argument destructuring
This commit is contained in:
parent
a6d7e1b8f0
commit
e4134063ea
|
@ -639,8 +639,7 @@ function htmlrender(q::Question, a::Answer)
|
||||||
end
|
end
|
||||||
|
|
||||||
show(io::IO, ::MIME"text/html", q::Question) = print(io, htmlrender(q, missing), '\n')
|
show(io::IO, ::MIME"text/html", q::Question) = print(io, htmlrender(q, missing), '\n')
|
||||||
function show(io::IO, ::MIME"text/html", qa::Pair{<:Question, <:Answer})
|
function show(io::IO, ::MIME"text/html", (q, a)::Pair{<:Question, <:Answer})
|
||||||
q, a = qa
|
|
||||||
print(io, htmlrender(q, a), '\n')
|
print(io, htmlrender(q, a), '\n')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -651,8 +650,7 @@ function Base.show(io::IO, m::MIME"text/html", part::SurveyPart)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function show(io::IO, m::MIME"text/html", pr::Pair{SurveyPart, Response})
|
function show(io::IO, m::MIME"text/html", (part, response)::Pair{SurveyPart, Response})
|
||||||
part, response = pr
|
|
||||||
foreach(part.questions) do q
|
foreach(part.questions) do q
|
||||||
show(io, m, q => response[q.id])
|
show(io, m, q => response[q.id])
|
||||||
q === last(part.questions) || print(io, br(), '\n')
|
q === last(part.questions) || print(io, br(), '\n')
|
||||||
|
@ -685,8 +683,7 @@ function show(io::IO, ::MIME"text/plain", a::Answer)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function show(io::IO, m::MIME"text/plain", qa::Pair{<:Question, <:Answer})
|
function show(io::IO, m::MIME"text/plain", (q, a)::Pair{<:Question, <:Answer})
|
||||||
q, a = qa
|
|
||||||
show(io, m, q)
|
show(io, m, q)
|
||||||
print(io, '\n')
|
print(io, '\n')
|
||||||
show(io, m, a)
|
show(io, m, a)
|
||||||
|
@ -706,8 +703,7 @@ function show(io::IO, m::MIME"text/plain", part::SurveyPart)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function show(io::IO, m::MIME"text/plain", pr::Pair{SurveyPart, Response})
|
function show(io::IO, m::MIME"text/plain", (part, response)::Pair{SurveyPart, Response})
|
||||||
part, response = pr
|
|
||||||
printstyled(io, " -- ", if isnothing(part.label)
|
printstyled(io, " -- ", if isnothing(part.label)
|
||||||
"Unlabeled part"
|
"Unlabeled part"
|
||||||
else part.label end, " --\n", color=:yellow)
|
else part.label end, " --\n", color=:yellow)
|
||||||
|
@ -727,8 +723,7 @@ function show(io::IO, m::MIME"text/plain", s::Survey)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function show(io::IO, m::MIME"text/plain", sr::Pair{Survey, Response})
|
function show(io::IO, m::MIME"text/plain", (s, response)::Pair{Survey, Response})
|
||||||
s, response = sr
|
|
||||||
printstyled(io, " ", s.name, "\n\n", color=:magenta)
|
printstyled(io, " ", s.name, "\n\n", color=:magenta)
|
||||||
parts = [s[p] for p in 1:length(s)]
|
parts = [s[p] for p in 1:length(s)]
|
||||||
for part in parts
|
for part in parts
|
||||||
|
|
Loading…
Reference in New Issue