EXAMPLE_FOLDER

pull/339/head
Shuhei Kadowaki 2020-05-23 19:42:19 +09:00
parent daec0e618f
commit a03a1d4c34
3 changed files with 16 additions and 13 deletions

View File

@ -48,16 +48,19 @@ using Weave
# add depencies for the example
using Pkg; Pkg.add(["Plots", "DSP"])
weave(Weave.SAMPLE_JMD_DOC, out_path = :pwd)
filename = normpath(Weave.EXAMPLE_FOLDER, "FIR_design.jmd")
weave(filename, out_path = :pwd)
```
If you have LaTeX installed you can also weave directly to pdf.
```julia
weave(Weave.SAMPLE_JMD_DOC), out_path = :pwd, doctype = "md2pdf")
filename = normpath(Weave.EXAMPLE_FOLDER, "FIR_design.jmd")
weave(filename, out_path = :pwd, doctype = "md2pdf")
```
NOTE: `Weave.SAMPLE_JMD_DOC` is the path of [this document](./examples/FIR_design.jmd).
NOTE: `Weave.EXAMPLE_FOLDER` just points to [`examples` directory](./examples).
## Documentation

View File

@ -1,13 +1,12 @@
# Getting started
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`](https://github.com/JunoLab/Weave.jl/tree/master/examples) directory.
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 package's [`examples`](https://github.com/JunoLab/Weave.jl/tree/master/examples) directory.
First have a look at source document using markdown code chunks and [Plots.jl](https://github.com/JuliaPlots/Plots.jl) for figures:
[FIR_design.jmd](../examples/FIR_design.jmd) (its path is bound to `Weave.SAMPLE_JMD_DOC`) and then see the output in different formats:
All the different format documents below are generated from a single Weave document [`FIR_design.jmd`](../examples/FIR_design.jmd):
- HTML: [`FIR_design.html`](../examples/FIR_design.html)
- PDF: [`FIR_design.pdf`](../examples/FIR_design.pdf)
- Pandoc markdown: [`FIR_design.txt`](../examples/FIR_design.txt)
@ -26,15 +25,17 @@ Weave the files to your working directory:
```julia
using Weave
filename = normpath(Weave.EXAMPLE_FOLDER, "FIR_design.jmd")
# Julia markdown to HTML
weave(Weave.SAMPLE_JMD_DOC; doctype = "md2html", out_path = :pwd)
weave(filename; doctype = "md2html", out_path = :pwd)
# Julia markdown to PDF
weave(Weave.SAMPLE_JMD_DOC; doctype = "md2pdf", out_path = :pwd)
weave(filename; doctype = "md2pdf", out_path = :pwd)
# Julia markdown to Pandoc markdown
weave(Weave.SAMPLE_JMD_DOC; doctype = "pandoc", out_path = :pwd)
weave(filename; doctype = "pandoc", out_path = :pwd)
```
!!! tips
`Weave.SAMPLE_JMD_DOC` is the path of [FIR_design.jmd](../examples/FIR_design.jmd).
`Weave.EXAMPLE_FOLDER` points to [the `examples` directory](https://github.com/JunoLab/Weave.jl/tree/master/examples).

View File

@ -9,8 +9,7 @@ const WEAVE_OPTION_NAME = "weave_options"
const WEAVE_OPTION_NAME_DEPRECATED = "options" # remove this when tagging v0.11
# keeps paths of sample documents for easy try
const SAMPLE_JMD_DOC = normpath(PKG_DIR, "examples", "FIR_design.jmd")
const SAMPLE_JL_DOC = normpath(PKG_DIR, "examples", "FIR_design.jl")
const EXAMPLE_FOLDER = normpath(PKG_DIR, "examples")
function __init__()