Skip to content

Commit

Permalink
Bump Julia require to 0.7, stop testing on 0.6. (#795)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre authored Aug 15, 2018
1 parent fe8a644 commit 8a56ec8
Show file tree
Hide file tree
Showing 43 changed files with 130 additions and 206 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ os:
- osx

julia:
- 0.6
- 0.7
- 1.0
- nightly
Expand Down
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@

*A documentation generator for Julia.*

| **Documentation** | **PackageEvaluator** | **Build Status** |
|:-------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------:|
| [![][docs-stable-img]][docs-stable-url] [![][docs-latest-img]][docs-latest-url] | [![][pkg-0.6-img]][pkg-0.6-url] [![][pkg-0.7-img]][pkg-0.7-url] | [![][travis-img]][travis-url] [![][appveyor-img]][appveyor-url] [![][codecov-img]][codecov-url] |
| **Documentation** | **Build Status** |
|:-------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------:|
| [![][docs-stable-img]][docs-stable-url] [![][docs-latest-img]][docs-latest-url] | [![][travis-img]][travis-url] [![][appveyor-img]][appveyor-url] [![][codecov-img]][codecov-url] |


## Installation

The package is registered in `METADATA.jl` and can be installed with `Pkg.add`.
The package can be installed with Julias package manager:

```julia
julia> import Pkg

julia> Pkg.add("Documenter")
```

Expand All @@ -23,9 +25,9 @@ julia> Pkg.add("Documenter")

## Project Status

The package is tested against Julia `0.6` and *current* `0.7-dev` on Linux, OS X, and Windows.
The package is tested against Julia `0.7`, `1.0` and *current* `1.1-dev` on Linux, OS X, and Windows.

Support for Julia `0.4` and `0.5` has been dropped in the latest version, but older versions of Documenter may still work with those Julia versions (the `0.8` and `0.11` branches for either Julia version, respectively).
Support for Julia `0.4`, `0.5` and `0.6` has been dropped in the latest version, but older versions of Documenter may still work with those Julia versions (the `0.8`, `0.11` and `0.19` branches for Julia versions `0.4`, `0.5` and `0.6`, respectively).

## Questions and Contributions

Expand Down Expand Up @@ -53,8 +55,3 @@ Contributions are very welcome, as are feature requests and suggestions. Please
[codecov-url]: https://codecov.io/gh/JuliaDocs/Documenter.jl

[issues-url]: https://github.com/JuliaDocs/Documenter.jl/issues

[pkg-0.6-img]: http://pkg.julialang.org/badges/Documenter_0.6.svg
[pkg-0.6-url]: http://pkg.julialang.org/?pkg=Documenter&ver=0.6
[pkg-0.7-img]: http://pkg.julialang.org/badges/Documenter_0.7.svg
[pkg-0.7-url]: http://pkg.julialang.org/?pkg=Documenter&ver=0.7
3 changes: 1 addition & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
julia 0.6
Compat 0.70.0 # reduce(; init=...) / Compat#590
julia 0.7
DocStringExtensions 0.2
1 change: 0 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
environment:
matrix:
- julia_version: 0.6
- julia_version: 0.7
- julia_version: 1.0
- julia_version: latest
Expand Down
4 changes: 2 additions & 2 deletions docs/src/man/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ Code blocks may have some content that does not need to be displayed in the fina

````markdown
```@example
using Compat.Random # hide
srand(1) # hide
import Random # hide
Random.seed!(1) # hide
A = rand(3, 3)
b = [1, 2, 3]
A \ b
Expand Down
2 changes: 1 addition & 1 deletion src/Anchors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Defines the [`Anchor`](@ref) and [`AnchorMap`](@ref) types.
"""
module Anchors

using Compat, DocStringExtensions
using DocStringExtensions

# Types.
# ------
Expand Down
4 changes: 2 additions & 2 deletions src/Builder.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import ..Documenter:

import .Utilities: Selectors

using Compat, DocStringExtensions
using DocStringExtensions

# Document Pipeline.
# ------------------
Expand Down Expand Up @@ -109,7 +109,7 @@ function Selectors.runner(::Type{SetupBuildDirectory}, doc::Documents.Document)
push!(mdpages, Utilities.srcpath(source, root, file))
Documents.addpage!(doc, src, dst)
else
Compat.cp(src, dst; force = true)
cp(src, dst; force = true)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions src/CrossReferences.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import ..Documenter:
Documenter,
Utilities

using Compat, DocStringExtensions
import Compat.Markdown
using DocStringExtensions
import Markdown

"""
$(SIGNATURES)
Expand Down
6 changes: 3 additions & 3 deletions src/Deps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Deps

export pip

using Compat, DocStringExtensions
using DocStringExtensions

"""
$(SIGNATURES)
Expand Down Expand Up @@ -37,8 +37,8 @@ end


function localbin()
Compat.Sys.islinux() ? joinpath(homedir(), ".local", "bin") :
Compat.Sys.isapple() ? joinpath(homedir(), "Library", "Python", "2.7", "bin") : ""
Sys.islinux() ? joinpath(homedir(), ".local", "bin") :
Sys.isapple() ? joinpath(homedir(), "Library", "Python", "2.7", "bin") : ""
end

function updatepath!(p = localbin())
Expand Down
13 changes: 6 additions & 7 deletions src/DocChecks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ module DocChecks

import ..Documenter:
Documents,
Utilities,
IdDict
Utilities

using Compat, DocStringExtensions
import Compat: Markdown
using DocStringExtensions
import Markdown

# Missing docstrings.
# -------------------
Expand All @@ -37,7 +36,7 @@ function missingdocs(doc::Documents.Document)
end
end
end
n = Compat.reduce(+, map(length, values(bindings)), init=0)
n = reduce(+, map(length, values(bindings)), init=0)
if n > 0
b = IOBuffer()
println(b, "$n docstring$(n 1 ? "" : "s") potentially missing:\n")
Expand All @@ -61,7 +60,7 @@ end

function allbindings(checkdocs::Symbol, mod::Module, out = Dict{Utilities.Binding, Set{Type}}())
for (obj, doc) in meta(mod)
isa(obj, IdDict) && continue
isa(obj, IdDict{Any,Any}) && continue
name = nameof(obj)
isexported = Base.isexported(mod, name)
if checkdocs === :all || (isexported && checkdocs === :exports)
Expand All @@ -76,7 +75,7 @@ meta(m) = Docs.meta(m)
nameof(x::Function) = typeof(x).name.mt.name
nameof(b::Base.Docs.Binding) = b.var
nameof(x::DataType) = x.name.name
nameof(m::Module) = Compat.nameof(m)
nameof(m::Module) = nameof(m)

sigs(x::Base.Docs.MultiDoc) = x.order
sigs(::Any) = Type[Union{}]
Expand Down
19 changes: 9 additions & 10 deletions src/DocSystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ docsystem in both `0.4` and `0.5`.
"""
module DocSystem

using Compat, DocStringExtensions
import Compat.Markdown
using DocStringExtensions
import Markdown
import Base.Docs: MultiDoc, parsedoc, formatdoc, DocStr
import ..IdDict

## Bindings ##

Expand Down Expand Up @@ -43,7 +42,7 @@ binding(f::Function) = binding(typeof(f).name.module, typeof(f).name.mt.name
#
# Note that `IntrinsicFunction` is exported from `Base` in `0.4`, but not in `0.5`.
#
let INTRINSICS = Dict(map(s -> getfield(Core.Intrinsics, s) => s, Compat.names(Core.Intrinsics, all=true)))
let INTRINSICS = Dict(map(s -> getfield(Core.Intrinsics, s) => s, names(Core.Intrinsics, all=true)))
global binding(i::Core.IntrinsicFunction) = binding(Core.Intrinsics, INTRINSICS[i]::Symbol)
end

Expand Down Expand Up @@ -78,7 +77,7 @@ binding(m::Module, λ::Any) = binding(λ)

function signature(x, str::AbstractString)
ts = Base.Docs.signature(x)
(Meta.isexpr(x, :macrocall, 1 + Compat.macros_have_sourceloc) && !endswith(strip(str), "()")) ? :(Union{}) : ts
(Meta.isexpr(x, :macrocall, 2) && !endswith(strip(str), "()")) ? :(Union{}) : ts
end

## Docstring containers. ##
Expand Down Expand Up @@ -143,19 +142,19 @@ Converts a `0.4`-style docstring cache into a `0.5` one.
The original docstring cache is not modified.
"""
function convertmeta(meta::IdDict)
function convertmeta(meta::IdDict{Any,Any})
if !haskey(CACHED, meta)
docs = IdDict()
docs = IdDict{Any,Any}()
for (k, v) in meta
if !isa(k, Union{Number, AbstractString, IdDict})
if !isa(k, Union{Number, AbstractString, IdDict{Any,Any}})
docs[binding(k)] = multidoc(v)
end
end
CACHED[meta] = docs
end
CACHED[meta]::IdDict
CACHED[meta]::IdDict{Any,Any}
end
const CACHED = IdDict()
const CACHED = IdDict{Any,Any}()


## Get docs from modules.
Expand Down
20 changes: 9 additions & 11 deletions src/DocTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ Provides the [`doctest`](@ref) function that makes sure that the `jldoctest` cod
in the documents and docstrings run and are up to date.
"""
module DocTests
using Compat
using DocStringExtensions

import ..Documenter:
Documenter,
Documents,
Utilities,
IdDict
Utilities

import Compat: Markdown
import Markdown, REPL

# Julia code block testing.
# -------------------------
Expand All @@ -26,7 +24,7 @@ function find_codeblock_in_file(code, file)
content = replace(content, "\r\n" => "\n")
# make a regex of the code that matches leading whitespace
rcode = "\\h*" * replace(regex_escape(code), "\\n" => "\\n\\h*")
blockidx = Compat.findfirst(Regex(rcode), content)
blockidx = findfirst(Regex(rcode), content)
if blockidx !== nothing
startline = countlines(IOBuffer(content[1:prevind(content, first(blockidx))]))
endline = startline + countlines(IOBuffer(code)) + 1 # +1 to include the closing ```
Expand Down Expand Up @@ -78,7 +76,7 @@ function doctest(block::Markdown.Code, meta::Dict, doc::Documents.Document, page

# parse keyword arguments to doctest
d = Dict()
idx = Compat.findfirst(c -> c == ';', lang)
idx = findfirst(c -> c == ';', lang)
if idx !== nothing
kwargs = Meta.parse("($(lang[nextind(lang, idx):end]),)")
for kwarg in kwargs.args
Expand Down Expand Up @@ -158,7 +156,7 @@ function eval_repl(block, sandbox, meta::Dict, doc::Documents.Document, page)
result = Result(block, input, output, meta[:CurrentFile])
for (ex, str) in Utilities.parseblock(input, doc, page; keywords = false)
# Input containing a semi-colon gets suppressed in the final output.
result.hide = Documenter.REPL.ends_with_semicolon(str)
result.hide = REPL.ends_with_semicolon(str)
(value, success, backtrace, text) = Utilities.withoutput() do
disable_color() do
Core.eval(sandbox, ex)
Expand Down Expand Up @@ -278,7 +276,7 @@ funcsym() = CAN_INLINE[] ? :disable_color : :eval
function error_to_string(buf, er, bt)
fs = funcsym()
# Remove unimportant backtrace info.
index = Compat.findlast(ptr -> Documenter.ip_matches_func(ptr, fs), bt)
index = findlast(ptr -> Base.ip_matches_func(ptr, fs), bt)
# Print a REPL-like error message.
disable_color() do
print(buf, "ERROR: ")
Expand Down Expand Up @@ -335,12 +333,12 @@ function fix_doctest(result::Result, str, doc::Documents.Document)
# read the file containing the code block
content = read(filename, String)
# output stream
io = Compat.IOBuffer(sizehint = sizeof(content))
io = IOBuffer(sizehint = sizeof(content))
# first look for the entire code block
# make a regex of the code that matches leading whitespace
rcode = "(\\h*)" * replace(regex_escape(code), "\\n" => "\\n\\h*")
r = Regex(rcode)
codeidx = Compat.findfirst(r, content)
codeidx = findfirst(r, content)
if codeidx === nothing
Utilities.warn("Could not find code block in source file")
return
Expand All @@ -353,7 +351,7 @@ function fix_doctest(result::Result, str, doc::Documents.Document)
# make a regex of the input that matches leading whitespace (for multiline input)
rinput = "\\h*" * replace(regex_escape(result.input), "\\n" => "\\n\\h*")
r = Regex(rinput)
inputidx = Compat.findfirst(r, code)
inputidx = findfirst(r, code)
if inputidx === nothing
Utilities.warn("Could not find input line in code block")
return
Expand Down
33 changes: 8 additions & 25 deletions src/Documenter.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
__precompile__(true)

"""
Main module for `Documenter.jl` -- a documentation generation package for Julia.
Expand All @@ -16,24 +14,9 @@ $(EXPORTS)
"""
module Documenter

using Compat, DocStringExtensions
import Compat.Base64: base64decode
import Compat: @info
import Compat.Pkg

@static if VERSION < v"0.7.0-DEV.3439"
const IdDict = Base.ObjectIdDict
else
const IdDict = Base.IdDict{Any,Any}
end

@static if VERSION < v"0.7.0-DEV.3500"
import Base.REPL
using Base.REPL: ip_matches_func
else
import REPL
using Base: ip_matches_func
end
using DocStringExtensions
import Base64: base64decode
import Pkg

# Submodules
# ----------
Expand Down Expand Up @@ -387,7 +370,7 @@ function deploydocs(;

# Sanity checks
if !isempty(travis_repo_slug) && !occursin(travis_repo_slug, repo)
Compat.@warn("repo $repo does not match $travis_repo_slug")
@warn("repo $repo does not match $travis_repo_slug")
end

# When should a deploy be attempted?
Expand All @@ -403,13 +386,13 @@ function deploydocs(;

# check that the tag is valid
if should_deploy && !isempty(travis_tag) && !occursin(Base.VERSION_REGEX, travis_tag)
Compat.@warn("tag `$(travis_tag)` is not a valid VersionNumber")
@warn("tag `$(travis_tag)` is not a valid VersionNumber")
should_deploy = false
end

# check DOCUMENTER_KEY only if the branch, Julia version etc. check out
if should_deploy && isempty(documenter_key)
Compat.@warn("""
@warn("""
DOCUMENTER_KEY environment variable missing, unable to deploy.
Note that in Documenter v0.9.0 old deprecated authentication methods were removed.
DOCUMENTER_KEY is now the only option. See the documentation for more information.""")
Expand Down Expand Up @@ -532,7 +515,7 @@ function git_push(
version = VersionNumber(tag)
# only push to stable if this is the latest stable release
versions = filter!(x -> occursin(Base.VERSION_REGEX, x), readdir(dirname))
maxver = Compat.mapreduce(x -> VersionNumber(x), max, versions; init=v"0.0.0")
maxver = mapreduce(x -> VersionNumber(x), max, versions; init=v"0.0.0")
if version >= maxver && version.prerelease == () # don't deploy to stable for prereleases
gitrm_copy(target_dir, stable_dir)
Writers.HTMLWriter.generate_siteinfo_file(stable_dir, "stable")
Expand Down Expand Up @@ -578,7 +561,7 @@ first, `git add -A` will not detect case changes in filenames.
function gitrm_copy(src, dst)
# --ignore-unmatch so that we wouldn't get errors if dst does not exist
run(`git rm -rf --ignore-unmatch $(dst)`)
Compat.cp(src, dst; force=true)
cp(src, dst; force=true)
end

function withfile(func, file::AbstractString, contents::AbstractString)
Expand Down
Loading

0 comments on commit 8a56ec8

Please sign in to comment.