From 42845778f2abc8049cfa1b1554add5b6b1bf4461 Mon Sep 17 00:00:00 2001 From: zeptodoctor <44736852+zeptodoctor@users.noreply.github.com> Date: Sat, 30 May 2020 12:41:02 +0000 Subject: [PATCH] build based on 1972d03 --- previews/PR355/chunk_options/index.html | 2 +- previews/PR355/examples/FIR_design.html | 2 +- previews/PR355/examples/FIR_design_plots.html | 2 +- .../FIR_design_plots_4_1.png | Bin .../{jl_F2bLCV => jl_4eTexI}/FIR_design_5_1.png | Bin .../{jl_F2bLCV => jl_4eTexI}/FIR_design_6_1.png | Bin previews/PR355/function_index/index.html | 2 +- previews/PR355/getting_started/index.html | 2 +- previews/PR355/header/index.html | 2 +- previews/PR355/index.html | 2 +- previews/PR355/notebooks/index.html | 2 +- previews/PR355/publish/index.html | 2 +- previews/PR355/search/index.html | 2 +- previews/PR355/usage/index.html | 6 +++--- 14 files changed, 13 insertions(+), 13 deletions(-) rename previews/PR355/examples/{jl_JYAYmj => jl_1AZI8t}/FIR_design_plots_4_1.png (100%) rename previews/PR355/examples/{jl_F2bLCV => jl_4eTexI}/FIR_design_5_1.png (100%) rename previews/PR355/examples/{jl_F2bLCV => jl_4eTexI}/FIR_design_6_1.png (100%) diff --git a/previews/PR355/chunk_options/index.html b/previews/PR355/chunk_options/index.html index 0cdbf83..4ed2b24 100644 --- a/previews/PR355/chunk_options/index.html +++ b/previews/PR355/chunk_options/index.html @@ -8,4 +8,4 @@ ```{julia, echo = false, out_width = "12cm"}

Weave Chunk Options

Weave currently supports the following chunk options: we've mostly followed RMarkdown's namings, but not all options are implemented.

Evaluation

Rendering

Figures

Default Chunk Options

You can set the default chunk options (and weave arguments) for a document using weave_options key in YAML Header Configuration. E.g. to set the default out_width of all figures you can use:

---
 weave_options:
   out_width : 50%
----

You can also set or change the default chunk options for a document either before weave using the set_chunk_defaults function.

Weave.set_chunk_defaults!Function
set_chunk_defaults!(opts::Dict{Symbol, Any})

Set default options for code chunks, use get_chunk_defaults to see the current values.

E.g.: set default dpi to 200 and fig_width to 8

julia> set_chunk_defaults!(Dict(:dpi => 200, :fig_width => 8))
source
Weave.get_chunk_defaultsFunction
get_chunk_defaults()

Get default options used for code chunks.

source
Weave.restore_chunk_defaults!Function
restore_chunk_defaults!()

Restore Weave.jl default chunk options.

source
+---

You can also set or change the default chunk options for a document either before weave using the set_chunk_defaults function.

Weave.set_chunk_defaults!Function
set_chunk_defaults!(opts::Dict{Symbol, Any})

Set default options for code chunks, use get_chunk_defaults to see the current values.

E.g.: set default dpi to 200 and fig_width to 8

julia> set_chunk_defaults!(Dict(:dpi => 200, :fig_width => 8))
source
Weave.get_chunk_defaultsFunction
get_chunk_defaults()

Get default options used for code chunks.

source
Weave.restore_chunk_defaults!Function
restore_chunk_defaults!()

Restore Weave.jl default chunk options.

source
diff --git a/previews/PR355/examples/FIR_design.html b/previews/PR355/examples/FIR_design.html index b33878f..18fdd3b 100644 --- a/previews/PR355/examples/FIR_design.html +++ b/previews/PR355/examples/FIR_design.html @@ -791,7 +791,7 @@ FIRfreqz (generic function with 2 methods) diff --git a/previews/PR355/examples/FIR_design_plots.html b/previews/PR355/examples/FIR_design_plots.html index 4ad35bd..9e646dc 100644 --- a/previews/PR355/examples/FIR_design_plots.html +++ b/previews/PR355/examples/FIR_design_plots.html @@ -797,7 +797,7 @@ FIRfreqz (generic function with 2 methods) diff --git a/previews/PR355/examples/jl_JYAYmj/FIR_design_plots_4_1.png b/previews/PR355/examples/jl_1AZI8t/FIR_design_plots_4_1.png similarity index 100% rename from previews/PR355/examples/jl_JYAYmj/FIR_design_plots_4_1.png rename to previews/PR355/examples/jl_1AZI8t/FIR_design_plots_4_1.png diff --git a/previews/PR355/examples/jl_F2bLCV/FIR_design_5_1.png b/previews/PR355/examples/jl_4eTexI/FIR_design_5_1.png similarity index 100% rename from previews/PR355/examples/jl_F2bLCV/FIR_design_5_1.png rename to previews/PR355/examples/jl_4eTexI/FIR_design_5_1.png diff --git a/previews/PR355/examples/jl_F2bLCV/FIR_design_6_1.png b/previews/PR355/examples/jl_4eTexI/FIR_design_6_1.png similarity index 100% rename from previews/PR355/examples/jl_F2bLCV/FIR_design_6_1.png rename to previews/PR355/examples/jl_4eTexI/FIR_design_6_1.png diff --git a/previews/PR355/function_index/index.html b/previews/PR355/function_index/index.html index b62af48..c0046bc 100644 --- a/previews/PR355/function_index/index.html +++ b/previews/PR355/function_index/index.html @@ -1,2 +1,2 @@ -Function index · Weave.jl
+Function index · Weave.jl
diff --git a/previews/PR355/getting_started/index.html b/previews/PR355/getting_started/index.html index 726d065..68d1262 100644 --- a/previews/PR355/getting_started/index.html +++ b/previews/PR355/getting_started/index.html @@ -10,4 +10,4 @@ weave(filename; doctype = "md2html", out_path = :pwd) weave(filename; doctype = "md2pdf", out_path = :pwd) # Julia markdown to Pandoc markdown -weave(filename; doctype = "pandoc", out_path = :pwd)
Tips

Weave.EXAMPLE_FOLDER points to the examples directory.

+weave(filename; doctype = "pandoc", out_path = :pwd)
Tips

Weave.EXAMPLE_FOLDER points to the examples directory.

diff --git a/previews/PR355/header/index.html b/previews/PR355/header/index.html index fe0cc40..cf4195d 100644 --- a/previews/PR355/header/index.html +++ b/previews/PR355/header/index.html @@ -27,4 +27,4 @@ weave_options: md2pdf: out_path : pdf fig_ext : .png ---- +--- diff --git a/previews/PR355/index.html b/previews/PR355/index.html index dee78e1..88304a1 100644 --- a/previews/PR355/index.html +++ b/previews/PR355/index.html @@ -1,2 +1,2 @@ -Weave.jl - Scientific Reports Using Julia · Weave.jl

Weave.jl - Scientific Reports Using Julia

This is the documentation of Weave.jl. Weave is a scientific report generator/literate programming tool for Julia. It resembles Pweave, knitr, R Markdown, and Sweave.

Current features

  • Publish markdown directly to HTML and PDF using Julia or Pandoc
  • Execute code as in terminal or in a unit of code chunk
  • Capture Plots.jl or Gadfly.jl figures
  • Supports various input format: Markdown, Noweb, Jupyter Notebook, and ordinal Julia script
  • Conversions between those input formats
  • Supports various output document formats: HTML, PDF, GitHub markdown, Jupyter Notebook, MultiMarkdown, Asciidoc and reStructuredText
  • Simple caching of results

Weave in Juno demo

Index

+Weave.jl - Scientific Reports Using Julia · Weave.jl

Weave.jl - Scientific Reports Using Julia

This is the documentation of Weave.jl. Weave is a scientific report generator/literate programming tool for Julia. It resembles Pweave, knitr, R Markdown, and Sweave.

Current features

  • Publish markdown directly to HTML and PDF using Julia or Pandoc
  • Execute code as in terminal or in a unit of code chunk
  • Capture Plots.jl or Gadfly.jl figures
  • Supports various input format: Markdown, Noweb, Jupyter Notebook, and ordinal Julia script
  • Conversions between those input formats
  • Supports various output document formats: HTML, PDF, GitHub markdown, Jupyter Notebook, MultiMarkdown, Asciidoc and reStructuredText
  • Simple caching of results

Weave in Juno demo

Index

diff --git a/previews/PR355/notebooks/index.html b/previews/PR355/notebooks/index.html index b3dff1f..f55b7b5 100644 --- a/previews/PR355/notebooks/index.html +++ b/previews/PR355/notebooks/index.html @@ -1,2 +1,2 @@ -Working with Jupyter notebooks · Weave.jl

Working with Jupyter notebooks

Weaving from Jupyter notebooks

Weave supports using Jupyter Notebooks as input format. This means you can weave notebooks to any supported formats; by default, it will be weaved to HTML.

weave("notebook.ipynb") # will be weaved to HTML
Warning

You can't use chunk options with notebooks.

Output to Jupyter notebooks

As of Weave 0.5.1. there is new notebook method to convert Weave documents to Jupyter notebooks using nbconvert.

Weave.notebookFunction
notebook(source::AbstractString; kwargs...)

Convert Weave document source to Jupyter Notebook and execute the code using nbconvert. Ignores all chunk options.

Keyword options

  • out_path::Union{Symbol,AbstractString} = :pwd: Path where the output is generated can be either of:
    • :doc: Path of the source document
    • :pwd: Julia working directory (default)
    • "somepath": String of output directory e.g. "~/outdir", or of filename e.g. "~/outdir/outfile.tex"
  • timeout = -1: nbconvert cell timeout in seconds. Defaults to -1 (no timeout)
  • nbconvert_options::AbstractString = "": String of additional options to pass to nbconvert, such as "--allow-errors"
  • jupyter_path::AbstractString = "jupyter": Path/command for the Jupyter you want to use. Defaults to "jupyter", which runs whatever is linked/alias to that
Warning

The code is not executed by Weave, but by nbconvert. This means that the output doesn't necessarily always work properly; see #116.

Note

In order to just convert Weave document to Jupyter Notebook, use convert_doc instead.

source

You can specify jupyter used to execute the notebook with the jupyter_path keyword argument (this defaults to the "jupyter", i.e. whatever you have linked to that location).

Instead, you might want to use the convert_doc method below and run the code in Jupyter.

Converting between formats

You can convert between all supported input formats using the convert_doc function.

To convert from script to notebook:

convert_doc("examples/FIR_design.jl", "FIR_design.ipynb")

and from notebook to Markdown use:

convert_doc("FIR_design.ipynb", "FIR_design.jmd")
Weave.convert_docFunction
convert_doc(infile::AbstractString, outfile::AbstractString; outformat::Union{Nothing,AbstractString} = nothing)

Convert Weave documents between different formats

  • infile: Path of the input document
  • outfile: Path of the output document
  • outformat = nothing: Output document format (optional). By default (i.e. given nothing) Weave will try to automatically detect it from the outfile's extension. You can also specify either of "script", "markdown", "notebook", or "noweb"
source
+Working with Jupyter notebooks · Weave.jl

Working with Jupyter notebooks

Weaving from Jupyter notebooks

Weave supports using Jupyter Notebooks as input format. This means you can weave notebooks to any supported formats; by default, it will be weaved to HTML.

weave("notebook.ipynb") # will be weaved to HTML
Warning

You can't use chunk options with notebooks.

Output to Jupyter notebooks

As of Weave 0.5.1. there is new notebook method to convert Weave documents to Jupyter notebooks using nbconvert.

Weave.notebookFunction
notebook(source::AbstractString; kwargs...)

Convert Weave document source to Jupyter Notebook and execute the code using nbconvert. Ignores all chunk options.

Keyword options

  • out_path::Union{Symbol,AbstractString} = :pwd: Path where the output is generated can be either of:
    • :doc: Path of the source document
    • :pwd: Julia working directory (default)
    • "somepath": String of output directory e.g. "~/outdir", or of filename e.g. "~/outdir/outfile.tex"
  • timeout = -1: nbconvert cell timeout in seconds. Defaults to -1 (no timeout)
  • nbconvert_options::AbstractString = "": String of additional options to pass to nbconvert, such as "--allow-errors"
  • jupyter_path::AbstractString = "jupyter": Path/command for the Jupyter you want to use. Defaults to "jupyter", which runs whatever is linked/alias to that
Warning

The code is not executed by Weave, but by nbconvert. This means that the output doesn't necessarily always work properly; see #116.

Note

In order to just convert Weave document to Jupyter Notebook, use convert_doc instead.

source

You can specify jupyter used to execute the notebook with the jupyter_path keyword argument (this defaults to the "jupyter", i.e. whatever you have linked to that location).

Instead, you might want to use the convert_doc method below and run the code in Jupyter.

Converting between formats

You can convert between all supported input formats using the convert_doc function.

To convert from script to notebook:

convert_doc("examples/FIR_design.jl", "FIR_design.ipynb")

and from notebook to Markdown use:

convert_doc("FIR_design.ipynb", "FIR_design.jmd")
Weave.convert_docFunction
convert_doc(infile::AbstractString, outfile::AbstractString; outformat::Union{Nothing,AbstractString} = nothing)

Convert Weave documents between different formats

  • infile: Path of the input document
  • outfile: Path of the output document
  • outformat = nothing: Output document format (optional). By default (i.e. given nothing) Weave will try to automatically detect it from the outfile's extension. You can also specify either of "script", "markdown", "notebook", or "noweb"
source
diff --git a/previews/PR355/publish/index.html b/previews/PR355/publish/index.html index eed36da..b5562e9 100644 --- a/previews/PR355/publish/index.html +++ b/previews/PR355/publish/index.html @@ -6,4 +6,4 @@ date: 15th December 2016 ---

Here are sample input and outputs:

They are generated as follows:

weave(Weave.SAMPLE_JL_DOC)) # default to md2html output format
 weave(Weave.SAMPLE_JL_DOC; doctype = "md2pdf")
Tips

Weave.SAMPLE_JL_DOC is the path of FIR_design.jl.

Note

"md2html" and "md2pdf" assume Julia markdown format as an input, while pandoc2pdf and pandoc2html assume Noweb input format (i.e. Pandoc markdown).

Templates

You can use a custom template with md2html and md2pdf formats with template keyword option, e.g.: weave("FIR_design_plots.jl", template = "custom.tpl".

As starting point, you can use the existing templates:

Templates are rendered using Mustache.jl.

Supported Markdown syntax

The markdown variant used by Weave is Julia markdown. In addition Weave supports few additional Markdown features:

Comments

You can add comments using html syntax: <!-- -->

Multiline equations

You can add multiline equations using:

$$
 x^2 = x*x
-$$
+$$ diff --git a/previews/PR355/search/index.html b/previews/PR355/search/index.html index 6750714..50e3503 100644 --- a/previews/PR355/search/index.html +++ b/previews/PR355/search/index.html @@ -1,2 +1,2 @@ -Search · Weave.jl

Loading search...

    +Search · Weave.jl

    Loading search...

      diff --git a/previews/PR355/usage/index.html b/previews/PR355/usage/index.html index 2b3751b..1353674 100644 --- a/previews/PR355/usage/index.html +++ b/previews/PR355/usage/index.html @@ -2,7 +2,7 @@ Using Weave · Weave.jl

      Using Weave

      You can write your documentation and code in input document using Markdown, Noweb or script syntax and use weave function to execute to document to capture results and figures.

      weave

      Weave document with markup and julia code using Plots.jl for plots, out_path = :pwd makes the results appear in the current working directory.

      A prepared example: Weave.SAMPLE_JL_DOC

      # First add depencies for the example
       using Pkg; Pkg.add.(["Plots", "DSP"])
       using Weave
      -weave(Weave.SAMPLE_JL_DOC; out_path=:pwd)
      Weave.weaveFunction
      weave(source::AbstractString; kwargs...)

      Weave an input document to output file.

      Keyword options

      • doctype::Union{Nothing,AbstractString} = nothing: Output document format. By default (i.e. given nothing), Weave will set it automatically based on file extension. You can also manually specify it; see list_out_formats() for the supported formats
      • informat::Union{Nothing,AbstractString} = nothing: Input document format. By default (i.e. given nothing), Weave will set it automatically based on file extension. You can also specify either of "script", "markdown", "notebook", or "noweb"
      • out_path::Union{Symbol,AbstractString} = :doc: Path where the output is generated can be either of:
        • :doc: Path of the source document (default)
        • :pwd: Julia working directory
        • "somepath": String of output directory e.g. "~/outdir", or of filename e.g. "~/outdir/outfile.tex"
      • args::Dict = Dict(): Arguments to be passed to the weaved document; will be available as WEAVE_ARGS in the document
      • mod::Union{Module,Nothing} = nothing: Module where Weave evals code. You can pass a Module object, otherwise create an new sandbox module.
      • fig_path::AbstractString = "figures": Where figures will be generated, relative to out_path
      • fig_ext::Union{Nothing,AbstractString} = nothing: Extension for saved figures e.g. ".pdf", ".png". Default setting depends on doctype
      • cache_path::AbstractString = "cache": Where of cached output will be saved
      • cache::Symbol = :off: Controls caching of code:
        • :off means no caching (default)
        • :all caches everything
        • :user caches based on chunk options
        • :refresh runs all code chunks and save new cache
      • throw_errors::Bool = false: If false errors are included in output document and the whole document is executed. If true errors are thrown when they occur
      • template::Union{Nothing,AbstractString,Mustache.MustacheTokens} = nothing: Template (file path) or Mustache.MustacheTokenss for md2html or md2tex formats
      • css::Union{Nothing,AbstractString} = nothing: Path of a CSS file used for md2html format
      • highlight_theme::Union{Nothing,Type{<:Highlights.AbstractTheme}} = nothing: Theme used for syntax highlighting (defaults to Highlights.Themes.DefaultTheme)
      • pandoc_options::Vector{<:AbstractString} = String[]: Strings of options to pass to pandoc for pandoc2html and pandoc2pdf formats, e.g. ["--toc", "-N"]
      • latex_cmd::AbstractString = "xelatex": The command used to make PDF file from .tex
      • keep_unicode::Bool = false: If true, do not convert unicode characters to their respective latex representation. This is especially useful if a font and tex-engine with support for unicode characters are used
      Note

      Run Weave from terminal and try to avoid weaving from IJulia or ESS; they tend to mess with capturing output.

      source

      tangle

      Tangling extracts the code from document:

      Weave.tangleFunction
      tangle(source::AbstractString; kwargs...)

      Tangle source code from input document to .jl file.

      Keyword options

      • informat::Union{Nothing,AbstractString} = nothing: Input document format. By default (i.e. given nothing), Weave will set it automatically based on file extension. You can also specify either of "script", "markdown", "notebook", or "noweb"
      • out_path::Union{Symbol,AbstractString} = :doc: Path where the output is generated can be either of:
        • :doc: Path of the source document (default)
        • :pwd: Julia working directory
        • "somepath": String of output directory e.g. "~/outdir", or of filename e.g. "~/outdir/outfile.tex"
      source

      Supported Output Formats

      Weave automatically detects the output format based on the file extension. The auto output format detection is handled by detect_doctype(path::AbstractString):

      function detect_doctype(path::AbstractString)
      +weave(Weave.SAMPLE_JL_DOC; out_path=:pwd)
      Weave.weaveFunction
      weave(source::AbstractString; kwargs...)

      Weave an input document to output file.

      Keyword options

      • doctype::Union{Nothing,AbstractString} = nothing: Output document format. By default (i.e. given nothing), Weave will set it automatically based on file extension. You can also manually specify it; see list_out_formats() for the supported formats
      • informat::Union{Nothing,AbstractString} = nothing: Input document format. By default (i.e. given nothing), Weave will set it automatically based on file extension. You can also specify either of "script", "markdown", "notebook", or "noweb"
      • out_path::Union{Symbol,AbstractString} = :doc: Path where the output is generated can be either of:
        • :doc: Path of the source document (default)
        • :pwd: Julia working directory
        • "somepath": String of output directory e.g. "~/outdir", or of filename e.g. "~/outdir/outfile.tex"
      • args::Dict = Dict(): Arguments to be passed to the weaved document; will be available as WEAVE_ARGS in the document
      • mod::Union{Module,Nothing} = nothing: Module where Weave evals code. You can pass a Module object, otherwise create an new sandbox module.
      • fig_path::AbstractString = "figures": Where figures will be generated, relative to out_path
      • fig_ext::Union{Nothing,AbstractString} = nothing: Extension for saved figures e.g. ".pdf", ".png". Default setting depends on doctype
      • cache_path::AbstractString = "cache": Where of cached output will be saved
      • cache::Symbol = :off: Controls caching of code:
        • :off means no caching (default)
        • :all caches everything
        • :user caches based on chunk options
        • :refresh runs all code chunks and save new cache
      • throw_errors::Bool = false: If false errors are included in output document and the whole document is executed. If true errors are thrown when they occur
      • template::Union{Nothing,AbstractString,Mustache.MustacheTokens} = nothing: Template (file path) or Mustache.MustacheTokenss for md2html or md2tex formats
      • css::Union{Nothing,AbstractString} = nothing: Path of a CSS file used for md2html format
      • highlight_theme::Union{Nothing,Type{<:Highlights.AbstractTheme}} = nothing: Theme used for syntax highlighting (defaults to Highlights.Themes.DefaultTheme)
      • pandoc_options::Vector{<:AbstractString} = String[]: Strings of options to pass to pandoc for pandoc2html and pandoc2pdf formats, e.g. ["--toc", "-N"]
      • latex_cmd::AbstractString = "xelatex": The command used to make PDF file from .tex
      • keep_unicode::Bool = false: If true, do not convert unicode characters to their respective latex representation. This is especially useful if a font and tex-engine with support for unicode characters are used
      Note

      Run Weave from terminal and try to avoid weaving from IJulia or ESS; they tend to mess with capturing output.

      source

      tangle

      Tangling extracts the code from document:

      Weave.tangleFunction
      tangle(source::AbstractString; kwargs...)

      Tangle source code from input document to .jl file.

      Keyword options

      • informat::Union{Nothing,AbstractString} = nothing: Input document format. By default (i.e. given nothing), Weave will set it automatically based on file extension. You can also specify either of "script", "markdown", "notebook", or "noweb"
      • out_path::Union{Symbol,AbstractString} = :doc: Path where the output is generated can be either of:
        • :doc: Path of the source document (default)
        • :pwd: Julia working directory
        • "somepath": String of output directory e.g. "~/outdir", or of filename e.g. "~/outdir/outfile.tex"
      source

      Supported Output Formats

      Weave automatically detects the output format based on the file extension. The auto output format detection is handled by detect_doctype(path::AbstractString):

      function detect_doctype(path::AbstractString)
           _, ext = lowercase.(splitext(path))
       
           match(r"^\.(jl|.?md|ipynb)", ext) !== nothing && return "md2html"
      @@ -11,7 +11,7 @@ weave(Weave.SAMPLE_JL_DOC; out_path=:pwd)

      You can also manually specify it using the doctype keyword option. You can get a list of supported output formats:

      list_out_formats()
      github: GitHub markdown
      +end

      You can also manually specify it using the doctype keyword option. You can get a list of supported output formats:

      list_out_formats()
      github: GitHub markdown
       md2tex: Julia markdown to latex
       pandoc2html: Markdown to HTML (requires Pandoc 2)
       pandoc: Pandoc markdown
      @@ -36,4 +36,4 @@ return "noweb"

      Pweave and the concept is similar to publishing documents with MATLAB or using Knitr's spin. Weave will remove the first empty space from each line of documentation.

      Configuration via YAML Header

      When weaveing markdown files, you can use YAML header to provide additional metadata and configuration options. See Header Configuration section for more details.

      Passing Runtime Arguments to Documents

      You can pass arguments as Dict to the weaved document using the args argument to weave. The arguments will be available as WEAVE_ARGS variable in the document.

      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.

      In order to pass a filename to a document you need call weave using:

      weave("mydoc.jmd", args = Dict("filename" => "somedata.h5"))

      and you can access the filename from document as follows:

          ```julia
           print(WEAVE_ARGS["filename"])
           ```

      You can use the out_path argument to control the name of the output document.

      include_weave

      You can call include_weave on a Weave document and run all code chunks within in the current session.

      Weave.include_weaveFunction
      include_weave(source::AbstractString, informat::Union{Nothing,AbstractString} = nothing)
      -include_weave(m::Module, source::AbstractString, informat::Union{Nothing,AbstractString} = nothing)

      Include code from Weave document calling include_string on all code from doc. Code is run in the path of the include document.

      source
      +include_weave(m::Module, source::AbstractString, informat::Union{Nothing,AbstractString} = nothing)

      Include code from Weave document calling include_string on all code from doc. Code is run in the path of the include document.

      source