build based on 83e2e0a

gh-pages
autodocs 2019-03-11 12:00:13 +00:00
parent e11f42a62e
commit 62de3d60d8
2 changed files with 4 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ weave(joinpath(dirname(pathof(Weave)), "../examples", "FIR_design
cache_path = "cache", cache=:off,
template = nothing, highlight_theme = nothing, css = nothing,
pandoc_options = "",
latex_cmd = &quot;xelatex&quot;)</code></pre><p>Weave an input document to output file.</p><ul><li><code>doctype</code>: :auto = set based on file extension or specify one of the supported formats. See <code>list_out_formats()</code></li><li><code>informat</code>: :auto = set based on file extension or set to <code>&quot;noweb&quot;</code>, <code>&quot;markdown&quot;</code> or <code>script</code></li><li><code>out_path</code>: Path where the output is generated. Can be: <code>:doc</code>: Path of the source document, <code>:pwd</code>: Julia working directory, <code>&quot;somepath&quot;</code>: output directory as a String e.g <code>&quot;/home/mpastell/weaveout&quot;</code> or filename as string e.g. ~/outpath/outfile.tex.</li><li><code>args</code>: dictionary of arguments to pass to document. Available as WEAVE_ARGS</li><li><code>mod</code>: Module where Weave <code>eval</code>s code. Defaults to <code>:sandbox</code> to create new sandbox module, you can also pass a module e.g. <code>Main</code>.</li><li><code>fig_path</code>: where figures will be generated, relative to out_path</li><li><code>fig_ext</code>: Extension for saved figures e.g. <code>&quot;.pdf&quot;</code>, <code>&quot;.png&quot;</code>. Default setting depends on <code>doctype</code>.</li><li><code>cache_path</code>: where of cached output will be saved.</li><li><code>cache</code>: controls caching of code: <code>:off</code> = no caching, <code>:all</code> = cache everything, <code>:user</code> = cache based on chunk options, <code>:refresh</code>, run all code chunks and save new cache.</li><li><code>throw_errors</code> if <code>false</code> errors are included in output document and the whole document is executed. if <code>true</code> errors are thrown when they occur.</li><li><code>template</code> : Template (file path) or MustacheTokens for md2html or md2tex formats.</li><li><code>highlight_theme</code> : Theme (Highlights.AbstractTheme) for used syntax highlighting</li><li><code>css</code> : CSS (file path) used for md2html format</li><li><code>pandoc_options</code> = String array of options to pass to pandoc for <code>pandoc2html</code> and <code>pandoc2pdf</code> formats e.g. [&quot;toc&quot;, &quot;-N&quot;]</li><li><code>latex_cmd</code> the command used to make pdf from .tex</li></ul><p><strong>Note:</strong> Run Weave from terminal and not using IJulia, Juno or ESS, they tend to mess with capturing output.</p></div></div><a class="source-link" target="_blank" href="https://github.com/mpastell/Weave.jl/blob/35addd2b505713b22dcb35be53e5abc2c8a3572e/src/Weave.jl#L53-L89">source</a></section><h2><a class="nav-anchor" id="Tangle-1" href="#Tangle-1">Tangle</a></h2><p>Tangling extracts the code from document:</p><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Weave.tangle-Tuple{Any}" href="#Weave.tangle-Tuple{Any}"><code>Weave.tangle</code></a><span class="docstring-category">Method</span>.</div><div><div><p><code>tangle(source ; out_path=:doc, informat=&quot;noweb&quot;)</code></p><p>Tangle source code from input document to .jl file.</p><ul><li><code>informat</code>: <code>&quot;noweb&quot;</code> of <code>&quot;markdown&quot;</code></li><li><code>out_path</code>: Path where the output is generated. Can be: <code>:doc</code>: Path of the source document, <code>:pwd</code>: Julia working directory, <code>&quot;somepath&quot;</code>, directory name as a string e.g <code>&quot;/home/mpastell/weaveout&quot;</code></li></ul><p>or filename as string e.g. ~/outpath/outfile.jl.</p></div></div><a class="source-link" target="_blank" href="https://github.com/mpastell/Weave.jl/blob/35addd2b505713b22dcb35be53e5abc2c8a3572e/src/Weave.jl#L23-L31">source</a></section><h2><a class="nav-anchor" id="Supported-output-formats-1" href="#Supported-output-formats-1">Supported output formats</a></h2><p>Weave sets the output format based on the file extension, but you can also set it using <code>doctype</code> option. The rules for detecting the format are:</p><pre><code class="language-julia">ext == &quot;.jl&quot; &amp;&amp; return &quot;md2html&quot;
latex_cmd = &quot;xelatex&quot;)</code></pre><p>Weave an input document to output file.</p><ul><li><code>doctype</code>: :auto = set based on file extension or specify one of the supported formats. See <code>list_out_formats()</code></li><li><code>informat</code>: :auto = set based on file extension or set to <code>&quot;noweb&quot;</code>, <code>&quot;markdown&quot;</code> or <code>script</code></li><li><code>out_path</code>: Path where the output is generated. Can be: <code>:doc</code>: Path of the source document, <code>:pwd</code>: Julia working directory, <code>&quot;somepath&quot;</code>: output directory as a String e.g <code>&quot;/home/mpastell/weaveout&quot;</code> or filename as string e.g. ~/outpath/outfile.tex.</li><li><code>args</code>: dictionary of arguments to pass to document. Available as WEAVE_ARGS</li><li><code>mod</code>: Module where Weave <code>eval</code>s code. Defaults to <code>:sandbox</code> to create new sandbox module, you can also pass a module e.g. <code>Main</code>.</li><li><code>fig_path</code>: where figures will be generated, relative to out_path</li><li><code>fig_ext</code>: Extension for saved figures e.g. <code>&quot;.pdf&quot;</code>, <code>&quot;.png&quot;</code>. Default setting depends on <code>doctype</code>.</li><li><code>cache_path</code>: where of cached output will be saved.</li><li><code>cache</code>: controls caching of code: <code>:off</code> = no caching, <code>:all</code> = cache everything, <code>:user</code> = cache based on chunk options, <code>:refresh</code>, run all code chunks and save new cache.</li><li><code>throw_errors</code> if <code>false</code> errors are included in output document and the whole document is executed. if <code>true</code> errors are thrown when they occur.</li><li><code>template</code> : Template (file path) or MustacheTokens for md2html or md2tex formats.</li><li><code>highlight_theme</code> : Theme (Highlights.AbstractTheme) for used syntax highlighting</li><li><code>css</code> : CSS (file path) used for md2html format</li><li><code>pandoc_options</code> = String array of options to pass to pandoc for <code>pandoc2html</code> and <code>pandoc2pdf</code> formats e.g. [&quot;toc&quot;, &quot;-N&quot;]</li><li><code>latex_cmd</code> the command used to make pdf from .tex</li></ul><p><strong>Note:</strong> Run Weave from terminal and not using IJulia, Juno or ESS, they tend to mess with capturing output.</p></div></div><a class="source-link" target="_blank" href="https://github.com/mpastell/Weave.jl/blob/83e2e0ae20370981df0fdb8d0f4cfef68f3cffb1/src/Weave.jl#L53-L89">source</a></section><h2><a class="nav-anchor" id="Tangle-1" href="#Tangle-1">Tangle</a></h2><p>Tangling extracts the code from document:</p><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Weave.tangle-Tuple{Any}" href="#Weave.tangle-Tuple{Any}"><code>Weave.tangle</code></a><span class="docstring-category">Method</span>.</div><div><div><p><code>tangle(source ; out_path=:doc, informat=&quot;noweb&quot;)</code></p><p>Tangle source code from input document to .jl file.</p><ul><li><code>informat</code>: <code>&quot;noweb&quot;</code> of <code>&quot;markdown&quot;</code></li><li><code>out_path</code>: Path where the output is generated. Can be: <code>:doc</code>: Path of the source document, <code>:pwd</code>: Julia working directory, <code>&quot;somepath&quot;</code>, directory name as a string e.g <code>&quot;/home/mpastell/weaveout&quot;</code></li></ul><p>or filename as string e.g. ~/outpath/outfile.jl.</p></div></div><a class="source-link" target="_blank" href="https://github.com/mpastell/Weave.jl/blob/83e2e0ae20370981df0fdb8d0f4cfef68f3cffb1/src/Weave.jl#L23-L31">source</a></section><h2><a class="nav-anchor" id="Supported-output-formats-1" href="#Supported-output-formats-1">Supported output formats</a></h2><p>Weave sets the output format based on the file extension, but you can also set it using <code>doctype</code> option. The rules for detecting the format are:</p><pre><code class="language-julia">ext == &quot;.jl&quot; &amp;&amp; return &quot;md2html&quot;
contains(ext, &quot;.md&quot;) &amp;&amp; return &quot;md2html&quot;
contains(ext, &quot;.rst&quot;) &amp;&amp; return &quot;rst&quot;
contains(ext, &quot;.tex&quot;) &amp;&amp; return &quot;texminted&quot;
@ -26,7 +26,7 @@ rst: reStructuredText and Sphinx
multimarkdown: MultiMarkdown
md2pdf: Julia markdown to latex
asciidoc: AsciiDoc
hugo: Hugo markdown (using shortcodes)</code></pre></div><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Weave.list_out_formats-Tuple{}" href="#Weave.list_out_formats-Tuple{}"><code>Weave.list_out_formats</code></a><span class="docstring-category">Method</span>.</div><div><div><p><code>list_out_formats()</code></p><p>List supported output formats</p></div></div><a class="source-link" target="_blank" href="https://github.com/mpastell/Weave.jl/blob/35addd2b505713b22dcb35be53e5abc2c8a3572e/src/Weave.jl#L11-L15">source</a></section><h2><a class="nav-anchor" id="Document-syntax-1" href="#Document-syntax-1">Document syntax</a></h2><p>Weave uses markdown, Noweb or script syntax for defining the code chunks and documentation chunks. You can also weave Jupyter notebooks. The format is detected based on the file extension, but you can also set it manually using the <code>informat</code> parameter.</p><p>The rules for autodetection are:</p><pre><code class="language-julia">ext == &quot;.jl&quot; &amp;&amp; return &quot;script&quot;
hugo: Hugo markdown (using shortcodes)</code></pre></div><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Weave.list_out_formats-Tuple{}" href="#Weave.list_out_formats-Tuple{}"><code>Weave.list_out_formats</code></a><span class="docstring-category">Method</span>.</div><div><div><p><code>list_out_formats()</code></p><p>List supported output formats</p></div></div><a class="source-link" target="_blank" href="https://github.com/mpastell/Weave.jl/blob/83e2e0ae20370981df0fdb8d0f4cfef68f3cffb1/src/Weave.jl#L11-L15">source</a></section><h2><a class="nav-anchor" id="Document-syntax-1" href="#Document-syntax-1">Document syntax</a></h2><p>Weave uses markdown, Noweb or script syntax for defining the code chunks and documentation chunks. You can also weave Jupyter notebooks. The format is detected based on the file extension, but you can also set it manually using the <code>informat</code> parameter.</p><p>The rules for autodetection are:</p><pre><code class="language-julia">ext == &quot;.jl&quot; &amp;&amp; return &quot;script&quot;
ext == &quot;.jmd&quot; &amp;&amp; return &quot;markdown&quot;
ext == &quot;.ipynb&quot; &amp;&amp; return &quot;notebook&quot;
return &quot;noweb&quot;</code></pre><h2><a class="nav-anchor" id="Documentation-chunks-1" href="#Documentation-chunks-1">Documentation chunks</a></h2><p>In Markdown and Noweb input formats documentation chunks are the parts that aren&#39;t inside code delimiters. Documentation chunks can be written with several different markup languages.</p><h2><a class="nav-anchor" id="Code-chunks-1" href="#Code-chunks-1">Code chunks</a></h2><h3><a class="nav-anchor" id="Markdown-format-1" href="#Markdown-format-1">Markdown format</a></h3><p>Markdown code chunks are defined using fenced code blocks with options following on the same line. e.g. to hide code from output you can use:</p><pre><code class="language-none"> ```julia; echo=false`</code></pre><p><a href=" https:/github.com/mpastell/Weave.jl/blob/master/examples/FIR_design.jmd">Sample document</a></p><h2><a class="nav-anchor" id="Inline-code-1" href="#Inline-code-1">Inline code</a></h2><p>You can also add inline code to your documents using</p><pre><code class="language-none">`j juliacode`</code></pre><p>or</p><pre><code class="language-none">! juliacode</code></pre><p>syntax. Using the <code>j code</code> syntax you can insert code anywhere in a line and with the <code>!</code> syntax the whole line after <code>!</code> will be executed. The code will be replaced with captured output in the weaved document.</p><p>If the code produces figures the filename or base64 encoded string will be added to output e.g. to include a Plots figure in markdown you can use:</p><pre><code class="language-none">![A plot](`j plot(1:10)`)</code></pre><p>or to produce any html output:</p><pre><code class="language-none">! display(&quot;text/html&quot;, &quot;Header from julia&quot;);</code></pre><h3><a class="nav-anchor" id="Noweb-format-1" href="#Noweb-format-1">Noweb format</a></h3><p>Code chunks start with a line marked with <code>&lt;&lt;&gt;&gt;=</code> or <code>&lt;&lt;options&gt;&gt;=</code> and end with line marked with <code>@</code>. The code between the start and end markers is executed and the output is captured to the output document. See <a href="../chunk_options/">chunk options</a>.</p><h3><a class="nav-anchor" id="Script-format-1" href="#Script-format-1">Script format</a></h3><p>Weave also support script input format with a markup in comments. These scripts can be executed normally using Julia or published with Weave. Documentation is in lines starting with <code>#&#39;</code>, <code>#%%</code> or <code># %%</code>, and code is executed and results are included in the weaved document.</p><p>All lines that are not documentation are treated as code. You can set chunk options using lines starting with <code>#+</code> just before code e.g. <code>#+ term=true</code>.</p><p>The format is identical to <a href="http://mpastell.com/pweave/pypublish.html">Pweave</a> and the concept is similar to publishing documents with MATLAB or using Knitr&#39;s <a href="http://yihui.name/knitr/demo/stitch/">spin</a>. Weave will remove the first empty space from each line of documentation.</p><p><a href="https://github.com/mpastell/Weave.jl/blob/master/examples/FIR_design.jl">See sample document:</a></p><h2><a class="nav-anchor" id="Setting-document-options-in-header-1" href="#Setting-document-options-in-header-1">Setting document options in header</a></h2><p>You can use a YAML header in the beginning of the input document delimited with &quot;-&quot; to set the document title, author and date e.g. and default document options. Each of Weave command line arguments and chunk options can be set in header using <code>options</code> field. Below is an example that sets document <code>out_path</code> and <code>doctype</code> using the header.</p><pre><code class="language-yaml">---
@ -45,4 +45,4 @@ options:
fig_ext : .png
---</code></pre><h2><a class="nav-anchor" id="Passing-arguments-to-documents-1" href="#Passing-arguments-to-documents-1">Passing arguments to documents</a></h2><p>You can pass arguments as dictionary to the weaved document using the <code>args</code> argument to <code>weave</code>. The dictionary will be available as <code>WEAVE_ARGS</code> variable in the document.</p><p>This makes it possible to create the same report easily for e.g. different date ranges of input data from a database or from files with similar format giving the filename as input.</p><p>In order to pass a filename to a document you need call <code>weave</code> using:</p><pre><code class="language-julia">weave(&quot;mydoc.jmd&quot;, args = Dict(&quot;filename&quot; =&gt; &quot;somedata.h5&quot;))</code></pre><p>and you can access the filename from document as follows:</p><pre><code class="language-none"> ```julia
print(WEAVE_ARGS[&quot;filename&quot;])
```</code></pre><p>You can use the <code>out_path</code> argument to control the name of the output document.</p><h2><a class="nav-anchor" id="Include-Weave-document-in-Julia-1" href="#Include-Weave-document-in-Julia-1">Include Weave document in Julia</a></h2><p>You can call <code>include_weave</code> on a Weave document to run the contents of all code chunks in Julia.</p><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Weave.include_weave" href="#Weave.include_weave"><code>Weave.include_weave</code></a><span class="docstring-category">Function</span>.</div><div><div><pre><code class="language-none">include_weave(doc, informat=:auto)</code></pre><p>Include code from Weave document calling <code>include_string</code> on all code from doc. Code is run in the path of the include document.</p></div></div><a class="source-link" target="_blank" href="https://github.com/mpastell/Weave.jl/blob/35addd2b505713b22dcb35be53e5abc2c8a3572e/src/Weave.jl#L200-L205">source</a></section><footer><hr/><a class="previous" href="../getting_started/"><span class="direction">Previous</span><span class="title">Getting started</span></a><a class="next" href="../publish/"><span class="direction">Next</span><span class="title">Publishing to html and pdf</span></a></footer></article></body></html>
```</code></pre><p>You can use the <code>out_path</code> argument to control the name of the output document.</p><h2><a class="nav-anchor" id="Include-Weave-document-in-Julia-1" href="#Include-Weave-document-in-Julia-1">Include Weave document in Julia</a></h2><p>You can call <code>include_weave</code> on a Weave document to run the contents of all code chunks in Julia.</p><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Weave.include_weave" href="#Weave.include_weave"><code>Weave.include_weave</code></a><span class="docstring-category">Function</span>.</div><div><div><pre><code class="language-none">include_weave(doc, informat=:auto)</code></pre><p>Include code from Weave document calling <code>include_string</code> on all code from doc. Code is run in the path of the include document.</p></div></div><a class="source-link" target="_blank" href="https://github.com/mpastell/Weave.jl/blob/83e2e0ae20370981df0fdb8d0f4cfef68f3cffb1/src/Weave.jl#L200-L205">source</a></section><footer><hr/><a class="previous" href="../getting_started/"><span class="direction">Previous</span><span class="title">Getting started</span></a><a class="next" href="../publish/"><span class="direction">Next</span><span class="title">Publishing to html and pdf</span></a></footer></article></body></html>