Browse Source

Fix named at-examples to not contain spaces, fixes #168.

pull/169/head
Fredrik Ekre 4 years ago
parent
commit
d279de8b03
  1. 5
      CHANGELOG.md
  2. 2
      src/Literate.jl
  3. 6
      test/runtests.jl

5
CHANGELOG.md

@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), @@ -6,6 +6,9 @@ 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).
## [Unreleased]
### Fixed
- Fix named `@examples` from `Literate.markdown` to not contain spaces even if the source
filename does. ([#168][github-168], [#169][github-169])
## [2.9.2] - 2021-08-16
### Fixed
@ -142,6 +145,8 @@ https://discourse.julialang.org/t/ann-literate-jl/10651 for release announcement @@ -142,6 +145,8 @@ https://discourse.julialang.org/t/ann-literate-jl/10651 for release announcement
[github-163]: https://github.com/fredrikekre/Literate.jl/pull/163
[github-165]: https://github.com/fredrikekre/Literate.jl/issues/165
[github-167]: https://github.com/fredrikekre/Literate.jl/pull/167
[github-168]: https://github.com/fredrikekre/Literate.jl/issues/168
[github-169]: https://github.com/fredrikekre/Literate.jl/pull/169
[Unreleased]: https://github.com/fredrikekre/Literate.jl/compare/v2.9.2...HEAD
[2.9.2]: https://github.com/fredrikekre/Literate.jl/compare/v2.9.1...v2.9.2

2
src/Literate.jl

@ -258,7 +258,7 @@ function create_configuration(inputfile; user_config, user_kwargs, type=nothing) @@ -258,7 +258,7 @@ function create_configuration(inputfile; user_config, user_kwargs, type=nothing)
cfg["execute"] = type === :md ? false : true
cfg["codefence"] = get(user_config, "flavor", cfg["flavor"]) isa DocumenterFlavor &&
!get(user_config, "execute", cfg["execute"]) ?
("````@example $(get(user_config, "name", cfg["name"]))" => "````") :
("````@example $(get(user_config, "name", replace(cfg["name"], r"\s" => "_")))" => "````") :
("````julia" => "````")
# Guess the package (or repository) root url
edit_commit = "master" # TODO: Make this configurable like Documenter?

6
test/runtests.jl

@ -834,6 +834,12 @@ end end @@ -834,6 +834,12 @@ end end
chunks, _ = Literate.preprocessor(inputfile, outdir; user_kwargs=pairs((; mdstrings=true)),
user_config=(), type=:md)
@test chunks[2].lines == ["" => "hello world", "" => "hej världen"]
# fredrikekre/Literate.jl#168
f = "file with space.jl"
write(f, "1 + 1")
Literate.markdown(f, outdir)
@test occursin("file_with_space", read(joinpath(outdir, "file with space.md"), String))
end
end
end end

Loading…
Cancel
Save