Skip to content

Show descriptions of data sets. #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/dataset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,19 @@ function dataset(package_name::AbstractString, dataset_name::AbstractString)
end
error("Unable to locate dataset file $rdaname or $csvname")
end

struct RDatasetsDescription
content::String
end
function description(package_name::AbstractString, dataset_name::AbstractString)
RDatasetsDescription(read(joinpath(@__DIR__, "..", "doc",
package_name, "$dataset_name.html"), String))
end
function Base.show(io::IO, mime::MIME"text/plain", d::RDatasetsDescription)
nohtml = replace(d.content, Regex("<[^>]*>") => "")
s = replace(nohtml, Regex("\n\n+") => "\n\n")
show(io, mime, Docs.Text(s))
end
function Base.show(io::IO, mime::MIME"text/html", d::RDatasetsDescription)
show(io, mime, HTML(d.content))
end
Loading