mirror of https://github.com/mpastell/Weave.jl
Fix CRLF in rest of the files
parent
d75ae6d86b
commit
68b9bfda08
|
@ -1,33 +1,33 @@
|
||||||
|
|
||||||
src/*.cov
|
src/*.cov
|
||||||
test.jl
|
test.jl
|
||||||
examples/figures/
|
examples/figures/
|
||||||
examples/*.md
|
examples/*.md
|
||||||
examples/*.pdf
|
examples/*.pdf
|
||||||
examples/*.html
|
examples/*.html
|
||||||
examples/*.rst
|
examples/*.rst
|
||||||
examples/*.tex
|
examples/*.tex
|
||||||
test/**/cache
|
test/**/cache
|
||||||
test/**/figures
|
test/**/figures
|
||||||
test/documents/output/gadfly_formats_test.txt
|
test/documents/output/gadfly_formats_test.txt
|
||||||
test/**/*.tex
|
test/**/*.tex
|
||||||
test/**/*.md
|
test/**/*.md
|
||||||
test/**/*.rst
|
test/**/*.rst
|
||||||
test/**/*.html
|
test/**/*.html
|
||||||
test/**/*.pdf
|
test/**/*.pdf
|
||||||
test/**/*.png
|
test/**/*.png
|
||||||
test/**/chunk_options.jl
|
test/**/chunk_options.jl
|
||||||
!test/**/*ref.*
|
!test/**/*ref.*
|
||||||
|
|
||||||
doc/build
|
doc/build
|
||||||
doc/site
|
doc/site
|
||||||
stable/
|
stable/
|
||||||
|
|
||||||
tmp/
|
tmp/
|
||||||
.idea
|
.idea
|
||||||
*.*~
|
*.*~
|
||||||
*.aux
|
*.aux
|
||||||
*.log
|
*.log
|
||||||
*.out
|
*.out
|
||||||
\#*\#
|
\#*\#
|
||||||
.juliahistory
|
.juliahistory
|
||||||
|
|
140
README.md
140
README.md
|
@ -1,76 +1,76 @@
|
||||||
# Weave
|
# Weave
|
||||||
|
|
||||||
[![Build Status](https://travis-ci.org/mpastell/Weave.jl.svg?branch=master)](https://travis-ci.org/mpastell/Weave.jl)
|
[![Build Status](https://travis-ci.org/mpastell/Weave.jl.svg?branch=master)](https://travis-ci.org/mpastell/Weave.jl)
|
||||||
[![Build status](https://ci.appveyor.com/api/projects/status/r97pwi9x8ard6xk6/branch/master?svg=true)](https://ci.appveyor.com/project/mpastell/weave-jl/branch/master)
|
[![Build status](https://ci.appveyor.com/api/projects/status/r97pwi9x8ard6xk6/branch/master?svg=true)](https://ci.appveyor.com/project/mpastell/weave-jl/branch/master)
|
||||||
[![Coverage Status](https://img.shields.io/coveralls/mpastell/Weave.jl.svg)](https://coveralls.io/r/mpastell/Weave.jl?branch=master)
|
[![Coverage Status](https://img.shields.io/coveralls/mpastell/Weave.jl.svg)](https://coveralls.io/r/mpastell/Weave.jl?branch=master)
|
||||||
|
|
||||||
|
|
||||||
Weave is a scientific report generator/literate programming tool
|
Weave is a scientific report generator/literate programming tool
|
||||||
for Julia. It resembles [Pweave](http://mpastell.com/pweave), Knitr, rmarkdown
|
for Julia. It resembles [Pweave](http://mpastell.com/pweave), Knitr, rmarkdown
|
||||||
and Sweave.
|
and Sweave.
|
||||||
|
|
||||||
You can write your documentation and code in input document using Noweb,
|
You can write your documentation and code in input document using Noweb,
|
||||||
Markdown, Script syntax and use `weave` function to execute to document to capture results
|
Markdown, Script syntax and use `weave` function to execute to document to capture results
|
||||||
and figures.
|
and figures.
|
||||||
|
|
||||||
**Current features**
|
**Current features**
|
||||||
|
|
||||||
* Noweb, markdown or script syntax for input documents.
|
* Noweb, markdown or script syntax for input documents.
|
||||||
* Execute code as terminal or "script" chunks.
|
* Execute code as terminal or "script" chunks.
|
||||||
* Capture Plots, Gadfly, PyPlot and Winston figures.
|
* Capture Plots, Gadfly, PyPlot and Winston figures.
|
||||||
* Supports LaTex, Pandoc, Github markdown, MultiMarkdown, Asciidoc and reStructuredText output
|
* Supports LaTex, Pandoc, Github markdown, MultiMarkdown, Asciidoc and reStructuredText output
|
||||||
* Publish markdown directly to html and pdf using Julia or Pandoc markdown.
|
* Publish markdown directly to html and pdf using Julia or Pandoc markdown.
|
||||||
* Simple caching of results
|
* Simple caching of results
|
||||||
* Convert to and from IJulia notebooks
|
* Convert to and from IJulia notebooks
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Run from julia using Gadfly for plots:
|
Run from julia using Gadfly for plots:
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
using Weave
|
using Weave
|
||||||
weave(Pkg.dir("Weave","examples","gadfly_sample.mdw"))
|
weave(Pkg.dir("Weave","examples","gadfly_sample.mdw"))
|
||||||
```
|
```
|
||||||
|
|
||||||
If you have Pandoc installed you can also weave directly to html and pdf.
|
If you have Pandoc installed you can also weave directly to html and pdf.
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
weave(Pkg.dir("Weave","examples","gadfly_md_sample.jmd"), informat="markdown",
|
weave(Pkg.dir("Weave","examples","gadfly_md_sample.jmd"), informat="markdown",
|
||||||
out_path = :pwd, doctype = "md2html")
|
out_path = :pwd, doctype = "md2html")
|
||||||
```
|
```
|
||||||
|
|
||||||
![Weave code and output](http://mpastell.com/images/weave_demo.png)
|
![Weave code and output](http://mpastell.com/images/weave_demo.png)
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
Documenter.jl with MKDocs generated documentation:
|
Documenter.jl with MKDocs generated documentation:
|
||||||
|
|
||||||
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://mpastell.github.io/Weave.jl/stable)
|
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://mpastell.github.io/Weave.jl/stable)
|
||||||
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://mpastell.github.io/Weave.jl/latest)
|
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://mpastell.github.io/Weave.jl/latest)
|
||||||
|
|
||||||
## Editor support
|
## Editor support
|
||||||
|
|
||||||
I have made [language-weave](https://atom.io/packages/language-weave) package
|
I have made [language-weave](https://atom.io/packages/language-weave) package
|
||||||
for Atom to do the syntax highlighting correctly.
|
for Atom to do the syntax highlighting correctly.
|
||||||
|
|
||||||
Noweb documents work well with ESS as well, to set doc-mode for .mdw files to markdown
|
Noweb documents work well with ESS as well, to set doc-mode for .mdw files to markdown
|
||||||
and code to Julia you can do:
|
and code to Julia you can do:
|
||||||
|
|
||||||
```clojure
|
```clojure
|
||||||
(defun mdw-mode ()
|
(defun mdw-mode ()
|
||||||
(ess-noweb-mode)
|
(ess-noweb-mode)
|
||||||
(setq ess-noweb-default-code-mode 'ess-julia-mode)
|
(setq ess-noweb-default-code-mode 'ess-julia-mode)
|
||||||
(setq ess-noweb-doc-mode 'markdown-mode))
|
(setq ess-noweb-doc-mode 'markdown-mode))
|
||||||
|
|
||||||
(setq auto-mode-alist (append (list (cons "\\.mdw$" 'mdw-mode))
|
(setq auto-mode-alist (append (list (cons "\\.mdw$" 'mdw-mode))
|
||||||
auto-mode-alist))
|
auto-mode-alist))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
I will probably add new features to Weave when I need them myself or if they are requested and not too difficult to implement. You can contribute by opening issues on Github or implementing things yourself and making a pull request. I'd also appreciate example documents written using Weave to add to examples.
|
I will probably add new features to Weave when I need them myself or if they are requested and not too difficult to implement. You can contribute by opening issues on Github or implementing things yourself and making a pull request. I'd also appreciate example documents written using Weave to add to examples.
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
You can see the list of contributors on Github: https://github.com/mpastell/Weave.jl/graphs/contributors. Thanks for the important additions, fixes and comments.
|
You can see the list of contributors on Github: https://github.com/mpastell/Weave.jl/graphs/contributors. Thanks for the important additions, fixes and comments.
|
||||||
|
|
16
REQUIRE
16
REQUIRE
|
@ -1,8 +1,8 @@
|
||||||
julia 0.5
|
julia 0.5
|
||||||
ArgParse
|
ArgParse
|
||||||
JLD
|
JLD
|
||||||
JSON
|
JSON
|
||||||
Highlights
|
Highlights
|
||||||
Mustache
|
Mustache
|
||||||
Documenter
|
Documenter
|
||||||
YAML
|
YAML
|
||||||
|
|
Binary file not shown.
176
src/config.jl
176
src/config.jl
|
@ -1,88 +1,88 @@
|
||||||
|
|
||||||
|
|
||||||
#Default options
|
#Default options
|
||||||
const defaultParams =
|
const defaultParams =
|
||||||
Dict{Symbol,Any}(:plotlib => nothing,
|
Dict{Symbol,Any}(:plotlib => nothing,
|
||||||
:plotlib_set => false,
|
:plotlib_set => false,
|
||||||
:storeresults => false,
|
:storeresults => false,
|
||||||
:doc_number => 0,
|
:doc_number => 0,
|
||||||
:chunk_defaults =>
|
:chunk_defaults =>
|
||||||
Dict{Symbol,Any}(
|
Dict{Symbol,Any}(
|
||||||
:echo=> true,
|
:echo=> true,
|
||||||
:results=> "markup",
|
:results=> "markup",
|
||||||
:hold => false,
|
:hold => false,
|
||||||
:fig=> true,
|
:fig=> true,
|
||||||
:include=> true,
|
:include=> true,
|
||||||
:eval => true,
|
:eval => true,
|
||||||
:tangle => true,
|
:tangle => true,
|
||||||
:cache => false,
|
:cache => false,
|
||||||
:fig_cap=> nothing,
|
:fig_cap=> nothing,
|
||||||
#Size in inches
|
#Size in inches
|
||||||
:fig_width => 6,
|
:fig_width => 6,
|
||||||
:fig_height => 4,
|
:fig_height => 4,
|
||||||
:fig_path=> "figures",
|
:fig_path=> "figures",
|
||||||
:dpi => 96,
|
:dpi => 96,
|
||||||
:term=> false,
|
:term=> false,
|
||||||
:display => false,
|
:display => false,
|
||||||
:prompt => "\njulia> ",
|
:prompt => "\njulia> ",
|
||||||
:name=> nothing,
|
:name=> nothing,
|
||||||
:wrap=> true,
|
:wrap=> true,
|
||||||
:line_width => 75,
|
:line_width => 75,
|
||||||
:engine=> "julia",
|
:engine=> "julia",
|
||||||
#:option_AbstractString=> "",
|
#:option_AbstractString=> "",
|
||||||
#Defined in formats
|
#Defined in formats
|
||||||
:fig_ext => nothing,
|
:fig_ext => nothing,
|
||||||
:fig_pos=> nothing,
|
:fig_pos=> nothing,
|
||||||
:fig_env=> nothing,
|
:fig_env=> nothing,
|
||||||
:out_width=> nothing,
|
:out_width=> nothing,
|
||||||
:out_height=> nothing,
|
:out_height=> nothing,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
#This one can be changed at runtime, initially a copy of defaults
|
#This one can be changed at runtime, initially a copy of defaults
|
||||||
const rcParams = deepcopy(defaultParams)
|
const rcParams = deepcopy(defaultParams)
|
||||||
|
|
||||||
#Parameters set per document
|
#Parameters set per document
|
||||||
const docParams =Dict{Symbol,Any}(
|
const docParams =Dict{Symbol,Any}(
|
||||||
:fig_path=> nothing,
|
:fig_path=> nothing,
|
||||||
:fig_ext => nothing,
|
:fig_ext => nothing,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
`set_chunk_defaults(opts::Dict{Symbol, Any})`
|
`set_chunk_defaults(opts::Dict{Symbol, Any})`
|
||||||
|
|
||||||
Set default options for code chunks, use get_chunk_defaults
|
Set default options for code chunks, use get_chunk_defaults
|
||||||
to see the current values.
|
to see the current values.
|
||||||
|
|
||||||
e.g. set default dpi to 200 and fig_width to 8
|
e.g. set default dpi to 200 and fig_width to 8
|
||||||
|
|
||||||
```
|
```
|
||||||
julia> set_chunk_defaults(Dict{Symbol, Any}(:dpi => 200, fig_width => 8))
|
julia> set_chunk_defaults(Dict{Symbol, Any}(:dpi => 200, fig_width => 8))
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
function set_chunk_defaults(opts::Dict{Symbol, Any})
|
function set_chunk_defaults(opts::Dict{Symbol, Any})
|
||||||
merge!(rcParams[:chunk_defaults], opts)
|
merge!(rcParams[:chunk_defaults], opts)
|
||||||
return nothing
|
return nothing
|
||||||
end
|
end
|
||||||
|
|
||||||
"""
|
"""
|
||||||
`get_chunk_defaults()`
|
`get_chunk_defaults()`
|
||||||
|
|
||||||
Get default options used for code chunks.
|
Get default options used for code chunks.
|
||||||
"""
|
"""
|
||||||
function get_chunk_defaults()
|
function get_chunk_defaults()
|
||||||
return(rcParams[:chunk_defaults])
|
return(rcParams[:chunk_defaults])
|
||||||
end
|
end
|
||||||
|
|
||||||
"""
|
"""
|
||||||
`restore_chunk_defaults()`
|
`restore_chunk_defaults()`
|
||||||
|
|
||||||
Restore Weave.jl default chunk options
|
Restore Weave.jl default chunk options
|
||||||
"""
|
"""
|
||||||
function restore_chunk_defaults()
|
function restore_chunk_defaults()
|
||||||
rcParams[:chunk_defaults] = defaultParams[:chunk_defaults]
|
rcParams[:chunk_defaults] = defaultParams[:chunk_defaults]
|
||||||
merge!(rcParams[:chunk_defaults], docParams)
|
merge!(rcParams[:chunk_defaults], docParams)
|
||||||
return nothing
|
return nothing
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue