Skip to content

Commit

Permalink
Merge branch 'docs-refactor'
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeInnes committed Jun 22, 2015
2 parents f3bbffe + 4171370 commit fc604d1
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3 deletions.
3 changes: 3 additions & 0 deletions base/coreimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ typealias StridedMatrix{T,A<:DenseArray,I<:Tuple{Vararg{RangeIndex}}} DenseArra
typealias StridedVecOrMat{T} Union{StridedVector{T}, StridedMatrix{T}}
include("array.jl")

# Doc macro shim
macro doc (ex) esc(ex.args[2]) end

#TODO: eliminate Dict from inference
include("hashing.jl")
include("nofloat_hashing.jl")
Expand Down
13 changes: 12 additions & 1 deletion base/docs.jl → base/docs/Docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Docs

import Base.Markdown: @doc_str, MD

export doc, @doc
export doc

# Basic API / Storage

Expand Down Expand Up @@ -210,10 +210,21 @@ function docm(ex)
:(doc($(esc(ex))))
end

# Not actually used; bootstrap version in bootstrap.jl

macro doc (args...)
docm(args...)
end

# Swap out the bootstrap macro with the real one

Base.DocBootstrap.setexpand!(docm)

# Names are resolved relative to the DocBootstrap module, so
# inject the ones we need there.

eval(Base.DocBootstrap, :(import ..Docs: @init, doc!, doc, newmethod))

# Metametadata

@doc """
Expand Down
File renamed without changes.
21 changes: 21 additions & 0 deletions base/docs/bootstrap.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module DocBootstrap

export @doc

const docs = []

_expand_ = nothing

setexpand!(f) = global _expand_ = f

macro doc (args...)
_expand_(args...)
end

setexpand!() do ex
str, obj = ex.args[1], ex.args[2]
push!(docs, (current_module(), str, obj))
return esc(obj)
end

end
7 changes: 5 additions & 2 deletions base/sysimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ include("abstractarray.jl")
include("subarray.jl")
include("array.jl")

include("docs/bootstrap.jl")
using .DocBootstrap

# numeric operations
include("hashing.jl")
include("rounding.jl")
Expand Down Expand Up @@ -243,7 +246,7 @@ include("client.jl")
# Documentation

include("markdown/Markdown.jl")
include("docs.jl")
include("docs/Docs.jl")
using .Docs
using .Markdown

Expand Down Expand Up @@ -303,7 +306,7 @@ import .Dates: Date, DateTime, now
include("deprecated.jl")

# Some basic documentation
include("basedocs.jl")
include("docs/basedocs.jl")

function __init__()
# Base library init
Expand Down

0 comments on commit fc604d1

Please sign in to comment.