From a9d0120c3d6f4a3d31a0364d246dde2b77f6ec02 Mon Sep 17 00:00:00 2001 From: Matti Pastell Date: Fri, 22 Apr 2016 16:16:50 +0300 Subject: [PATCH] Added documentation about new features --- doc/make_examples.jl | 2 +- doc/mkdocs.yml | 2 +- doc/src/chunk_options.md | 1 + doc/src/getting_started.md | 12 ++++++------ doc/src/usage.md | 28 ++++++++++++++++++++++++++-- 5 files changed, 35 insertions(+), 10 deletions(-) diff --git a/doc/make_examples.jl b/doc/make_examples.jl index b628987..8ec31bb 100644 --- a/doc/make_examples.jl +++ b/doc/make_examples.jl @@ -17,6 +17,6 @@ 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") +weave(Pkg.dir("Weave","examples","FIR_design.jl"), doctype = "md2pdf", out_path = "build/examples") cp(Pkg.dir("Weave","examples","FIR_design.jl"), "build/examples/FIR_design.jl", remove_destination = true) diff --git a/doc/mkdocs.yml b/doc/mkdocs.yml index 63dcb1a..6712e9a 100644 --- a/doc/mkdocs.yml +++ b/doc/mkdocs.yml @@ -29,6 +29,6 @@ pages: - Home: index.md - Getting started: getting_started.md - Using Weave: usage.md - - Publishing script: publish.md + - Publishing scripts: publish.md - Chunk options: chunk_options.md - Function index: function_index.md diff --git a/doc/src/chunk_options.md b/doc/src/chunk_options.md index 2bf2170..1051500 100644 --- a/doc/src/chunk_options.md +++ b/doc/src/chunk_options.md @@ -25,6 +25,7 @@ Weave currently supports the following chunk options with the following defaults * `line_width = 75`. Line width for wrapped lines. * `cache = false`. Cache results, depends on `cache` parameter on `weave` function. * `hold = false`. Hold all results until the end of the chunk. +* `tangle = true`. Set tangle to false to exclude chunk from tangled code. ## Options for figures diff --git a/doc/src/getting_started.md b/doc/src/getting_started.md index 1c73d7b..77594a9 100644 --- a/doc/src/getting_started.md +++ b/doc/src/getting_started.md @@ -19,12 +19,12 @@ You can Weave the files to your working directory using: ``` using Weave #Markdown -weave(Pkg.dir("Weave","examples","gadfly_md_sample.jmd"), informat="markdown", - out_path = :pwd, doctype = "pandoc") +weave(Pkg.dir("Weave","examples","gadfly_md_sample.jmd"), out_path = :pwd, + doctype = "pandoc") #HTML -weave(Pkg.dir("Weave","examples","gadfly_md_sample.jmd"), informat="markdown", - out_path = :pwd, doctype = "md2html") +weave(Pkg.dir("Weave","examples","gadfly_md_sample.jmd"), out_path = :pwd, + doctype = "md2html") #pdf -weave(Pkg.dir("Weave","examples","gadfly_md_sample.jmd"), informat="markdown", - out_path = :pwd, doctype = "md2pdf") +weave(Pkg.dir("Weave","examples","gadfly_md_sample.jmd"), out_path = :pwd, + doctype = "md2pdf") ``` diff --git a/doc/src/usage.md b/doc/src/usage.md index 880ec8a..76ce074 100644 --- a/doc/src/usage.md +++ b/doc/src/usage.md @@ -41,9 +41,21 @@ Tangling extracts the code from document: tangle(source) - ## Supported formats +Weave sets the output format based on the file extension, but you can also set +it using `doctype` option. The rules for detecting the format are: + +```julia +ext == ".jl" && return "md2html" +contains(ext, ".md") && return "md2html" +contains(ext, ".rst") && return "rst" +contains(ext, ".tex") && return "texminted" +contains(ext, ".txt") && return "asciidoc" +return "pandoc" +``` + + You can get a list of supported output formats: ``` @@ -63,7 +75,19 @@ tex: Latex with custom code environments ## Document syntax -Weave uses noweb or markdown syntax for defining the code chunks and documentation chunks. +Weave uses noweb, markdown or script syntax for defining the code chunks and +documentation chunks. The format is detected based on the file extension, but +you can also set it manually using the `informat` parameter. + +The rules for autodetection are: + +``` +ext == ".jl" && return "script" +ext == ".jmd" && return "markdown" +return "noweb" +``` + + ## Noweb