Browse Source

Merge remote-tracking branch 'upstream/master' into add-quarto-support

pull/200/head
J S 2 years ago
parent
commit
ac9a21afb2
  1. 12
      CHANGELOG.md
  2. 2
      Project.toml
  3. 617
      docs/Manifest.toml
  4. 2
      docs/src/pipeline.md
  5. 18
      src/Literate.jl
  6. 14
      test/runtests.jl

12
CHANGELOG.md

@ -5,7 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] <!-- ## [Unreleased] -->
## [2.14.1] - 2023-08-04
### Fixed
- Update generated `EditURL` to use a relative path instead and let Documenter figure out
the remote repository. This is required for Documenter version 1, but works also on
Documenter 0.27. ([#219][github-219])
## [2.14.0] - 2022-09-22 ## [2.14.0] - 2022-09-22
### Changed ### Changed
@ -240,8 +246,10 @@ https://discourse.julialang.org/t/ann-literate-jl/10651 for release announcement
[github-197]: https://github.com/fredrikekre/Literate.jl/issues/197 [github-197]: https://github.com/fredrikekre/Literate.jl/issues/197
[github-204]: https://github.com/fredrikekre/Literate.jl/issues/204 [github-204]: https://github.com/fredrikekre/Literate.jl/issues/204
[github-205]: https://github.com/fredrikekre/Literate.jl/pull/205 [github-205]: https://github.com/fredrikekre/Literate.jl/pull/205
[github-219]: https://github.com/fredrikekre/Literate.jl/pull/219
[Unreleased]: https://github.com/fredrikekre/Literate.jl/compare/v2.14.0...HEAD [Unreleased]: https://github.com/fredrikekre/Literate.jl/compare/v2.14.1...HEAD
[2.14.1]: https://github.com/fredrikekre/Literate.jl/compare/v2.14.0...v2.14.1
[2.14.0]: https://github.com/fredrikekre/Literate.jl/compare/v2.13.3...v2.14.0 [2.14.0]: https://github.com/fredrikekre/Literate.jl/compare/v2.13.3...v2.14.0
[2.13.4]: https://github.com/fredrikekre/Literate.jl/compare/v2.13.3...v2.13.4 [2.13.4]: https://github.com/fredrikekre/Literate.jl/compare/v2.13.3...v2.13.4
[2.13.3]: https://github.com/fredrikekre/Literate.jl/compare/v2.13.2...v2.13.3 [2.13.3]: https://github.com/fredrikekre/Literate.jl/compare/v2.13.2...v2.13.3

2
Project.toml

@ -1,6 +1,6 @@
name = "Literate" name = "Literate"
uuid = "98b081ad-f1c9-55d3-8b20-4c87d4299306" uuid = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
version = "2.14.0" version = "2.14.1"
[deps] [deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

617
docs/Manifest.toml

File diff suppressed because it is too large Load Diff

2
docs/src/pipeline.md

@ -143,4 +143,4 @@ The last step of the generation is writing to file. The result is written to
by the user (for example `docs/generated`), and `name` is a user supplied filename. by the user (for example `docs/generated`), and `name` is a user supplied filename.
It is recommended to add the output directory to `.gitignore` since the idea is that It is recommended to add the output directory to `.gitignore` since the idea is that
the generated documents will be generated as part of the build process rather than the generated documents will be generated as part of the build process rather than
beeing files in the repo. being files in the repo.

18
src/Literate.jl

@ -356,9 +356,6 @@ function create_configuration(inputfile; user_config, user_kwargs, type=nothing)
cfg["repo_root_url"] = "https://github.com/$(repo_slug)/blob/$(cfg["edit_commit"])" cfg["repo_root_url"] = "https://github.com/$(repo_slug)/blob/$(cfg["edit_commit"])"
cfg["nbviewer_root_url"] = "https://nbviewer.jupyter.org/github/$(repo_slug)/blob/$(deploy_branch)/$(deploy_folder)" cfg["nbviewer_root_url"] = "https://nbviewer.jupyter.org/github/$(repo_slug)/blob/$(deploy_branch)/$(deploy_folder)"
cfg["binder_root_url"] = "https://mybinder.org/v2/gh/$(repo_slug)/$(deploy_branch)?filepath=$(deploy_folder)" cfg["binder_root_url"] = "https://mybinder.org/v2/gh/$(repo_slug)/$(deploy_branch)?filepath=$(deploy_folder)"
if (dir = get(ENV, "TRAVIS_BUILD_DIR", nothing)) !== nothing
cfg["repo_root_path"] = dir
end
elseif haskey(ENV, "GITHUB_ACTIONS") elseif haskey(ENV, "GITHUB_ACTIONS")
repo_slug = get(ENV, "GITHUB_REPOSITORY", "unknown-repository") repo_slug = get(ENV, "GITHUB_REPOSITORY", "unknown-repository")
deploy_folder = if get(ENV, "GITHUB_EVENT_NAME", nothing) == "push" deploy_folder = if get(ENV, "GITHUB_EVENT_NAME", nothing) == "push"
@ -375,9 +372,6 @@ function create_configuration(inputfile; user_config, user_kwargs, type=nothing)
cfg["repo_root_url"] = "https://github.com/$(repo_slug)/blob/$(cfg["edit_commit"])" cfg["repo_root_url"] = "https://github.com/$(repo_slug)/blob/$(cfg["edit_commit"])"
cfg["nbviewer_root_url"] = "https://nbviewer.jupyter.org/github/$(repo_slug)/blob/$(deploy_branch)/$(deploy_folder)" cfg["nbviewer_root_url"] = "https://nbviewer.jupyter.org/github/$(repo_slug)/blob/$(deploy_branch)/$(deploy_folder)"
cfg["binder_root_url"] = "https://mybinder.org/v2/gh/$(repo_slug)/$(deploy_branch)?filepath=$(deploy_folder)" cfg["binder_root_url"] = "https://mybinder.org/v2/gh/$(repo_slug)/$(deploy_branch)?filepath=$(deploy_folder)"
if (dir = get(ENV, "GITHUB_WORKSPACE", nothing)) !== nothing
cfg["repo_root_path"] = dir
end
elseif haskey(ENV, "GITLAB_CI") elseif haskey(ENV, "GITLAB_CI")
if (url = get(ENV, "CI_PROJECT_URL", nothing)) !== nothing if (url = get(ENV, "CI_PROJECT_URL", nothing)) !== nothing
cfg["repo_root_url"] = "$(url)/blob/$(cfg["edit_commit"])" cfg["repo_root_url"] = "$(url)/blob/$(cfg["edit_commit"])"
@ -386,9 +380,6 @@ function create_configuration(inputfile; user_config, user_kwargs, type=nothing)
(m = match(r"https://(.+)", url)) !== nothing (m = match(r"https://(.+)", url)) !== nothing
cfg["nbviewer_root_url"] = "https://nbviewer.jupyter.org/urls/$(m[1])" cfg["nbviewer_root_url"] = "https://nbviewer.jupyter.org/urls/$(m[1])"
end end
if (dir = get(ENV, "CI_PROJECT_DIR", nothing)) !== nothing
cfg["repo_root_path"] = dir
end
end end
# Merge default_config with user_config # Merge default_config with user_config
@ -436,9 +427,6 @@ Available options:
- `binder_root_url`: URL to the root of the repository as seen on mybinder. Determined - `binder_root_url`: URL to the root of the repository as seen on mybinder. Determined
automatically on Travis CI, GitHub Actions and GitLab CI. automatically on Travis CI, GitHub Actions and GitLab CI.
Used for `@__BINDER_ROOT_URL__`. Used for `@__BINDER_ROOT_URL__`.
- `repo_root_path`: Filepath to the root of the repository. Determined automatically on
Travis CI, GitHub Actions and GitLab CI. Used for computing
[Documenters `EditURL`](@ref Interaction-with-Documenter).
- `image_formats`: A vector of `(mime, ext)` tuples, with the default - `image_formats`: A vector of `(mime, ext)` tuples, with the default
`$(_DEFAULT_IMAGE_FORMATS)`. Results which are `showable` with a MIME type are saved with `$(_DEFAULT_IMAGE_FORMATS)`. Results which are `showable` with a MIME type are saved with
the first match, with the corresponding extension. the first match, with the corresponding extension.
@ -483,11 +471,11 @@ function preprocessor(inputfile, outputdir; user_config, user_kwargs, type)
# run some Documenter specific things for markdown output # run some Documenter specific things for markdown output
if type === :md && isdocumenter(config) if type === :md && isdocumenter(config)
# change the Edit on GitHub link # change the Edit on GitHub link
path = relpath(inputfile, get(config, "repo_root_path", pwd())::String) edit_url = relpath(inputfile, config["literate_outputdir"])
path = replace(path, "\\" => "/") edit_url = replace(edit_url, "\\" => "/")
content = """ content = """
# ```@meta # ```@meta
# EditURL = "@__REPO_ROOT_URL__/$(path)" # EditURL = "$(edit_url)"
# ``` # ```
""" * content """ * content

14
test/runtests.jl

@ -518,7 +518,7 @@ end end
end end
expected_markdown = """ expected_markdown = """
```@meta ```@meta
EditURL = "https://github.com/fredrikekre/Literate.jl/blob/master/test/$(basename(sandbox))/inputfile.jl" EditURL = "../inputfile.jl"
``` ```
# [Example](@id example-id) # [Example](@id example-id)
@ -649,7 +649,7 @@ end end
@test occursin("Link to repo root: https://github.com/fredrikekre/Literate.jl/blob/master/file.jl", markdown) @test occursin("Link to repo root: https://github.com/fredrikekre/Literate.jl/blob/master/file.jl", markdown)
@test occursin("Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/previews/PR42/file.jl", markdown) @test occursin("Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/previews/PR42/file.jl", markdown)
@test occursin("Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=previews/PR42/file.jl", markdown) @test occursin("Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=previews/PR42/file.jl", markdown)
@test occursin("EditURL = \"https://github.com/fredrikekre/Literate.jl/blob/master/test/$(basename(sandbox))/inputfile.jl\"", markdown) @test occursin("EditURL = \"../inputfile.jl\"", markdown)
# Travis with no tag -> dev directory # Travis with no tag -> dev directory
withenv(TRAVIS_ENV..., withenv(TRAVIS_ENV...,
@ -660,7 +660,7 @@ end end
@test occursin("Link to repo root: https://github.com/fredrikekre/Literate.jl/blob/master/file.jl", markdown) @test occursin("Link to repo root: https://github.com/fredrikekre/Literate.jl/blob/master/file.jl", markdown)
@test occursin("Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/dev/file.jl", markdown) @test occursin("Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/dev/file.jl", markdown)
@test occursin("Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=dev/file.jl", markdown) @test occursin("Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=dev/file.jl", markdown)
@test occursin("EditURL = \"https://github.com/fredrikekre/Literate.jl/blob/master/test/$(basename(sandbox))/inputfile.jl\"", markdown) @test occursin("EditURL = \"../inputfile.jl\"", markdown)
# GitHub Actions with a tag # GitHub Actions with a tag
withenv(ACTIONS_ENV...) do withenv(ACTIONS_ENV...) do
@ -670,7 +670,7 @@ end end
@test occursin("Link to repo root: https://github.com/fredrikekre/Literate.jl/blob/master/file.jl", markdown) @test occursin("Link to repo root: https://github.com/fredrikekre/Literate.jl/blob/master/file.jl", markdown)
@test occursin("Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.2.0/file.jl", markdown) @test occursin("Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.2.0/file.jl", markdown)
@test occursin("Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=v1.2.0/file.jl", markdown) @test occursin("Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=v1.2.0/file.jl", markdown)
@test occursin("EditURL = \"https://github.com/fredrikekre/Literate.jl/blob/master/test/$(basename(sandbox))/inputfile.jl\"", markdown) @test occursin("EditURL = \"../inputfile.jl\"", markdown)
# GitHub Actions with PR preview build # GitHub Actions with PR preview build
withenv(ACTIONS_ENV..., withenv(ACTIONS_ENV...,
@ -682,7 +682,7 @@ end end
@test occursin("Link to repo root: https://github.com/fredrikekre/Literate.jl/blob/master/file.jl", markdown) @test occursin("Link to repo root: https://github.com/fredrikekre/Literate.jl/blob/master/file.jl", markdown)
@test occursin("Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/previews/PR42/file.jl", markdown) @test occursin("Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/previews/PR42/file.jl", markdown)
@test occursin("Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=previews/PR42/file.jl", markdown) @test occursin("Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=previews/PR42/file.jl", markdown)
@test occursin("EditURL = \"https://github.com/fredrikekre/Literate.jl/blob/master/test/$(basename(sandbox))/inputfile.jl\"", markdown) @test occursin("EditURL = \"../inputfile.jl\"", markdown)
# GitHub Actions without a tag -> dev directory # GitHub Actions without a tag -> dev directory
withenv(ACTIONS_ENV..., withenv(ACTIONS_ENV...,
@ -693,7 +693,7 @@ end end
@test occursin("Link to repo root: https://github.com/fredrikekre/Literate.jl/blob/master/file.jl", markdown) @test occursin("Link to repo root: https://github.com/fredrikekre/Literate.jl/blob/master/file.jl", markdown)
@test occursin("Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/dev/file.jl", markdown) @test occursin("Link to nbviewer: https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/dev/file.jl", markdown)
@test occursin("Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=dev/file.jl", markdown) @test occursin("Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=dev/file.jl", markdown)
@test occursin("EditURL = \"https://github.com/fredrikekre/Literate.jl/blob/master/test/$(basename(sandbox))/inputfile.jl\"", markdown) @test occursin("EditURL = \"../inputfile.jl\"", markdown)
# GitLab CI with GitLab Pages # GitLab CI with GitLab Pages
withenv(GITLAB_ENV...) do withenv(GITLAB_ENV...) do
@ -703,7 +703,7 @@ end end
@test occursin("Link to repo root: https://gitlab.com/fredrikekre/Literate.jl/blob/master/file.jl", markdown) @test occursin("Link to repo root: https://gitlab.com/fredrikekre/Literate.jl/blob/master/file.jl", markdown)
@test occursin("Link to nbviewer: https://nbviewer.jupyter.org/urls/fredrikekre.gitlab.io/Literate.jl/file.jl", markdown) @test occursin("Link to nbviewer: https://nbviewer.jupyter.org/urls/fredrikekre.gitlab.io/Literate.jl/file.jl", markdown)
@test_broken occursin("Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=dev/file.jl", markdown) @test_broken occursin("Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=dev/file.jl", markdown)
@test occursin("EditURL = \"https://gitlab.com/fredrikekre/Literate.jl/blob/master/test/$(basename(sandbox))/inputfile.jl\"", markdown) @test occursin("EditURL = \"../inputfile.jl\"", markdown)
# building under DocumentationGenerator.jl # building under DocumentationGenerator.jl
withenv("DOCUMENTATIONGENERATOR" => "true", withenv("DOCUMENTATIONGENERATOR" => "true",

Loading…
Cancel
Save