junolab / weave.jl Goto Github PK
View Code? Open in Web Editor NEWScientific reports/literate programming for Julia
Home Page: http://weavejl.mpastell.com
License: MIT License
Scientific reports/literate programming for Julia
Home Page: http://weavejl.mpastell.com
License: MIT License
This option allows a code chunk to be used by weave
but not appear in the tangle
output.
I find this useful to avoid example code and println
s in the output .jl
file.
Perhaps there is already a way to do this that I've missed?
diff --git a/src/Weave.jl b/src/Weave.jl
index ed7945c..b2eb52b 100644
--- a/src/Weave.jl
+++ b/src/Weave.jl
@@ -66,10 +66,13 @@ function tangle(source ; out_path=:doc, informat="noweb")
open(outname, "w") do io
for chunk in doc.chunks
if typeof(chunk) == CodeChunk
+ options = merge(rcParams[:chunk_defaults], chunk.options)
+ if options[:tangle]
write(io, chunk.content*"\n")
+ end
end
end
end
info("Writing to file $(doc.basename).jl")
end
diff --git a/src/config.jl b/src/config.jl
index 560fe2f..bc3c951 100644
--- a/src/config.jl
+++ b/src/config.jl
@@ -7,6 +7,7 @@ const rcParams =
Dict{Symbol,Any}(
:echo=> true,
:results=> "markup",
+ :tangle=> true,
:fig=> true,
:include=> true,
:eval => true,
Hi @mpastell, I've been looking around recently for a better rendering backend to replace Lexicon's current offering. Weave looks like it might be exactly what I'm looking for! I've not had a chance to dig into the package yet, but was wandering what your opinion would be on this since I see you're using Docile/Lexicon for some docs already?
I plan to implement simple caching of results, something like:
I might implement caching of variables and automatic depency resolution between chunks and some point, but I think itse better to get the simple options working first.
That is, the evaluated blocks are not in pweavecode
and pweaveout
environments but instead are in blocks delimited with
...
Can you tell me how I would restore the environment behavior?
I have a markdown
document (MCMC.md
). When I try to weave it from within Julia
I get:
weave("MCMC.md", doctype="md2html", out_path="html", plotlib="Gadfly", informat="markdown")
INFO: Weaving chunk 1 from line 66
INFO: Weaving chunk 2 from line 72
INFO: Weaving chunk 3 from line 79
INFO: Weaving chunk 4 from line 83
INFO: Weaving chunk 5 from line 92
INFO: Weaving chunk 6 from line 108
INFO: Weaving chunk 7 from line 120
INFO: Weaving chunk 8 from line 172
INFO: Weaving chunk 9 from line 208
INFO: Weaving chunk 10 from line 214
INFO: Weaving chunk 11 from line 218
INFO: Weaving chunk 12 from line 227
INFO: Weaving chunk 13 from line 271
INFO: Weaving chunk 14 from line 287
INFO: Weaving chunk 15 from line 301
INFO: Weaving chunk 16 from line 306
ERROR: Unable to convert to html, check that you have pandoc installed and in your path
in pandoc2html at /Users/neox/.julia/v0.4/Weave/src/pandoc.jl:32
in weave at /Users/neox/.julia/v0.4/Weave/src/Weave.jl:120
However, if I call pandoc
from the shell
pandoc -R -s --mathjax="" --self-contained --highlight-style=tango --template ~/.julia/v0.4/Weave/templates/pandoc_skeleton.html --include-in-header=/Users/neox/.julia/v0.4/Weave/templates/pandoc_skeleton.css -o mcmc.html MCMC.md
the html file is produces without error. It is not a path problem, because weaving works on other documents.
So I guess it would be useful to have the actual message returned by the system call to pandoc.
Would it make sense to add a prompt
chunk option as in Knitr. prompt=false
would not output julia>
?
I will take a look to see if I can decide what is happening. This is just a heads-up that this is occurring.
In Julia the use of global objects that are not qualified as const
is discouraged because the compiler can't do any type inference. As a result, the code is much slower than it would be if the type of the object were known. It seems that report
is only used when communicating from the weave
function through run
to savefigs
. Is this because of the structure of the underlying Python code?
This is probably not a big deal here as I imagine that most of the work is done in Python, not Julia, so Julia performance is not an issue.
On julia 0.5 I get the following with the Weave master:
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.5.0 (2016-09-19 18:14 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-w64-mingw32
julia> Pkg.test("Weave")
INFO: Computing test dependencies for Weave...
INFO: No packages to install, update or remove
INFO: Testing Weave
WARNING: Method definition latex(IO, Base.Markdown.Paragraph) in module Markdown at markdown/render/latex.jl:49 overwritten in module Weave at C:\Users\anthoff\.julia\v0.5\Weave\src\format.jl:126.
WARNING: Method definition latexinline(IO, Base.Markdown.Code) in module Markdown at markdown/render/latex.jl:43 overwritten in module Weave at C:\Users\anthoff\.julia\v0.5\Weave\src\format.jl:140.
INFO: Test: Chunk options
INFO: Weaving chunk 1 from line 2
INFO: Weaving chunk 2 from line 6
INFO: Weaving chunk 3 from line 13
INFO: Weaving chunk 4 from line 19
INFO: Weaving chunk 5 from line 25
INFO: Weaving chunk 6 from line 30
INFO: Weaving chunk 7 from line 35
INFO: Weaving chunk 8 from line 41
INFO: Weaving chunk 9 from line 45
INFO: Weaving chunk 10 from line 49
INFO: Report weaved to C:\Users\anthoff\.julia\v0.5\Weave\test\documents/chunk_options.md
Test Failed
Expression: result == ref
Evaluated: "~~~~{.julia}\njulia> y= [2, 5, 12]\n3-element Array{Int64,1}:\n 2\n 5\n 12\n~~~~~~~~~~~~~\n\n\n\n~~~~{.julia}\nx = [12, 10]\r\nprintln(y)\n~~~~~~~~~~~~~\n\n\n~~~~\n[2,5,12]\n~~~~\n\n\n\n~~~~{.julia}\nprintln(x)\n~~~~~~~~~~~~~\n\n\n~~~~\n[12,10]\n~~~~\n\n\n\n~~~~\nResults without code\n~~~~\n\n\n\n~~~~\n[12,10]\n~~~~\n\n\n\n~~~~{.julia}\ny = randn(5)\r\nprintln(\"Don't eval, but show code\")\n~~~~~~~~~~~~~\n\n\n~~~~{.julia}\ny = 1:5\r\nprintln(y)\n~~~~~~~~~~~~~\n\n\n~~~~\n1:5\n~~~~\n\n\n\n~~~~{.julia}\na = \"Don't print me\"\r\nprintln(a)\n~~~~~~~~~~~~~\n\n\n\n~~~~{.julia}\nprintln(\"No markup for results.\")\n~~~~~~~~~~~~~\n\n\nNo markup for results.\n\n\n\n\r\nTest wrapping:\r\n\r\n~~~~{.julia}\nprintln(collect(0:10:1000))\n~~~~~~~~~~~~~\n\n\n~~~~\n[0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,2\n10,220,230,240,250,260,270,280,290,300,310,320,330,340,350,360,370,380,390,\n400,410,420,430,440,450,460,470,480,490,500,510,520,530,540,550,560,570,580\n,590,600,610,620,630,640,650,660,670,680,690,700,710,720,730,740,750,760,77\n0,780,790,800,810,820,830,840,850,860,870,880,890,900,910,920,930,940,950,9\n60,970,980,990,1000]\n~~~~\n\n\n\n~~~~{.julia}\nprintln(collect(0:10:1000))\n~~~~~~~~~~~~~\n\n\n~~~~\n[0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,210,220,230,240,250,260,270,280,290,300,310,320,330,340,350,360,370,380,390,400,410,420,430,440,450,460,470,480,490,500,510,520,530,540,550,560,570,580,590,600,610,620,630,640,650,660,670,680,690,700,710,720,730,740,750,760,770,780,790,800,810,820,830,840,850,860,870,880,890,900,910,920,930,940,950,960,970,980,990,1000]\n~~~~\n\n\n\n~~~~{.julia}\nprintln(collect(0:10:1000))\n~~~~~~~~~~~~~\n\n\n~~~~\n[0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,17\n0,180,190,200,210,220,230,240,250,260,270,280,290,300,310,32\n0,330,340,350,360,370,380,390,400,410,420,430,440,450,460,47\n0,480,490,500,510,520,530,540,550,560,570,580,590,600,610,62\n0,630,640,650,660,670,680,690,700,710,720,730,740,750,760,77\n0,780,790,800,810,820,830,840,850,860,870,880,890,900,910,92\n0,930,940,950,960,970,980,990,1000]\n~~~~\n\n\n" == "~~~~{.julia}\r\njulia> y= [2, 5, 12]\r\n3-element Array{Int64,1}:\r\n 2\r\n 5\r\n 12\r\n~~~~~~~~~~~~~\r\n\r\n\r\n\r\n~~~~{.julia}\r\nx = [12, 10]\r\nprintln(y)\r\n~~~~~~~~~~~~~\r\n\r\n\r\n~~~~\r\n[2,5,12]\r\n~~~~\r\n\r\n\r\n\r\n~~~~{.julia}\r\nprintln(x)\r\n~~~~~~~~~~~~~\r\n\r\n\r\n~~~~\r\n[12,10]\r\n~~~~\r\n\r\n\r\n\r\n~~~~\r\nResults without code\r\n~~~~\r\n\r\n\r\n\r\n~~~~\r\n[12,10]\r\n~~~~\r\n\r\n\r\n\r\n~~~~{.julia}\r\ny = randn(5)\r\nprintln(\"Don't eval, but show code\")\r\n~~~~~~~~~~~~~\r\n\r\n\r\n~~~~{.julia}\r\ny = 1:5\r\nprintln(y)\r\n~~~~~~~~~~~~~\r\n\r\n\r\n~~~~\r\n1:5\r\n~~~~\r\n\r\n\r\n\r\n~~~~{.julia}\r\na = \"Don't print me\"\r\nprintln(a)\r\n~~~~~~~~~~~~~\r\n\r\n\r\n\r\n~~~~{.julia}\r\nprintln(\"No markup for results.\")\r\n~~~~~~~~~~~~~\r\n\r\n\r\nNo markup for results.\r\n\r\n\r\n\r\n\r\nTest wrapping:\r\n\r\n~~~~{.julia}\r\nprintln(collect(0:10:1000))\r\n~~~~~~~~~~~~~\r\n\r\n\r\n~~~~\r\n[0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,2\r\n10,220,230,240,250,260,270,280,290,300,310,320,330,340,350,360,370,380,390,\r\n400,410,420,430,440,450,460,470,480,490,500,510,520,530,540,550,560,570,580\r\n,590,600,610,620,630,640,650,660,670,680,690,700,710,720,730,740,750,760,77\r\n0,780,790,800,810,820,830,840,850,860,870,880,890,900,910,920,930,940,950,9\r\n60,970,980,990,1000]\r\n~~~~\r\n\r\n\r\n\r\n~~~~{.julia}\r\nprintln(collect(0:10:1000))\r\n~~~~~~~~~~~~~\r\n\r\n\r\n~~~~\r\n[0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,210,220,230,240,250,260,270,280,290,300,310,320,330,340,350,360,370,380,390,400,410,420,430,440,450,460,470,480,490,500,510,520,530,540,550,560,570,580,590,600,610,620,630,640,650,660,670,680,690,700,710,720,730,740,750,760,770,780,790,800,810,820,830,840,850,860,870,880,890,900,910,920,930,940,950,960,970,980,990,1000]\r\n~~~~\r\n\r\n\r\n\r\n~~~~{.julia}\r\nprintln(collect(0:10:1000))\r\n~~~~~~~~~~~~~\r\n\r\n\r\n~~~~\r\n[0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,17\r\n0,180,190,200,210,220,230,240,250,260,270,280,290,300,310,32\r\n0,330,340,350,360,370,380,390,400,410,420,430,440,450,460,47\r\n0,480,490,500,510,520,530,540,550,560,570,580,590,600,610,62\r\n0,630,640,650,660,670,680,690,700,710,720,730,740,750,760,77\r\n0,780,790,800,810,820,830,840,850,860,870,880,890,900,910,92\r\n0,930,940,950,960,970,980,990,1000]\r\n~~~~\r\n\r\n\r\n"
ERROR: LoadError: LoadError: There was an error during testing
in record(::Base.Test.FallbackTestSet, ::Base.Test.Fail) at .\test.jl:397
in do_test(::Base.Test.Returned, ::Expr) at .\test.jl:281
in include_from_node1(::String) at .\loading.jl:488 (repeats 2 times)
in process_options(::Base.JLOptions) at .\client.jl:262
in _start() at .\client.jl:318
while loading C:\Users\anthoff\.julia\v0.5\Weave\test\chunk_options.jl, in expression starting on line 9
while loading C:\Users\anthoff\.julia\v0.5\Weave\test\runtests.jl, in expression starting on line 11
======================================================================[ ERROR: Weave ]======================================================================
failed process: Process(`'C:\Users\anthoff\AppData\Local\julia-0.5\bin\julia' -Cx86-64 '-JC:\Users\anthoff\AppData\Local\julia-0.5\lib\julia\sys.dll' --compile=yes --depwarn=yes --check-bounds=yes --code-coverage=none --color=yes --compilecache=yes 'C:\Users\anthoff\.julia\v0.5\Weave\test\runtests.jl'`, ProcessExited(1)) [1]
============================================================================================================================================================
INFO: No packages to install, update or remove
ERROR: Weave had test errors
in #test#61(::Bool, ::Function, ::Array{AbstractString,1}) at .\pkg\entry.jl:740
in (::Base.Pkg.Entry.#kw##test)(::Array{Any,1}, ::Base.Pkg.Entry.#test, ::Array{AbstractString,1}) at .\<missing>:0
in (::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#test,Tuple{Array{AbstractString,1}}})() at .\pkg\dir.jl:31
in cd(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#test,Tuple{Array{AbstractString,1}}}, ::String) at .\file.jl:48
in #cd#1(::Array{Any,1}, ::Function, ::Function, ::Array{AbstractString,1}, ::Vararg{Array{AbstractString,1},N}) at .\pkg\dir.jl:31
in (::Base.Pkg.Dir.#kw##cd)(::Array{Any,1}, ::Base.Pkg.Dir.#cd, ::Function, ::Array{AbstractString,1}, ::Vararg{Array{AbstractString,1},N}) at .\<missing>:0
in #test#3(::Bool, ::Function, ::String, ::Vararg{String,N}) at .\pkg\pkg.jl:258
in test(::String, ::Vararg{String,N}) at .\pkg\pkg.jl:258
julia>
It would be nice to have a shell script for processing files from command line, similar to:
R CMD Sweave file.Rnw
Because Julia scripts can be easily executed from the command line, the script should parse arguments and call the weave
function, e.g.
Jweave --plotlib=Gadfly julia_latex.texw
where Jweave is
#!/usr/bin/env julia
using Weave
# code that handles cmd line arguments and call weave(....)
I am using Weave version 0.1.2 under Julia 0.5.0 to generate documentation for the MixedModels
package. The file docs/src/man/bootstrap.jmd
is the source. If I run the chunks separately, it takes about 8 seconds to execute chunk 7. When I try to weave the file it hangs at chunk 7, the call to bootstrap!
.
Wrapping long line in formatting removes newlines from results where it shouldn't. Seems like a bug in Textwrap.jl.
Name chunk options like in Knitr:
https://github.com/yihui/knitr/blob/master/R/defaults.R
it would be nice to have support for plotly plots generated with plotlyJS.jl
. I imagine that it could be possible to have a chunk option that instead of putting a link to a figure file in the markdown output writes out the JSON necessary to rendenr the figure once the markdown output is converted to html. Getting the JSON of the figure would be pretty easy (see here).
Discovered in #53
$ julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.3.2 (2014-10-21 20:18 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org release
|__/ | x86_64-linux-gnu
julia> using JuliaReport
INFO: Loading help data...
julia> weave("examples/julia_sample.mdw")
ERROR: PyError (PyObject_Call) <type 'exceptions.TypeError'>
TypeError("__init__() got an unexpected keyword argument 'shell'",)
in pyerr_check at /home/bates/.julia/v0.3/PyCall/src/exception.jl:58
in pycall at /home/bates/.julia/v0.3/PyCall/src/PyCall.jl:85
in fn at /home/bates/.julia/v0.3/PyCall/src/conversions.jl:181
in weave at /home/bates/.julia/v0.3/JuliaReport/src/JuliaReport.jl:30
I haven't worked with Python for several years so my ability to pursue this further in the Python realm is limited.
I started to work on generalising the logic with which the weaved documents is then transformed to the final document.
I am thinking to have something like this
weave(file, ::DocType, ...)
where DocType
is a type that contains the information to be passed to a pandoc(formatted, ::DocType)
.
For instance, the html
will be produced by a call to
weave("test.jmd", ::HTML) = weave("test.jmd", HTML())
where
immutable HTML
outname::AbstractString
out_path::AbtsractString
css::AbstractString
template::AbstractString
toc::bool
...
end
HTML() = HTML("", "html", "template.css", "template.html", true, ...)
Suggestions and/or comments?
is an invalid filename on Windows, so I can't clone the repo.
GitError(Code:ERROR, Class:Checkout, Cannot checkout to invalid path 'test/documents/pyplot_formats_ref.')
in macro expansion at .\libgit2\error.jl:99 [inlined]
in clone(::String, ::SubString{String}, ::Base.LibGit2.CloneOptions) at .\libgit2\repository.jl:191
in #clone#109(::String, ::Bool, ::Ptr{Void}, ::Nullable{Base.LibGit2.AbstractCredentials}, ::Function, ::String, ::SubString{String}) at .\libgit2\libgit2.jl:327
in clone(::String, ::SubString{String}) at .\pkg\entry.jl:195
in clone(::String) at .\pkg\entry.jl:221
in (::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#clone,Tuple{String}})() at .\pkg\dir.jl:31
in cd(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#clone,Tuple{String}}, ::String) at .\file.jl:48
in #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{Any,N}) at .\pkg\dir.jl:31
in clone(::String) at .\pkg\pkg.jl:151
in include_string(::String, ::String) at .\loading.jl:441
in eval(::Module, ::Any) at .\boot.jl:234
in (::Atom.##95#98)() at C:\Users\jsnot\.julia\v0.5\Atom\src\eval.jl:39
in withpath(::Atom.##95#98, ::Void) at C:\Users\jsnot\.julia\v0.5\Requires\src\require.jl:37
in withpath(::Function, ::Void) at C:\Users\jsnot\.julia\v0.5\Atom\src\eval.jl:45
in macro expansion at C:\Users\jsnot\.julia\v0.5\Atom\src\eval.jl:107 [inlined]
in (::Atom.##94#97)() at .\task.jl:60
Implemented weaving Markdown source, similar to Knitr Rmd
When I'm generating an html output file right now by essentially specifying only the input file, I get one html file plus a bunch of png files in the folder png. But those png files seem unnecessary, given that the graphics are already embedded in the html file. Would be nice if there was an option so that the only file generated is the html file (or maybe even make that the default?).
I'd like an option to set element ids.
e.g. <table id="my-table" class="data-frame">
or <div id="my-new-div" class="container">
Running weave on one of the examples generates the following errors:
julia> weave("julia_sample.mdw")
INFO: Recompiling stale cache file /Users/stephen/.julia/lib/v0.5/Gadfly.ji for module Gadfly.
INFO: Weaving chunk 1 from line 18
ERROR: syntax: { } vector syntax is discontinued
in capture_output(::Expr, ::Module, ::Bool, ::String) at /Users/stephen/.julia/v0.5/Weave/src/run.jl:142
in run_code(::Weave.CodeChunk, ::Weave.Report, ::Module) at /Users/stephen/.julia/v0.5/Weave/src/run.jl:121
in eval_chunk(::Weave.CodeChunk, ::Weave.Report, ::Module) at /Users/stephen/.julia/v0.5/Weave/src/run.jl:189
in run_chunk(::Weave.CodeChunk, ::Weave.Report, ::Module) at /Users/stephen/.julia/v0.5/Weave/src/run.jl:100
in #run#7(::Symbol, ::String, ::Symbol, ::String, ::Void, ::String, ::Symbol, ::Function, ::Weave.WeaveDoc) at /Users/stephen/.julia/v0.5/Weave/src/run.jl:67
in (::Base.#kw##run)(::Array{Any,1}, ::Base.#run, ::Weave.WeaveDoc) at ./<missing>:0
in #weave#4(::Symbol, ::String, ::Symbol, ::Symbol, ::String, ::Void, ::String, ::Symbol, ::Weave.#weave, ::String) at /Users/stephen/.julia/v0.5/Weave/src/Weave.jl:104
in weave(::String) at /Users/stephen/.julia/v0.5/Weave/src/Weave.jl:103
This is with julia 0.5 on mac with latest release of Weave
Hi,
[apologies in advance -- this is not a technical "issue"]
Thanks very much for providing this package, I am testing it out now. I just wondered whether you had considered extending knitr in R to handle julia code, rather than reimplementing a lot of knit features in julia? Knitr is a great system, much better than the original Sweave in R. e.g. caching of outputs is a great concept. I appreciate that its not ideal to use an R package from Julia.
Good luck with its development!
I'd like to create some HTML tables using Weave.jl. However, the HTML output is not strictly speaking correct. The thead
and tbody
tags are missing. I would like to include these tags, as they are required to support some further UI changes I'd like to make. Unfortunately, I can't see an option to force this.
I've had a look at getskeleton.com as well, and they also specify that these two tags should be included.
Here's some example code I am Weaving to create an HTML page with table output:
```{julia;echo=false}
using DataFrames
using RDatasets
mtcars = dataset("datasets","mtcars")
mtcars
I'm using the following to Weave:
weave("datframetest.jmd", out_path = :pwd, doctype = "md2html")
The HTML page is created fine and the table also displays reasonably well, just that those two tags are not present in the table code.
As a related question, and happy to open a separate issue if required, is there a way to set the table id
?
Use pygments JuliaConsole lexer for relevant formats.
I'm in the test/documents folder, then I'm getting this on Windows:
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.5.0 (2016-09-19 18:14 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-w64-mingw32
julia> using Weave
WARNING: Method definition latexinline(IO, Base.Markdown.Code) in module Markdown at markdown/render/latex.jl:43 overwritten in module Weave at C:\Users\anthoff\.julia\v0.5\Weave\src\format.jl:140.
WARNING: Method definition latex(IO, Base.Markdown.Paragraph) in module Markdown at markdown/render/latex.jl:49 overwritten in module Weave at C:\Users\anthoff\.julia\v0.5\Weave\src\format.jl:126.
julia> Weave.weave("plotsjl_test.jmd")
ERROR: ParseError("extra token \"}\" after end of expression")
in #parse#310(::Bool, ::Bool, ::Function, ::SubString{String}, ::Int64) at .\parse.jl:184
in (::Base.#kw##parse)(::Array{Any,1}, ::Base.#parse, ::SubString{String}, ::Int64) at .\<missing>:0
in #parse#311(::Bool, ::Function, ::SubString{String}) at .\parse.jl:194
in parse(::SubString{String}) at .\parse.jl:194
in parse_doc(::String, ::Weave.MarkupInput) at C:\Users\anthoff\.julia\v0.5\Weave\src\readers.jl:102
in parse_doc(::String, ::String) at C:\Users\anthoff\.julia\v0.5\Weave\src\readers.jl:71
in read_doc(::String, ::Symbol) at C:\Users\anthoff\.julia\v0.5\Weave\src\readers.jl:50
in #weave#4(::Symbol, ::Symbol, ::Symbol, ::Symbol, ::String, ::Void, ::String, ::Symbol, ::Void, ::Void, ::Void, ::String, ::Weave.#weave, ::String) at C:\Users\anthoff\.julia\v0.5\Weave\src\Weave.jl:79
in weave(::String) at C:\Users\anthoff\.julia\v0.5\Weave\src\Weave.jl:79
julia>
I believe right now it only accepts relative paths to the input filename, but I would also need the option to pass in an absolute path for the VS Code extension.
Is anyone using Weave working with Winston? I don't use it myself and it doesn't seem to be used that much anyway.
It works with current version, but I will probably drop Winston support in the future unless someone here wishes me to keep it.
Not sure this is actually a good idea, so more a discussion item.
There could be a build.jl script that downloads the binary distribution of pandoc that is used by RStudio, extracts it and then the package could use that and would no longer require a system installed version of pandoc.
This might make no sense on Linux and Mac (do they have pandoc installed by default?), but on Windows it would make life quite a bit easier for users because things would "just work".
If you are in general ok with this plan, I could prep a PR.
May I suggest replacing
weave("examples/julia_sample.mdw")
with
weave(Pkg.dir("JuliaReport","examples","julia_sample.mdw")
in README.md
? The latter version can be run from any directory.
diff --git a/src/formatters.jl b/src/formatters.jl
index 2490246..46dddf0 100644
--- a/src/formatters.jl
+++ b/src/formatters.jl
@@ -285,20 +285,24 @@ end
function formatfigures(chunk, docformat::Markdown)
fignames = chunk.figures
caption = chunk.options[:fig_cap]
+ width = "width=$(chunk.options[:out_width])"
result = ""
figstring = ""
length(fignames) > 0 || (return "")
if caption != nothing
- result *= "![$caption]($(fignames[1]))\n"
+ result *= "![$caption][$(fignames[1])]\n\n"
+ result *= "[$(fignames[1])]: $(fignames[1]) $width\n"
for fig = fignames[2:end]
- result *= "![]($fig)\n"
+ result *= "![][$fig]\n\n"
+ result *= "[$fig]: $fig $width\n"
println("Warning, only the first figure gets a caption\n")
end
else
for fig in fignames
- result *= "![]($fig)\n"
+ result *= "![][$fig]\n\n"
+ result *= "[$fig]: $fig $width\n"
end
end
return result
In general, the code does not seem to deal with Windows style line-endings well.
In its most basic form, the tests don't pass on Windows if the repository is cloned with the git config autocrlf=true
(the recommended setting on Windows). What happens is that all the reference output files are stored on disc with \r\n
line endings, but then the files that are written by Weave use \n
as the line ending, and all the comparisons fail. So the problem here is that Weave writes files that use Unix line ending on Windows machine, whereas it should probably use \r\n
when it writes files on Windows.
I think this also affects things on the input side. The parsing error I originally described in #70 seems to go away when I clone the repo with autocrlf=false
, which suggests to me that the code right now doesn't handle input files properly that use \r\n
for line endings.
It would be useful to be able to pass data to documents to produce reports e.g. for different files, dates etc. using the same code. Initial idea:
args
option for weave
that accepts a dictionaryWEAVE_ARGS
variable for the documentIt would be great to be able to export to and from a Jupyter notebook format.
Would this be at all possible (or is it already)?
The current HTML template has a link to the source file in it. That link is almost always going to be a local file system link, and I'm wondering how useful that is? In particular if one intends to hand these files on?
It would be nice if there was an additional option so that the footer still had the filename, but no link.
rmarkdown has support for citations and bibliographies. This would be a cool feature to add if it doesn't exist, and I could pitch in porting the code if you want?
http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html
Currently, all files are generated into the same directory were original template is located. It would be better to generate output into the directory where weave
is called, i.e. a current directory where julia
is called. It will give flexibility during batch calls as well as for cleanup.
I think I will use
`j expression`
syntax similar to Knitr for markdown,
Hi,
would it be worth including some text in the examples noting how to re-generate the documents? For example, something like this in the end of examples/julia_latex.texw
<<eval=false>>=
using Weave
weave(Pkg.dir("Weave","examples","julia_latex.texw"), doctype="tex")
@
The .tex file will be found in the examples folder, from where you can
compile it to a PDF.
Also, with the auto-generated files, such as julia_latex.tex
would it be worth adding a comment at the top of the file to note that the file should not be edited directly, but to point back to the .texw file? e.g. something like
%% This file has been automatically generated from julia_latex.texw
so that people don't mistakenly edit the .tex file later.
Hi,
I've noticed that the first part of an output chunk has an extra space before the text. You can see it on your example image:
note how the line Using Gadfly
appears in the left window (without space before it) and with one space (in the output window) on the right.
Exporting to md2html
uses the Raleway font from google font foundry. I am getting many instances in which the conversion fails because pandoc
is not able to fetch the font.
Would it be better to have the basic skeleton not to depend on any external resource (except of course for mathjax)?
hi,
Are you still using Docile/Lexicon for documentation. If so
I would like to add your project to Projects using Docile / Lexicon
if that is fine with you.
Thanks.
See #53
This would indirectly add support for backends that Plots.jl supports (http://plots.readthedocs.org/en/latest/backends/).
To set title, author etc. similar to Pandoc.
Remove
\usepackage[T1]{fontenc}
from highlight style, doesn't work with xelatex.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.