Skip to content

Commit

Permalink
Use a generic description for non-GitHub hosts (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
tribut authored and mortenpi committed Aug 29, 2018
1 parent ec33b90 commit a388bd1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
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

0 comments on commit a388bd1

Please sign in to comment.