Skip to content
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

Use a generic description for non-GitHub hosts #804

Merged
merged 2 commits into from
Aug 29, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/Utilities/Utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ end
function repo_host_from_url(repoURL::String)
if occursin("bitbucket", repoURL)
return RepoBitbucket
elseif occursin("github", repoURL)
elseif occursin("github", repoURL) || isempty(repoURL)
return RepoGithub
elseif occursin("gitlab", repoURL)
return RepoGitlab
Expand Down
14 changes: 9 additions & 5 deletions src/Writers/HTMLWriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -420,18 +420,22 @@ function render_article(ctx, navnode)

topnav = nav(ul(header_links))

# Set the logo and name for the "Edit on.." button. We assume GitHub as a host.
host = "GitHub"
logo = "\uf09b"

# Set the logo and name for the "Edit on.." button.
host_type = Utilities.repo_host_from_url(ctx.doc.user.repo)
if host_type == Utilities.RepoGitlab
host = "GitLab"
logo = "\uf296"
elseif host_type == Utilities.RepoGithub
host = "GitHub"
logo = "\uf09b"
elseif host_type == Utilities.RepoBitbucket
host = "BitBucket"
logo = "\uf171"
else
host = ""
logo = "\uf15c"
end
hoststring = isempty(host) ? " source" : " on $(host)"

if !ctx.doc.user.html_disable_git
pageurl = get(getpage(ctx, navnode).globals.meta, :EditURL, getpage(ctx, navnode).source)
Expand All @@ -446,7 +450,7 @@ function render_article(ctx, navnode)
end
if url !== nothing
edit_verb = (ctx.doc.user.html_edit_branch === nothing) ? "View" : "Edit"
push!(topnav.nodes, a[".edit-page", :href => url](span[".fa"](logo), " $(edit_verb) on $host"))
push!(topnav.nodes, a[".edit-page", :href => url](span[".fa"](logo), " $(edit_verb)$hoststring"))
end
end
art_header = header(topnav, hr(), render_topbar(ctx, navnode))
Expand Down