dyndoc-ruby-core 1.4.1 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dyndoc-core.rb +3 -0
- data/lib/dyndoc/base/filter/filter_mngr.rb +3 -3
- data/lib/dyndoc/base/filter/server.rb +5 -3
- data/lib/dyndoc/base/scanner.rb +8 -7
- data/lib/dyndoc/base/tmpl/eval.rb +9 -7
- data/lib/dyndoc/base/tmpl/manager.rb +3 -0
- data/lib/dyndoc/base/tmpl/parse_do.rb +47 -28
- data/lib/dyndoc/base/utils.rb +1 -1
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8db5b8dba56f6bc0ed9ac32ee525033c577e49e4771e76a96dcb0e7c28654d5
|
4
|
+
data.tar.gz: 7dd78c1167b23734ce93a6ca4e125ae106006e7b621eebc7c97dbca5fea9c30f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 549db27aa7991171c22c203caccdc28653b6b2ccb7b9e275565f79e5f4c8a239d4996c97bcad7c4324d802bcbf0f907b7183a388f1644d21e547e9d41d1f3fb3
|
7
|
+
data.tar.gz: fc5c2afdbe9c859940452f246d4dfa8c59d1fc7645ec87a321b86c64edfee0062d3df252cf9f5cfe33acadf05e49c7890eb2baac45ee45abee8e7ce21e058548
|
data/lib/dyndoc-core.rb
CHANGED
@@ -30,6 +30,8 @@ Settings.define 'cfg_dyn.cmd_pandoc_options', :type => Array, :default => []
|
|
30
30
|
Settings.define 'cfg_dyn.options.pdflatex_nb_pass', :type => Integer, :default => 1
|
31
31
|
Settings.define 'cfg_dyn.options.pdflatex_echo', :type => :boolean, :default => false
|
32
32
|
Settings.define 'cfg_dyn.debug', :type => :boolean, :default => false
|
33
|
+
Settings.define 'cfg_dyn.parse_rescue', :type => :boolean, :default => true
|
34
|
+
Settings.define 'cfg_dyn.parse_rescue_mode', :type => Symbol, :default => :simple
|
33
35
|
Settings.define 'cfg_dyn.ruby_only', :type => :boolean, :default => false
|
34
36
|
|
35
37
|
Settings.define 'cfg_dyn.dyndoc_session', :type => Symbol, :default => :normal #or :interactive
|
@@ -40,6 +42,7 @@ Settings.define 'cfg_dyn.working_dir', :type => String, :default => ""
|
|
40
42
|
Settings.define 'cfg_dyn.root_doc', :type => String, :default => ""
|
41
43
|
Settings.define 'cfg_dyn.nbChar_error', :type => Integer, :default => 300
|
42
44
|
Settings.define 'cfg_dyn.langs', :type => Array, :default => ["R"]
|
45
|
+
Settings.define 'cfg_dyn.require_first', :type => Array, :default => [""]
|
43
46
|
|
44
47
|
Settings.define 'cfg_dyn.devel_mode', :type=> Symbol, :default=> :none
|
45
48
|
Settings.define 'cfg_dyn.ruby_debug', :type=> Symbol, :default=> :none
|
@@ -395,7 +395,7 @@ module Dyndoc
|
|
395
395
|
when "@"
|
396
396
|
return txt if @mode==:pre
|
397
397
|
res=CallFilter.output(txt,self)
|
398
|
-
when "#","##"
|
398
|
+
when "#","##","%"
|
399
399
|
#p @envir
|
400
400
|
#p @envir.output(txt,@mode,@escape)
|
401
401
|
#p @envir.output(in_type+"{"+txt2+"}",@mode,@escape)
|
@@ -575,7 +575,7 @@ module Dyndoc
|
|
575
575
|
else
|
576
576
|
res.to_s
|
577
577
|
end
|
578
|
-
when "=","@=","#=","##=" ,"none="
|
578
|
+
when "=","@=","#=","%=","##=" ,"none="
|
579
579
|
#puts "convert [=]";p res
|
580
580
|
if res.is_a? Array
|
581
581
|
res.join(",")
|
@@ -587,7 +587,7 @@ module Dyndoc
|
|
587
587
|
"%Q{"+res2+"}"
|
588
588
|
end
|
589
589
|
end
|
590
|
-
when "","@","#","##","none","#F"
|
590
|
+
when "","@","#","%","##","none","#F"
|
591
591
|
if res.is_a? Array
|
592
592
|
res.join(",")
|
593
593
|
else
|
@@ -93,7 +93,9 @@ module Dyndoc
|
|
93
93
|
end
|
94
94
|
|
95
95
|
rescue SyntaxError
|
96
|
-
|
96
|
+
|
97
|
+
$outRbError="RbServer syntax error in: "+code
|
98
|
+
puts $outRbError
|
97
99
|
raise SystemError if Dyndoc.cfg_dyn[:dyndoc_mode]==:normal and Dyndoc.cfg_dyn[:ruby_debug]!=:none
|
98
100
|
if Dyndoc.cfg_dyn[:dyndoc_mode]!=:normal
|
99
101
|
$dyn_logger.write("\nERROR Ruby Syntax:\n"+code+"\n")
|
@@ -829,8 +831,8 @@ module Dyndoc
|
|
829
831
|
|
830
832
|
def JLServer.initVerb
|
831
833
|
Julia << "Base.include(@__MODULE__,\""+File.join(Dyndoc.cfg_dir[:gem_path],"share","julia","dyndoc.jl")+"\")"
|
832
|
-
|
833
|
-
|
834
|
+
Julia << "push!(Libdl.DL_LOAD_PATH,\"/usr/lib\");push!(Libdl.DL_LOAD_PATH,\"/usr/local/lib\")"
|
835
|
+
@@initVerb=true
|
834
836
|
end
|
835
837
|
|
836
838
|
def JLServer.inputsAndOutputs(code,hash=true)
|
data/lib/dyndoc/base/scanner.rb
CHANGED
@@ -232,7 +232,7 @@ module Dyndoc
|
|
232
232
|
class CallScanner < Scanner
|
233
233
|
|
234
234
|
@@type[:call]={
|
235
|
-
:start=>/\\?(
|
235
|
+
:start=>/\\?(?:\#|\%|\#\#|@|#F|#R|#r|\:R|\:r|#Rb|#rb|\:|\:Rb|\:rb|\:jl|#jl)?\{/,
|
236
236
|
:stop=> /\\?\}/,
|
237
237
|
:mode=>{:start=>-1,:stop=>0,:length=>1},
|
238
238
|
:escape_start=>['\{'], #doivent être parsable dans start
|
@@ -257,11 +257,11 @@ module Dyndoc
|
|
257
257
|
}
|
258
258
|
=end
|
259
259
|
@@type[:dtag] = {
|
260
|
-
:start=>'\{[
|
261
|
-
:stop=> '\[[
|
262
|
-
:atom=>{:match=>/(\{[
|
260
|
+
:start=>'\{[\#\@\%]([\w\:\|-]*[<>]?[=?!><]?(\.\w*)?)\]',
|
261
|
+
:stop=> '\[[\#\@\%]([\w\:\|-]*[<>]?[=?!><]?)\}',
|
262
|
+
:atom=>{:match=>/(\{[\#\@\%][\w\:\|]*)([\#\@\%]\})/,:replace=>{2=>"][#}"}},
|
263
263
|
:block=> '\]', #no longer |
|
264
|
-
:keyword=>['\[[
|
264
|
+
:keyword=>['\[[\#\%\@]','\]'],
|
265
265
|
:mode=>{:start=>0,:stop=>-1,:length=>1}
|
266
266
|
}
|
267
267
|
|
@@ -621,11 +621,12 @@ module Dyndoc
|
|
621
621
|
end
|
622
622
|
##Dyndoc.warn "to scan", @scan.string[@scan.pos..-1]
|
623
623
|
##Dyndoc.warn "tag_reg",[blocktag_reg,tag_reg]
|
624
|
+
##p ["tag_reg",[blocktag_reg,tag_reg]]
|
624
625
|
end
|
625
626
|
if (tag_keyword and (@scan.check_until(blocktag_reg))) #or (!@named_tags.empty? and check_until_for_named_tags)
|
626
627
|
check_until_for_named_tags unless @named_tags.empty?
|
627
628
|
key=@scan[2]
|
628
|
-
##Dyndoc.warn "keyword",[key,@scan[0],@scan[1],@scan[2]]
|
629
|
+
##Dyndoc.warn p ["keyword",[key.scan(tag_reg),key.scan(tag_reg)[-1],key,@scan[0],@scan[1],@scan[2]]]
|
629
630
|
##Dyndoc.warn "pre_math,tag_selected",[@scan.pre_match,@tag_selected] if key=="[#tag]"
|
630
631
|
res << find_text(from,key,inside)
|
631
632
|
@is_arg=false if @is_arg
|
@@ -635,7 +636,7 @@ module Dyndoc
|
|
635
636
|
res << (key=@tag_selected)
|
636
637
|
else
|
637
638
|
#key=tag_reg.match(key)[0]
|
638
|
-
key= key.scan(tag_reg)[
|
639
|
+
key= key.scan(tag_reg)[-1]
|
639
640
|
##Dyndoc.warn "key(AP)",key if key=="tag"
|
640
641
|
res << (key=key.to_sym) if key and !key.empty?
|
641
642
|
end
|
@@ -201,13 +201,15 @@ module Dyndoc
|
|
201
201
|
#p input
|
202
202
|
=end
|
203
203
|
# REPLACEMENT of ABOVE!
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
204
|
+
unless @libs.keys.include? tmpl
|
205
|
+
if tmpl and File.exists? tmpl
|
206
|
+
input=Dyndoc.read_content_file(tmpl)
|
207
|
+
@libs[tmpl]=input
|
208
|
+
filter.envir["_FILENAME_"]=tmpl.dup #register name of template!!!
|
209
|
+
filter.envir["_FILENAME_ORIG_"]=tmpl_orig.dup #register name of template!!!
|
210
|
+
filter.envir["_PWD_"]=File.dirname(tmpl) #register name of template!!!
|
211
|
+
txt=parse(@libs[tmpl],filter,tags)
|
212
|
+
end
|
211
213
|
end
|
212
214
|
}
|
213
215
|
end
|
@@ -151,6 +151,9 @@ module Dyndoc
|
|
151
151
|
## equivalent to :pre_doc for not interactive document
|
152
152
|
def require_first
|
153
153
|
require_dyndoc_libs("Dyn/Base")
|
154
|
+
Dyndoc.cfg_dyn[:require_first].each do |libs|
|
155
|
+
require_dyndoc_libs(libs)
|
156
|
+
end
|
154
157
|
end
|
155
158
|
|
156
159
|
def require_dyndoc_libs(libs)
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
|
+
require 'securerandom'
|
4
|
+
|
3
5
|
## TODO: .force_encoding("utf-8") needs to be added (see server.rb)
|
4
6
|
module Dyndoc
|
5
7
|
|
@@ -26,6 +28,7 @@ module Dyndoc
|
|
26
28
|
class TemplateManager
|
27
29
|
|
28
30
|
@@depth=0
|
31
|
+
@@outError=""
|
29
32
|
|
30
33
|
@@cmd=["newBlck","input","require","def","func","meth","new","super","blck","do","if","for","case", "loop","r","renv","rverb","rbverb","jlverb","rout","rb","var","set","hide","format","txt","code","<","<<",">","eval","ifndef","tags","keys","opt","document","yield","get","part","style"]
|
31
34
|
## Alias
|
@@ -87,7 +90,7 @@ module Dyndoc
|
|
87
90
|
@vars,varsOld=filterLoc.envir,@vars
|
88
91
|
Dyndoc.vars=@vars
|
89
92
|
@filter=filterLoc unless @filter ##root filter
|
90
|
-
out=""
|
93
|
+
out,$outError ="",""
|
91
94
|
#p texblock
|
92
95
|
texblock.map{|b|
|
93
96
|
#p b
|
@@ -96,33 +99,49 @@ module Dyndoc
|
|
96
99
|
cmd=@@cmdAlias[cmd] if @@cmdAlias.keys.include? cmd
|
97
100
|
#Dyndoc.warn "parse:cmd,b",[cmd,b]
|
98
101
|
@@depth+=1
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
102
|
+
## To deactivate, put it inside ~/.dyndoc.yml
|
103
|
+
if Dyndoc.cfg_dyn[:parse_rescue]
|
104
|
+
begin
|
105
|
+
## Dyndoc.warn "cmd",[cmd,b]
|
106
|
+
method("do_"+cmd).call(out,b,filterLoc)
|
107
|
+
## Dyndoc.warn [:out,out] if cmd=="eval"
|
108
|
+
rescue
|
109
|
+
$outError << "=> Leaving block depth #{@@depth}: " << "\n"
|
110
|
+
codeText = b.inspect
|
111
|
+
##Dyndoc.warn "codeText",codeText
|
112
|
+
nbChar=(Dyndoc.cfg_dyn[:nbChar_error]) ? Dyndoc.cfg_dyn[:nbChar_error] : 80
|
113
|
+
if codeText.length > nbChar
|
114
|
+
codeText=codeText[0..((nbChar*2/3).to_int)]+" ...... "+codeText[(-(nbChar/3).to_int)..-1]
|
115
|
+
end
|
116
|
+
$outError << codeText << "\n"
|
117
|
+
if $outRbError && !$outRbError.empty?
|
118
|
+
$outError << $outRbError << "\n"
|
119
|
+
$outRbError = ""
|
120
|
+
end
|
121
|
+
if @@depth==1
|
122
|
+
$outError << "=> Exiting abnormally!</code>" << "\n"
|
123
|
+
@@outError << "<pre style='background-color: #EBECE4;'><code>"+$outError+"</code></pre>" << "\n"
|
124
|
+
puts "@@outError: \n"+@@outError
|
125
|
+
#raise SystemExit
|
126
|
+
out << @@outError
|
127
|
+
@@outError=""
|
128
|
+
else
|
129
|
+
@@outError << "<pre style='background-color: #EBECE4;'><code>Dyn Runtime Error\n"+$outError+"</code></pre>"
|
130
|
+
$outError=""
|
131
|
+
if Dyndoc.cfg_dyn[:parse_rescue_mode]==:simple
|
132
|
+
out << @@outError
|
133
|
+
@@outError=""
|
134
|
+
else
|
135
|
+
raise RuntimeError, "Dyn Runtime Error"
|
136
|
+
end
|
137
|
+
end
|
138
|
+
Dyndoc.warn "out #{@@depth} :",$outError
|
139
|
+
|
140
|
+
ensure
|
141
|
+
@@depth -= 1
|
120
142
|
end
|
121
|
-
|
122
|
-
|
123
|
-
end
|
124
|
-
###TO temporarily AVOID RESCUE MODE:
|
125
|
-
###
|
143
|
+
else
|
144
|
+
method("do_"+cmd).call(out,b,filterLoc)
|
126
145
|
end
|
127
146
|
}
|
128
147
|
##restore old partTag and vars
|
@@ -404,7 +423,7 @@ p [vars,b2]
|
|
404
423
|
if @@newBlcks.keys.include? @blckDepth[-1]
|
405
424
|
@blckName ||= []
|
406
425
|
tmp=blck[1][1].strip
|
407
|
-
@blckName << (tmp.empty? ?
|
426
|
+
@blckName << (tmp.empty? ? SecureRandom.uuid.strip : tmp)
|
408
427
|
#puts "blckNAME";p @blckName
|
409
428
|
end
|
410
429
|
|
data/lib/dyndoc/base/utils.rb
CHANGED
@@ -119,7 +119,7 @@ module Dyndoc
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def Utils.protect_extraction(str)
|
122
|
-
str.gsub(/(
|
122
|
+
str.gsub(/(?:\#|\:dyn|\#\#|@|#F|#R|#r|\:R|\:r|#Rb|#rb|\:|\:Rb|\:rb)+\{/) {|e| "\\"+e}
|
123
123
|
end
|
124
124
|
|
125
125
|
## the scanner converts automatically {#toto#} in {#toto][#} and {@toto@} in {@toto][#}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.5.1
|
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: 2021-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: configliere
|
@@ -34,22 +34,22 @@ dependencies:
|
|
34
34
|
name: ultraviolet
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - ">="
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: 1.0.0
|
40
37
|
- - "~>"
|
41
38
|
- !ruby/object:Gem::Version
|
42
39
|
version: '1.0'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.0.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.0
|
50
47
|
- - "~>"
|
51
48
|
- !ruby/object:Gem::Version
|
52
49
|
version: '1.0'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.0.0
|
53
53
|
description: " Provide templating in text document.\n"
|
54
54
|
email: rdrouilh@gmail.com
|
55
55
|
executables: []
|
@@ -193,12 +193,12 @@ files:
|
|
193
193
|
- share/julia/dyndocOLD.jl
|
194
194
|
- share/julia/dynreport.jl
|
195
195
|
- share/julia/ruby.jl
|
196
|
-
homepage: http://cqls.
|
196
|
+
homepage: http://cqls.dyndoc.fr
|
197
197
|
licenses:
|
198
198
|
- MIT
|
199
199
|
- GPL-2.0
|
200
200
|
metadata: {}
|
201
|
-
post_install_message:
|
201
|
+
post_install_message:
|
202
202
|
rdoc_options: []
|
203
203
|
require_paths:
|
204
204
|
- lib
|
@@ -214,8 +214,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
version: '0'
|
215
215
|
requirements:
|
216
216
|
- none
|
217
|
-
rubygems_version: 3.
|
218
|
-
signing_key:
|
217
|
+
rubygems_version: 3.1.4
|
218
|
+
signing_key:
|
219
219
|
specification_version: 4
|
220
220
|
summary: R and Ruby in text document
|
221
221
|
test_files: []
|