dyndoc-ruby-core 1.2.5 → 1.4.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/dyndoc/Tools/julia/Fig.dyn +28 -0
- data/lib/dyndoc-core.rb +7 -0
- data/lib/dyndoc/base/filter/server.rb +61 -25
- data/lib/dyndoc/base/scanner.rb +4 -3
- data/lib/dyndoc/base/tmpl/eval.rb +9 -7
- data/lib/dyndoc/base/tmpl/manager.rb +17 -7
- data/lib/dyndoc/base/tmpl/parse_do.rb +62 -33
- data/lib/dyndoc/init/config.rb +9 -1
- data/share/julia/dynArray.jl +20 -19
- data/share/julia/dyndoc.jl +51 -82
- data/share/julia/dyndocOLD.jl +192 -0
- data/share/julia/dynreport.jl +127 -0
- data/share/julia/ruby.jl +6 -6
- metadata +68 -67
@@ -0,0 +1,127 @@
|
|
1
|
+
|
2
|
+
## Inspired from the excellent weave.jl
|
3
|
+
|
4
|
+
using Compat
|
5
|
+
|
6
|
+
#Contains report global properties
|
7
|
+
mutable struct DyndocReport <: AbstractDisplay
|
8
|
+
#cwd::AbstractString
|
9
|
+
#basename::AbstractString
|
10
|
+
#formatdict::Dict{Symbol,Any}
|
11
|
+
#pending_code::AbstractString
|
12
|
+
#cur_result::AbstractString
|
13
|
+
#rich_output::AbstractString
|
14
|
+
fignum::Int
|
15
|
+
figures::Array{AbstractString}
|
16
|
+
#term_state::Symbol
|
17
|
+
#cur_chunk
|
18
|
+
mimetypes::Array{AbstractString}
|
19
|
+
# first_plot::Bool
|
20
|
+
#header_script::String
|
21
|
+
#throw_errors::Bool
|
22
|
+
end
|
23
|
+
|
24
|
+
#function Report(cwd, basename, formatdict, mimetypes, throw_errors)
|
25
|
+
# Report(cwd, basename, formatdict, "", "", "", 1, AbstractString[], :text, nothing,
|
26
|
+
# mimetypes, true, "", throw_errors)
|
27
|
+
#end
|
28
|
+
|
29
|
+
|
30
|
+
#Default mimetypes in order, can be overridden for some inside `run method` formats
|
31
|
+
const default_mime_types = ["image/svg+xml", "image/png", "text/html", "text/plain"]
|
32
|
+
#const default_mime_types = ["image/png", "image/svg+xml", "text/html", "text/plain"]
|
33
|
+
#From IJulia as a reminder
|
34
|
+
#const supported_mime_types = [ "text/html", "text/latex", "image/svg+xml", "image/png", "image/jpeg", "text/plain", "text/markdown" ]
|
35
|
+
|
36
|
+
function Base.display(report::DyndocReport, data)
|
37
|
+
#Set preferred mimetypes for report based on format
|
38
|
+
for m in report.mimetypes
|
39
|
+
if showable(m, data)
|
40
|
+
try
|
41
|
+
if !istextmime(m)
|
42
|
+
Compat.invokelatest(display, report, m, data)
|
43
|
+
elseif report.cur_chunk.options[:term]
|
44
|
+
Compat.invokelatest(display, report, "text/plain", data)
|
45
|
+
else
|
46
|
+
Compat.invokelatest(display, report, m, data)
|
47
|
+
end
|
48
|
+
catch e
|
49
|
+
throw(e)
|
50
|
+
@warn("Failed to display data in \"$m\" format")
|
51
|
+
continue
|
52
|
+
end
|
53
|
+
break
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
function Base.display(report::DyndocReport, m::MIME"image/png", data)
|
59
|
+
figname = add_figure(report, data, m, ".png")
|
60
|
+
end
|
61
|
+
|
62
|
+
function Base.display(report::DyndocReport, m::MIME"image/svg+xml", data)
|
63
|
+
figname = add_figure(report, data, m, ".svg")
|
64
|
+
end
|
65
|
+
|
66
|
+
function Base.display(report::DyndocReport, m::MIME"application/pdf", data)
|
67
|
+
figname = add_figure(report, data, m, ".pdf")
|
68
|
+
end
|
69
|
+
|
70
|
+
#Text is written to stdout, called from "term" mode chunks
|
71
|
+
function Base.display(report::DyndocReport, m::MIME"text/plain", data)
|
72
|
+
io = PipeBuffer()
|
73
|
+
show(IOContext(io, :limit => true), m, data)
|
74
|
+
flush(io)
|
75
|
+
s = read(io, String)
|
76
|
+
close(io)
|
77
|
+
println(s)
|
78
|
+
end
|
79
|
+
|
80
|
+
function Base.display(report::DyndocReport, m::MIME"text/plain", data::Exception)
|
81
|
+
println("Error: " * sprint(showerror, data))
|
82
|
+
end
|
83
|
+
|
84
|
+
function Base.display(report::DyndocReport, m::MIME"text/html", data::Exception)
|
85
|
+
report.rich_output = sprint(show, m, data)
|
86
|
+
end
|
87
|
+
|
88
|
+
function Base.show(io, m::MIME"text/html", data::Exception)
|
89
|
+
println(io ,"<pre class=\"julia-error\">")
|
90
|
+
println(io, Markdown.htmlesc("ERROR: " * sprint(showerror, data)))
|
91
|
+
println(io ,"</pre>")
|
92
|
+
end
|
93
|
+
|
94
|
+
#Catch "rich_output"
|
95
|
+
function Base.display(report::DyndocReport, m::MIME"text/html", data)
|
96
|
+
s = repr(m, data)
|
97
|
+
report.rich_output *= "\n" * s
|
98
|
+
end
|
99
|
+
|
100
|
+
#Catch "rich_output"
|
101
|
+
function Base.display(report::DyndocReport, m::MIME"text/markdown", data)
|
102
|
+
s = repr(m, data)
|
103
|
+
report.rich_output *= "\n" * s
|
104
|
+
end
|
105
|
+
|
106
|
+
function Base.display(report::DyndocReport, m::MIME"text/latex", data)
|
107
|
+
s = repr(m, data)
|
108
|
+
report.rich_output *= "\n" * s
|
109
|
+
end
|
110
|
+
|
111
|
+
"""Add saved figure name to results and return the name"""
|
112
|
+
function add_figure(report::DyndocReport, data, m, ext)
|
113
|
+
chunk = report.cur_chunk
|
114
|
+
full_name, rel_name = get_figname(report, chunk, ext = ext)
|
115
|
+
|
116
|
+
open(full_name, "w") do io
|
117
|
+
if ext == ".pdf"
|
118
|
+
write(io, repr(m, data))
|
119
|
+
else
|
120
|
+
show(io, m, data)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
push!(report.figures, rel_name)
|
125
|
+
report.fignum += 1
|
126
|
+
return full_name
|
127
|
+
end
|
data/share/julia/ruby.jl
CHANGED
@@ -1,28 +1,28 @@
|
|
1
1
|
|
2
2
|
|
3
3
|
module Ruby
|
4
|
-
|
5
|
-
librb=Libdl.dlopen(("JULIA_RUBYLIB_PATH" in keys(ENV)) ? ENV["JULIA_RUBYLIB_PATH"] : "libruby")
|
4
|
+
using Libdl
|
5
|
+
librb=Libdl.dlopen(("JULIA_RUBYLIB_PATH" in keys(ENV)) ? ENV["JULIA_RUBYLIB_PATH"] : "/usr/lib/libruby")
|
6
6
|
|
7
7
|
export start,stop,run,alive
|
8
8
|
|
9
9
|
global ruby_alive=false
|
10
10
|
|
11
11
|
function start()
|
12
|
-
ccall(Libdl.dlsym(librb,:ruby_init),
|
13
|
-
ccall(Libdl.dlsym(librb,:ruby_init_loadpath),
|
12
|
+
ccall(Libdl.dlsym(librb,:ruby_init),Cvoid,())
|
13
|
+
ccall(Libdl.dlsym(librb,:ruby_init_loadpath),Cvoid,())
|
14
14
|
ruby_alive=true
|
15
15
|
end
|
16
16
|
|
17
17
|
function stop()
|
18
|
-
ccall(Libdl.dlsym(librb,:ruby_finalize),
|
18
|
+
ccall(Libdl.dlsym(librb,:ruby_finalize),Cvoid,())
|
19
19
|
ruby_alive=false
|
20
20
|
end
|
21
21
|
|
22
22
|
function run(code::AbstractString)
|
23
23
|
state=1 #not modified then
|
24
24
|
##println(code)
|
25
|
-
res=ccall(Libdl.dlsym(librb,:rb_eval_string_protect),Ptr{UInt64},(Ptr{UInt8},
|
25
|
+
res=ccall(Libdl.dlsym(librb,:rb_eval_string_protect),Ptr{UInt64},(Ptr{UInt8},Ref{UInt32}),string(code),state)
|
26
26
|
return nothing
|
27
27
|
end
|
28
28
|
|
metadata
CHANGED
@@ -1,98 +1,63 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dyndoc-ruby-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CQLS
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: configliere
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.4'
|
20
|
-
- -
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 0.4.18
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - ~>
|
27
|
+
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0.4'
|
30
|
-
- -
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.4.18
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: ultraviolet
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- -
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '1.0'
|
40
|
-
- - '>='
|
37
|
+
- - ">="
|
41
38
|
- !ruby/object:Gem::Version
|
42
39
|
version: 1.0.0
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '1.0'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '1.0'
|
50
|
-
- - '>='
|
47
|
+
- - ">="
|
51
48
|
- !ruby/object:Gem::Version
|
52
49
|
version: 1.0.0
|
53
|
-
|
54
|
-
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '1.0'
|
53
|
+
description: " Provide templating in text document.\n"
|
55
54
|
email: rdrouilh@gmail.com
|
56
55
|
executables: []
|
57
56
|
extensions: []
|
58
57
|
extra_rdoc_files: []
|
59
58
|
files:
|
60
|
-
-
|
61
|
-
-
|
62
|
-
- lib/dyndoc/base/filter/call.rb
|
63
|
-
- lib/dyndoc/base/filter/filter_mngr.rb
|
64
|
-
- lib/dyndoc/base/filter/server.rb
|
65
|
-
- lib/dyndoc/base/filters.rb
|
66
|
-
- lib/dyndoc/base/helpers.rb
|
67
|
-
- lib/dyndoc/base/helpers/core.rb
|
68
|
-
- lib/dyndoc/base/helpers/parser.rb
|
69
|
-
- lib/dyndoc/base/scanner.rb
|
70
|
-
- lib/dyndoc/base/tags.rb
|
71
|
-
- lib/dyndoc/base/tags/keys_mngr.rb
|
72
|
-
- lib/dyndoc/base/tags/part_tag.rb
|
73
|
-
- lib/dyndoc/base/tags/tag_mngr.rb
|
74
|
-
- lib/dyndoc/base/tags/user_tag.rb
|
75
|
-
- lib/dyndoc/base/tmpl.rb
|
76
|
-
- lib/dyndoc/base/tmpl/eval.rb
|
77
|
-
- lib/dyndoc/base/tmpl/extension.rb
|
78
|
-
- lib/dyndoc/base/tmpl/manager.rb
|
79
|
-
- lib/dyndoc/base/tmpl/oop.rb
|
80
|
-
- lib/dyndoc/base/tmpl/parse_do.rb
|
81
|
-
- lib/dyndoc/base/tmpl/rbenvir.rb
|
82
|
-
- lib/dyndoc/base/utils.rb
|
83
|
-
- lib/dyndoc/common/dynArray.rb
|
84
|
-
- lib/dyndoc/common/file.rb
|
85
|
-
- lib/dyndoc/common/init.rb
|
86
|
-
- lib/dyndoc/common/tilt.rb
|
87
|
-
- lib/dyndoc/common/utils.rb
|
88
|
-
- lib/dyndoc/common/uv.rb
|
89
|
-
- lib/dyndoc/init/config.rb
|
90
|
-
- lib/dyndoc/init/home.rb
|
91
|
-
- lib/dyndoc/plugins/tex.rb
|
92
|
-
- lib/dyndoc/plugins/tex/beamer.rb
|
93
|
-
- lib/dyndoc/plugins/tex/tex_eval.rb
|
94
|
-
- lib/dyndoc/plugins/tex/tex_parse_do.rb
|
95
|
-
- lib/dyndoc/plugins/tex/tex_user_tag.rb
|
59
|
+
- dyndoc/Dyn/.postload
|
60
|
+
- dyndoc/Dyn/.preload
|
96
61
|
- dyndoc/Dyn/After.dyn
|
97
62
|
- dyndoc/Dyn/Base.dyn
|
98
63
|
- dyndoc/Dyn/Minimum.dyn
|
@@ -130,6 +95,8 @@ files:
|
|
130
95
|
- dyndoc/Style/Text/StdAlias.dyn
|
131
96
|
- dyndoc/Style/Text/StdTex.dyn
|
132
97
|
- dyndoc/Style/Text/Txt.dyn
|
98
|
+
- dyndoc/Tex/.postload
|
99
|
+
- dyndoc/Tex/.preload
|
133
100
|
- dyndoc/Tex/10pt_tmpl.tex
|
134
101
|
- dyndoc/Tex/11pt_tmpl.tex
|
135
102
|
- dyndoc/Tex/12pt_tmpl.tex
|
@@ -178,43 +145,77 @@ files:
|
|
178
145
|
- dyndoc/Tools/Web/TabBar.dyn
|
179
146
|
- dyndoc/Tools/Web/Ttm.dyn
|
180
147
|
- dyndoc/Tools/Web/Txtl.dyn
|
181
|
-
-
|
182
|
-
-
|
183
|
-
-
|
148
|
+
- dyndoc/Tools/julia/Fig.dyn
|
149
|
+
- lib/dyndoc-core.rb
|
150
|
+
- lib/dyndoc/base/envir.rb
|
151
|
+
- lib/dyndoc/base/filter/call.rb
|
152
|
+
- lib/dyndoc/base/filter/filter_mngr.rb
|
153
|
+
- lib/dyndoc/base/filter/server.rb
|
154
|
+
- lib/dyndoc/base/filters.rb
|
155
|
+
- lib/dyndoc/base/helpers.rb
|
156
|
+
- lib/dyndoc/base/helpers/core.rb
|
157
|
+
- lib/dyndoc/base/helpers/parser.rb
|
158
|
+
- lib/dyndoc/base/scanner.rb
|
159
|
+
- lib/dyndoc/base/tags.rb
|
160
|
+
- lib/dyndoc/base/tags/keys_mngr.rb
|
161
|
+
- lib/dyndoc/base/tags/part_tag.rb
|
162
|
+
- lib/dyndoc/base/tags/tag_mngr.rb
|
163
|
+
- lib/dyndoc/base/tags/user_tag.rb
|
164
|
+
- lib/dyndoc/base/tmpl.rb
|
165
|
+
- lib/dyndoc/base/tmpl/eval.rb
|
166
|
+
- lib/dyndoc/base/tmpl/extension.rb
|
167
|
+
- lib/dyndoc/base/tmpl/manager.rb
|
168
|
+
- lib/dyndoc/base/tmpl/oop.rb
|
169
|
+
- lib/dyndoc/base/tmpl/parse_do.rb
|
170
|
+
- lib/dyndoc/base/tmpl/rbenvir.rb
|
171
|
+
- lib/dyndoc/base/utils.rb
|
172
|
+
- lib/dyndoc/common/dynArray.rb
|
173
|
+
- lib/dyndoc/common/file.rb
|
174
|
+
- lib/dyndoc/common/init.rb
|
175
|
+
- lib/dyndoc/common/tilt.rb
|
176
|
+
- lib/dyndoc/common/utils.rb
|
177
|
+
- lib/dyndoc/common/uv.rb
|
178
|
+
- lib/dyndoc/init/config.rb
|
179
|
+
- lib/dyndoc/init/home.rb
|
180
|
+
- lib/dyndoc/plugins/tex.rb
|
181
|
+
- lib/dyndoc/plugins/tex/beamer.rb
|
182
|
+
- lib/dyndoc/plugins/tex/tex_eval.rb
|
183
|
+
- lib/dyndoc/plugins/tex/tex_parse_do.rb
|
184
|
+
- lib/dyndoc/plugins/tex/tex_user_tag.rb
|
184
185
|
- share/R/dyndocMsys2.R
|
185
186
|
- share/R/dyndocTools.R
|
186
187
|
- share/R/test.R
|
187
188
|
- share/R/tools/dynArray.R
|
188
189
|
- share/R/tools/dynCapture.R
|
189
190
|
- share/R/tools/dynMsys2.R
|
190
|
-
-
|
191
|
-
- dyndoc
|
192
|
-
-
|
193
|
-
-
|
191
|
+
- share/julia/dynArray.jl
|
192
|
+
- share/julia/dyndoc.jl
|
193
|
+
- share/julia/dyndocOLD.jl
|
194
|
+
- share/julia/dynreport.jl
|
195
|
+
- share/julia/ruby.jl
|
194
196
|
homepage: http://cqls.upmf-grenoble.fr
|
195
197
|
licenses:
|
196
198
|
- MIT
|
197
|
-
- GPL-2
|
199
|
+
- GPL-2.0
|
198
200
|
metadata: {}
|
199
|
-
post_install_message:
|
201
|
+
post_install_message:
|
200
202
|
rdoc_options: []
|
201
203
|
require_paths:
|
202
204
|
- lib
|
203
205
|
required_ruby_version: !ruby/object:Gem::Requirement
|
204
206
|
requirements:
|
205
|
-
- -
|
207
|
+
- - ">="
|
206
208
|
- !ruby/object:Gem::Version
|
207
209
|
version: '0'
|
208
210
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
209
211
|
requirements:
|
210
|
-
- -
|
212
|
+
- - ">="
|
211
213
|
- !ruby/object:Gem::Version
|
212
214
|
version: '0'
|
213
215
|
requirements:
|
214
216
|
- none
|
215
|
-
|
216
|
-
|
217
|
-
signing_key:
|
217
|
+
rubygems_version: 3.0.6
|
218
|
+
signing_key:
|
218
219
|
specification_version: 4
|
219
220
|
summary: R and Ruby in text document
|
220
221
|
test_files: []
|