Add docs for script format

pull/35/head
Matti Pastell 2016-04-22 15:04:15 +03:00
parent d2a298a1d6
commit 15f6f3b920
4 changed files with 46 additions and 2 deletions

View File

@ -15,3 +15,8 @@ cp(Pkg.dir("Weave","examples","gadfly_md_sample.jmd"),
cp("build/examples/gadfly_md_sample.md",
"build/examples/gadfly_md_sample.txt", remove_destination = true)
weave(Pkg.dir("Weave","examples","FIR_design.jl"), out_path = "build/examples")
weave(Pkg.dir("Weave","examples","FIR_design.jl"), docformat = "md2pdf", out_path = "build/examples")
cp(Pkg.dir("Weave","examples","FIR_design.jl"),
"build/examples/FIR_design.jl", remove_destination = true)

View File

@ -29,5 +29,6 @@ pages:
- Home: index.md
- Getting started: getting_started.md
- Using Weave: usage.md
- Publishing script: publish.md
- Chunk options: chunk_options.md
- Function index: function_index.md

View File

@ -4,13 +4,15 @@
The best way to get started using Weave.jl is to look at the example input and
output documents. Examples for different formats are included in the packages `examples` directory.
First have a look at source document using markdown code chunks and Gadfly for figures: [gadfly_md_sample.jmd](examples/gadfly_md_sample.jmd) and then see the output in different formats:
First have a look at source document using markdown code chunks and Gadfly for
figures: [gadfly_md_sample.jmd](examples/gadfly_md_sample.jmd) and then see the
output in different formats:
- Pandoc markdown: [gadfly_md_sample.md](examples/gadfly_md_sample.txt)
- HTML: [gadfly_md_sample.html](examples/gadfly_md_sample.html)
- pdf: [gadfly_md_sample.pdf](examples/gadfly_md_sample.pdf)
*Producing HTML and pdf output requires that you Pandoc and XeLatex (for pdf) installed.*
*Producing HTML and pdf output requires that you have Pandoc and XeLatex (for pdf) installed.*
You can Weave the files to your working directory using:

36
doc/src/publish.md Normal file
View File

@ -0,0 +1,36 @@
# Publishing scripts
You can also also publish html and pdf
documents from Julia scripts with a specific format. Producing HTML and pdf output
requires that you have Pandoc and XeLatex (for pdf) installed and in your path.
These scripts can be executed normally using Julia or published with Weave.
Documentation is written in markdown in lines starting with ``#'``, ``#%%`` or ``# %%`` ,
and code is executed and results are included in the published document.
The format is identical to [Pweave](http://mpastell.com/pweave/pypublish.html)
and the concept is similar to publishing documents with MATLAB or
using Knitr's [spin](http://yihui.name/knitr/demo/stitch/).
Weave will remove the first empty space from each line of documentation.
All lines that are not documentation are treated as code. You can set chunk options
using lines starting with ``#+``, ``#%%`` or ``# %%`` just before code
e.g. ``#+ term=True, caption='Fancy plots.'``. See the example below for the markup.
The scripts can be published using the `pypublish` scipts:
[FIR_design.jl](examples/FIR_design.jl), [FIR_design.html](examples/FIR_design.html) , [FIR_design.pdf](examples/FIR_design.pdf).
```
weave("FIR_design.jl")
weave("FIR_design.jl", docformat = "md2pdf")
```
## Other mark ups with scripts
You can also use any Weave supported format in the comments and set the output format
as you would for noweb and markdown inputs. e.g for LaTeX you can use:
```
weave("latex_doc.jl", docformat = "texminted")
```