Browse Source

Pkg.dir => Base.find_package, what could possibly go wrong?

pull/14/head
Fredrik Ekre 8 years ago
parent
commit
dda710a067
  1. 20
      src/Literate.jl

20
src/Literate.jl

@ -319,11 +319,25 @@ function markdown(inputfile, outputdir; preprocess = identity, postprocess = ide
# run some Documenter specific things # run some Documenter specific things
if documenter if documenter
# change the Edit on GitHub link # change the Edit on GitHub link
repo = get(ENV, "TRAVIS_REPO_SLUG", "") repo = get(ENV, "TRAVIS_REPO_SLUG", nothing)
pkg = first(split(last(split(repo, '/')), '.')) if repo === nothing
println("repo === nothing")
path = ""
else
pkg = String(first(split(last(split(repo, '/')), '.')))
pkgsrc = Base.find_package(pkg)
if pkgsrc === nothing
println("pkgsrc === nothing")
path = ""
else
repo_root = first(split(pkgsrc, "src/" * pkg * ".jl"))
path = relpath(inputfile, repo_root)
path = replace(path, "\\" => "/")
end
end
content = """ content = """
# ```@meta # ```@meta
# EditURL = "@__REPO_ROOT_URL__$(replace(relpath(inputfile, Pkg.dir(pkg)), "\\" => "/"))" # EditURL = "@__REPO_ROOT_URL__$(path)"
# ``` # ```
""" * content """ * content

Loading…
Cancel
Save