mirror of https://github.com/mpastell/Weave.jl
fix indents, Github -> GitHub
parent
36bce9cf1f
commit
020b4353a4
|
@ -73,4 +73,4 @@ Read the documentation:
|
|||
- stable: [http://mpastell.github.io/Weave.jl/stable/](http://mpastell.github.io/Weave.jl/stable/)
|
||||
- latest: [http://mpastell.github.io/Weave.jl/latest/](http://mpastell.github.io/Weave.jl/latest/)
|
||||
|
||||
See other examples in the [Github repo](https://github.com/mpastell/Weave.jl/tree/master/examples)
|
||||
See other examples in the [GitHub repo](https://github.com/mpastell/Weave.jl/tree/master/examples)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
This a sample [Julia](http://julialang.org/) noweb document that can
|
||||
be executed using Weave. Output from code chunks and PyPlot
|
||||
plots will be included in the weaved document. You also need to install Pweave from Github in order to use Weave.
|
||||
plots will be included in the weaved document. You also need to install Pweave from GitHub in order to use Weave.
|
||||
|
||||
This documented can be turned into Pandoc markdown with captured
|
||||
result from Julia prompt.
|
||||
|
|
26
src/Weave.jl
26
src/Weave.jl
|
@ -14,9 +14,9 @@ end
|
|||
List supported output formats
|
||||
"""
|
||||
function list_out_formats()
|
||||
for format = keys(formats)
|
||||
println(string(format,": ", formats[format].description))
|
||||
end
|
||||
for format = keys(formats)
|
||||
println(string(format,": ", formats[format].description))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
@ -37,24 +37,22 @@ function tangle(
|
|||
source::AbstractString;
|
||||
out_path::Union{Symbol,AbstractString} = :doc,
|
||||
informat::Union{Symbol,AbstractString} = :auto
|
||||
)
|
||||
)
|
||||
doc = read_doc(source, informat)
|
||||
doc.cwd = get_cwd(doc, out_path)
|
||||
|
||||
outname = get_outname(out_path, doc, ext = "jl")
|
||||
|
||||
open(outname, "w") do io
|
||||
for chunk in doc.chunks
|
||||
if typeof(chunk) == CodeChunk
|
||||
options = merge(doc.chunk_defaults, chunk.options)
|
||||
if options[:tangle]
|
||||
write(io, chunk.content*"\n")
|
||||
end
|
||||
end
|
||||
for chunk in doc.chunks
|
||||
if typeof(chunk) == CodeChunk
|
||||
options = merge(doc.chunk_defaults, chunk.options)
|
||||
options[:tangle] && write(io, chunk.content*"\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
doc.cwd == pwd() && (outname = basename(outname))
|
||||
@info("Writing to file $outname")
|
||||
doc.cwd == pwd() && (outname = basename(outname))
|
||||
@info("Writing to file $outname")
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -77,12 +77,12 @@ const pdoc2html = Pandoc2HTML("Markdown to HTML (requires Pandoc 2)",
|
|||
"text/html", "text/markdown", "text/plain"],
|
||||
:doctype=> "pandoc2html"))
|
||||
|
||||
struct GithubMarkdown
|
||||
struct GitHubMarkdown
|
||||
description::AbstractString
|
||||
formatdict::Dict{Symbol,Any}
|
||||
end
|
||||
|
||||
const github = GithubMarkdown("Github markdown",
|
||||
const github = GitHubMarkdown("GitHub markdown",
|
||||
Dict{Symbol,Any}(
|
||||
:codestart => "````julia",
|
||||
:codeend=> "````\n\n",
|
||||
|
@ -352,7 +352,7 @@ function formatfigures(chunk, docformat::Pandoc)
|
|||
return result
|
||||
end
|
||||
|
||||
function formatfigures(chunk, docformat::GithubMarkdown)
|
||||
function formatfigures(chunk, docformat::GitHubMarkdown)
|
||||
fignames = chunk.figures
|
||||
caption = chunk.options[:fig_cap]
|
||||
result = ""
|
||||
|
|
Loading…
Reference in New Issue