dyndoc-ruby-core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/dyndoc/.DS_Store +0 -0
- data/dyndoc/Dyn/.postload +1 -0
- data/dyndoc/Dyn/.preload +1 -0
- data/dyndoc/Dyn/After.dyn +3 -0
- data/dyndoc/Dyn/Base.dyn +18 -0
- data/dyndoc/Dyn/Minimum.dyn +20 -0
- data/dyndoc/Model/Html/DefaultPost_html.dyn +5 -0
- data/dyndoc/Model/Html/DefaultPre_html.dyn +15 -0
- data/dyndoc/Model/Odt/DefaultPost_content.xml +3 -0
- data/dyndoc/Model/Odt/DefaultPost_tmpl_content.xml +3 -0
- data/dyndoc/Model/Odt/DefaultPre_content.xml +8 -0
- data/dyndoc/Model/Odt/DefaultPre_tmpl_content.xml +8 -0
- data/dyndoc/Model/Tex/ContentPost_tmpl.tex +1 -0
- data/dyndoc/Model/Tex/ContentPre_tmpl.tex +6 -0
- data/dyndoc/Model/Tex/DefaultPost_tmpl.tex +73 -0
- data/dyndoc/Model/Tex/DefaultPre_tmpl.tex +16 -0
- data/dyndoc/Model/Ttm/DefaultPost_tmpl.ttm +3 -0
- data/dyndoc/Model/Ttm/DefaultPre_tmpl.ttm +16 -0
- data/dyndoc/Std/Array.dyn +96 -0
- data/dyndoc/Std/Composer.dyn +38 -0
- data/dyndoc/Std/DevTag.dyn +101 -0
- data/dyndoc/Std/DynVar.dyn +23 -0
- data/dyndoc/Std/File.dyn +55 -0
- data/dyndoc/Std/Git.dyn +34 -0
- data/dyndoc/Std/List.dyn +46 -0
- data/dyndoc/Std/OOP.dyn +32 -0
- data/dyndoc/Std/Signal.dyn +18 -0
- data/dyndoc/Std/String.dyn +22 -0
- data/dyndoc/Std/Styles.dyn +1 -0
- data/dyndoc/Std/Test.dyn +282 -0
- data/dyndoc/Std/Utils.dyn +42 -0
- data/dyndoc/Std/Verb.dyn +5 -0
- data/dyndoc/Style/Notation/Math.dyn +7 -0
- data/dyndoc/Style/Notation/Stat/Classic.dyn +8 -0
- data/dyndoc/Style/Notation/Stat/Cqls.dyn +44 -0
- data/dyndoc/Style/Text/Std.dyn +5 -0
- data/dyndoc/Style/Text/StdAlias.dyn +3 -0
- data/dyndoc/Style/Text/StdTex.dyn +17 -0
- data/dyndoc/Style/Text/Txt.dyn +1 -0
- data/dyndoc/Tex/.postload +1 -0
- data/dyndoc/Tex/.preload +1 -0
- data/dyndoc/Tex/10pt_tmpl.tex +1 -0
- data/dyndoc/Tex/11pt_tmpl.tex +1 -0
- data/dyndoc/Tex/12pt_tmpl.tex +1 -0
- data/dyndoc/Tex/Article_tmpl.tex +1 -0
- data/dyndoc/Tex/Beamer.dyn_tex +35 -0
- data/dyndoc/Tex/BeamerHandout_tmpl.tex +2 -0
- data/dyndoc/Tex/Book_tmpl.tex +1 -0
- data/dyndoc/Tex/DefaultFirst_tmpl.tex +1 -0
- data/dyndoc/Tex/DefaultLast_tmpl.tex +8 -0
- data/dyndoc/Tex/Default_tmpl.tex +9 -0
- data/dyndoc/Tex/First_tmpl.tex +8 -0
- data/dyndoc/Tex/Fr_tmpl.tex +17 -0
- data/dyndoc/Tex/Header_tmpl.tex +3 -0
- data/dyndoc/Tex/InclGraph_tmpl.tex +19 -0
- data/dyndoc/Tex/InclSpatProc_tmpl.tex +70 -0
- data/dyndoc/Tex/InclSumMI_tmpl.tex +4 -0
- data/dyndoc/Tex/LargeA4_tmpl.tex +5 -0
- data/dyndoc/Tex/Last_tmpl.tex +1 -0
- data/dyndoc/Tex/Option_tmpl.tex +8 -0
- data/dyndoc/Tex/Png_tmpl.tex +1 -0
- data/dyndoc/Tex/RefCite2_tmpl.tex +16 -0
- data/dyndoc/Tex/RefCite_tmpl.tex +16 -0
- data/dyndoc/Tex/Report_tmpl.tex +1 -0
- data/dyndoc/Tex/Theorem_tmpl.tex +14 -0
- data/dyndoc/Tools/.DS_Store +0 -0
- data/dyndoc/Tools/Atom.dyn/index.dyn +42 -0
- data/dyndoc/Tools/AtomDyndocker.dyn/index.dyn +43 -0
- data/dyndoc/Tools/R/Fig.dyn +144 -0
- data/dyndoc/Tools/R/Tools.dyn +344 -0
- data/dyndoc/Tools/Tex/Beamer.dyn +204 -0
- data/dyndoc/Tools/Tex/BeamerSlide.dyn_tex +199 -0
- data/dyndoc/Tools/Tex/Pgf.dyn +115 -0
- data/dyndoc/Tools/Tex/Table.dyn +278 -0
- data/dyndoc/Tools/Tex/Tools.dyn +37 -0
- data/dyndoc/Tools/Tex/Verb.dyn +77 -0
- data/dyndoc/Tools/Web/.DS_Store +0 -0
- data/dyndoc/Tools/Web/Ace.dyn +54 -0
- data/dyndoc/Tools/Web/Code.dyn +129 -0
- data/dyndoc/Tools/Web/DHtmlX.dyn +39 -0
- data/dyndoc/Tools/Web/DataTable.dyn_html +354 -0
- data/dyndoc/Tools/Web/Html.dyn +286 -0
- data/dyndoc/Tools/Web/Html/JQuery.dyn +123 -0
- data/dyndoc/Tools/Web/Html/Styles.dyn +4 -0
- data/dyndoc/Tools/Web/JQueryTools.dyn +87 -0
- data/dyndoc/Tools/Web/Layout.dyn +86 -0
- data/dyndoc/Tools/Web/Layout/CQLS.dyn +6 -0
- data/dyndoc/Tools/Web/Layout/LJK.dyn +41 -0
- data/dyndoc/Tools/Web/TabBar.dyn +37 -0
- data/dyndoc/Tools/Web/Ttm.dyn +20 -0
- data/dyndoc/Tools/Web/Txtl.dyn +14 -0
- data/lib/dyndoc-core.rb +59 -0
- data/lib/dyndoc/base/envir.rb +541 -0
- data/lib/dyndoc/base/filter/call.rb +127 -0
- data/lib/dyndoc/base/filter/filter_mngr.rb +637 -0
- data/lib/dyndoc/base/filter/server.rb +882 -0
- data/lib/dyndoc/base/filters.rb +3 -0
- data/lib/dyndoc/base/helpers.rb +9 -0
- data/lib/dyndoc/base/helpers/core.rb +32 -0
- data/lib/dyndoc/base/helpers/parser.rb +188 -0
- data/lib/dyndoc/base/scanner.rb +886 -0
- data/lib/dyndoc/base/tags.rb +4 -0
- data/lib/dyndoc/base/tags/keys_mngr.rb +401 -0
- data/lib/dyndoc/base/tags/part_tag.rb +194 -0
- data/lib/dyndoc/base/tags/tag_mngr.rb +125 -0
- data/lib/dyndoc/base/tags/user_tag.rb +216 -0
- data/lib/dyndoc/base/tmpl.rb +6 -0
- data/lib/dyndoc/base/tmpl/eval.rb +581 -0
- data/lib/dyndoc/base/tmpl/extension.rb +337 -0
- data/lib/dyndoc/base/tmpl/manager.rb +450 -0
- data/lib/dyndoc/base/tmpl/oop.rb +57 -0
- data/lib/dyndoc/base/tmpl/parse_do.rb +2446 -0
- data/lib/dyndoc/base/tmpl/rbenvir.rb +54 -0
- data/lib/dyndoc/base/utils.rb +367 -0
- data/lib/dyndoc/common/dynArray.rb +234 -0
- data/lib/dyndoc/common/file.rb +52 -0
- data/lib/dyndoc/common/init.rb +2 -0
- data/lib/dyndoc/common/tilt.rb +149 -0
- data/lib/dyndoc/common/utils.rb +61 -0
- data/lib/dyndoc/common/uv.rb +163 -0
- data/lib/dyndoc/init/config.rb +296 -0
- data/lib/dyndoc/init/home.rb +9 -0
- data/lib/dyndoc/plugins/tex.rb +4 -0
- data/lib/dyndoc/plugins/tex/beamer.rb +208 -0
- data/lib/dyndoc/plugins/tex/tex_eval.rb +69 -0
- data/lib/dyndoc/plugins/tex/tex_parse_do.rb +25 -0
- data/lib/dyndoc/plugins/tex/tex_user_tag.rb +32 -0
- data/share/R/dyndocMsys2.R +5 -0
- data/share/R/dyndocTools.R +9 -0
- data/share/R/test.R +14 -0
- data/share/R/tools/dynArray.R +34 -0
- data/share/R/tools/dynCapture.R +84 -0
- data/share/R/tools/dynMsys2.R +54 -0
- data/share/julia/dynArray.jl +93 -0
- data/share/julia/dyndoc.jl +110 -0
- data/share/julia/ruby.jl +37 -0
- metadata +202 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
[#package]\usepackage{multirow}
|
|
2
|
+
[#main]
|
|
3
|
+
[#%]double indexed elements
|
|
4
|
+
On définit les cellules comme des éléments #code (enregistrés dans des variables dyn) dépendant (ou pas) de 2 indices i et j (en ruby)!
|
|
5
|
+
Les infos sont attachés dans un environnement R sous forme d'une matrice R avec pour élements les noms des cellules #code
|
|
6
|
+
[#<]{#meth]new.Tabular[#,].tabR[.#{.ObjectName}TabR][#,].hlines[][#,].vlines[]
|
|
7
|
+
[#rb<]@vars.extract_raw("self")[:cells]={}
|
|
8
|
+
[#}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
LES IDEES
|
|
12
|
+
A) sur le contenu des cellules
|
|
13
|
+
1) créer une fonction dyn qui gère le contenu en fonction des indices i,j
|
|
14
|
+
2) l'appeler dans les blocs représentant les cellules!
|
|
15
|
+
3) les cellules contenant du texte sont simplement recopiées tandis que les blocs sont executés
|
|
16
|
+
un bloc finit par "!"
|
|
17
|
+
B) la méthode d'initialisation peut être générique et non seulement applicable au tableau!
|
|
18
|
+
C) gestion des multicol et multirow??? PLUS TARD!
|
|
19
|
+
|
|
20
|
+
{#meth]make.Tabular[#,]mat[][#,]transpose[false]
|
|
21
|
+
[#rb<]
|
|
22
|
+
curRow=nil
|
|
23
|
+
mat=[]
|
|
24
|
+
cells={}
|
|
25
|
+
matxt=#{=mat}.strip
|
|
26
|
+
#Dyndoc.warn "matxt",matxt
|
|
27
|
+
|
|
28
|
+
#create the matrix
|
|
29
|
+
rows=matxt.split("\\\\").map{|r| r.strip}
|
|
30
|
+
rows.each{|r| #
|
|
31
|
+
#p r
|
|
32
|
+
row=r.strip.split("&",-1).map{|e| e.strip}
|
|
33
|
+
#p [:row,row]
|
|
34
|
+
#first column -> maybe a preliminary variable to initialize!
|
|
35
|
+
while row[0] =~ /^(?:\#|\:)(var|row|col|rb|r)/
|
|
36
|
+
cmd=$1
|
|
37
|
+
pos=cmd.length+1
|
|
38
|
+
row[0]=row[0][pos..-1]
|
|
39
|
+
#separator
|
|
40
|
+
sep="|"
|
|
41
|
+
if ["var","col","row"].include? cmd and row[0][0,1]=="[" and row[0][2,1]=="]"
|
|
42
|
+
sep=row[0][1,1]
|
|
43
|
+
row[0]=row[0][3..-1]
|
|
44
|
+
end
|
|
45
|
+
#code
|
|
46
|
+
o=row[0][0,1]
|
|
47
|
+
c={"{"=>"}","("=>")","<"=>">","["=>"]"}[o]
|
|
48
|
+
c=o unless c
|
|
49
|
+
row[0] =~ /^#{Regexp.escape(o)}([^#{Regexp.escape(c)}]*)#{Regexp.escape(c)}/m #the rule is clear: the closing character does not exists inside!
|
|
50
|
+
#p /^#{Regexp.escape(o)}([^#{Regexp.escape(c)}]*)#{Regexp.escape(c)}/m
|
|
51
|
+
#puts "ICI";p row[0];p $1
|
|
52
|
+
code=$1
|
|
53
|
+
row[0]=row[0][(code.length+2)..-1].strip
|
|
54
|
+
#p row[0]
|
|
55
|
+
code.strip!
|
|
56
|
+
cells[mat.length+1]=[] unless cells[mat.length+1]
|
|
57
|
+
if ["row","col"].include? cmd
|
|
58
|
+
code= cmd + "=" + code
|
|
59
|
+
cmd="var"
|
|
60
|
+
end
|
|
61
|
+
cmd2=[cmd.to_sym,code]
|
|
62
|
+
cmd2 << sep if cmd=="var"
|
|
63
|
+
cells[mat.length+1] << cmd2
|
|
64
|
+
end
|
|
65
|
+
#puts "after";p row
|
|
66
|
+
# and now the normal treatment!
|
|
67
|
+
if row[0][0,1]=="%"
|
|
68
|
+
#nothing to do
|
|
69
|
+
elsif row.length==1 and row[0][0,4]=="row*"
|
|
70
|
+
# repeat curRow the number of times!
|
|
71
|
+
#p "row*";p row[0][4..-1].strip.to_i
|
|
72
|
+
1.upto(row[0][4..-1].strip.to_i) { mat << curRow }
|
|
73
|
+
elsif row.length==1 and row[0][0,4]=="row(" and row[0][-1,1]==")"
|
|
74
|
+
mat << (curRow=mat[row[0][4...-1].strip.to_i-1])
|
|
75
|
+
else
|
|
76
|
+
curCol=""
|
|
77
|
+
resRow=[]
|
|
78
|
+
#p row
|
|
79
|
+
row.each{|col| #
|
|
80
|
+
if col[0,4]=="col*"
|
|
81
|
+
1.upto(col[4..-1].strip.to_i) { resRow << curCol }
|
|
82
|
+
elsif col[0,4]=="col(" and col[-1,1]==")"
|
|
83
|
+
resRow << (curCol=resRow[col[4...-1].strip.to_i-1])
|
|
84
|
+
elsif col =~ /^mcol\{([^\{]*)\}(.*)$/m
|
|
85
|
+
nbCol=$1.strip.to_i-1
|
|
86
|
+
resRow << "__MCOL__{"+$1+"}"+$2
|
|
87
|
+
1.upto(nbCol) {resRow << (curCol="__MCOL__") }
|
|
88
|
+
resRow[-1]+="&"
|
|
89
|
+
elsif col =~ /^mrow(\{[^\{]*\})(\{[^\{]*\})(.*)$/m
|
|
90
|
+
rowCnt=$1+( $3.empty? ? "{*}"+$2 : $2+$3 )
|
|
91
|
+
resRow << (curCol="\\multirow"+rowCnt)
|
|
92
|
+
else
|
|
93
|
+
resRow << col
|
|
94
|
+
end
|
|
95
|
+
curCol=resRow[-1]
|
|
96
|
+
}
|
|
97
|
+
#puts "resRow";p resRow
|
|
98
|
+
mat << resRow
|
|
99
|
+
curRow=mat[-1]
|
|
100
|
+
end
|
|
101
|
+
}
|
|
102
|
+
# dim(mat)
|
|
103
|
+
nrow,ncol=mat.length,mat.map{|row| row.length}.max
|
|
104
|
+
# same column number! complete otherwise
|
|
105
|
+
#mat.map!{|row| ( row.length<ncol ? row+[""]*(ncol-row.length) : (row[-1]=="__MCOL__&" ? row[0...-1]+["__MCOL__"] : row ) ) }
|
|
106
|
+
mat.map!{|row|
|
|
107
|
+
if row.length<ncol
|
|
108
|
+
row+[""]*(ncol-row.length)
|
|
109
|
+
elsif row[-1]=="__MCOL__&"
|
|
110
|
+
#no __MCOL__& at the last position!
|
|
111
|
+
row[0...-1]+["__MCOL__"]
|
|
112
|
+
else
|
|
113
|
+
row
|
|
114
|
+
end
|
|
115
|
+
}
|
|
116
|
+
#p mat
|
|
117
|
+
#Dyndoc.warn "make:cells",cells
|
|
118
|
+
@vars.extract_raw("self")[:cells]=cells
|
|
119
|
+
#p @vars.extract_raw("self")
|
|
120
|
+
#@vars["self"][:cells]=cells
|
|
121
|
+
[#%]put it in R! Là, c'est magic! Le job est fait sans itération!
|
|
122
|
+
[#r<]#{.tabR}<-matrix(:{=mat.flatten},nr=:{nrow},nc=:{ncol},byrow=TRUE)
|
|
123
|
+
[#yield]default
|
|
124
|
+
[#?]#{transpose}[#r<]#{tabR}<-t(#{.tabR})[#?]end
|
|
125
|
+
[#<]{#init]self[#}
|
|
126
|
+
[#}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
Once the tabular is created! initialize it by specifying .vlines and .hlines!
|
|
131
|
+
|
|
132
|
+
{#meth]init.Tabular[#,]hlines[auto][#,]vlines[auto]
|
|
133
|
+
[#=].imax[:r{nrow(#{.tabR})}][#=].jmax[:r{ncol(#{.tabR})}]
|
|
134
|
+
[#?]#{=vlines}=="auto"[#=].vlines[|:{"c|"*#{.jmax}}][#?]else[#=].vlines[#{vlines}][#?]end
|
|
135
|
+
[#?]#{=hlines}=="auto"[#=].hlines[1-#{.jmax}][#?]else[#=].hlines[#{hlines}][#?]end
|
|
136
|
+
[#rb<]#p #{=.hlines}
|
|
137
|
+
hlines=#{=.hlines}.split(",",-1).map{|e| e.strip}
|
|
138
|
+
[#r<]
|
|
139
|
+
hlines=rbind(:{=hlines},0:#{.imax})[1,]
|
|
140
|
+
[#rb<]hlines=[]
|
|
141
|
+
curHL=""
|
|
142
|
+
:r{=hlines}.each{|hline| #
|
|
143
|
+
hl=hline.strip
|
|
144
|
+
#puts "hl";p hl
|
|
145
|
+
if hl.empty?
|
|
146
|
+
hlines << curHL=("")
|
|
147
|
+
elsif hl[0,1]=="*"
|
|
148
|
+
hlines += [curHL]*(hl[1..-1].to_i)
|
|
149
|
+
elsif hl[0,1]=="(" and hl[-1,1]==")"
|
|
150
|
+
hlines << (curHL=res[hl[1...-1].strip.to_i-1])
|
|
151
|
+
else
|
|
152
|
+
hlines << (curHL=hl.strip.split(" ").map{|e|
|
|
153
|
+
e2=e.strip
|
|
154
|
+
e2=(e2[-1,1]=="-" ? e2+#{=.jmax} : e2 )
|
|
155
|
+
"\\cline{"+e2.strip+"}"
|
|
156
|
+
}.join(""))
|
|
157
|
+
end
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
#p hlines
|
|
161
|
+
[#}
|
|
162
|
+
|
|
163
|
+
{#hide]OLD! Just to compare with the beautiful one below!
|
|
164
|
+
{#meth]print.Tabular[#,]vlines[][#,]hlines[]
|
|
165
|
+
[#rb<]imax=:r{nrow(#{.tabR})};jmax=:r{ncol(#{.tabR})}
|
|
166
|
+
##p imax;p jmax
|
|
167
|
+
[#?]#{0?vlines}[#=]vlines[|:{"c|"*jmax}]
|
|
168
|
+
[#?]#{0?hlines}[#=]hlines[['\hline']*(:{imax}+1)]
|
|
169
|
+
[#?]end
|
|
170
|
+
[#rb<]hlines=#{hlines}
|
|
171
|
+
[#>]\begin{tabular}{#{vlines}}:{hlines[0]}
|
|
172
|
+
[#rb<]i=0[#>]{#loop][#rb<]i+=1;j=0
|
|
173
|
+
[#>]{#loop][#rb<]j+=1
|
|
174
|
+
[#=]cell[:r{#{.tabR}[:{i},:{j}]}]
|
|
175
|
+
[#?]#{=cell}[-1,1]=="!"[#>]cell[::{#{=cell}[0...-1]}][#>][#{cell!}]
|
|
176
|
+
[#?]else[#>][#{cell}][#?]end
|
|
177
|
+
[#?]j<jmax[#>][ & ][#?]else[#>]\\ :{hlines[i]}[#?]end
|
|
178
|
+
[#break]j==jmax[#loop-j}
|
|
179
|
+
[#break]i==imax[#loop-i}
|
|
180
|
+
\end{tabular}
|
|
181
|
+
[#meth}[#hide}
|
|
182
|
+
|
|
183
|
+
{#meth]print.Tabular[#,]imax[#{.imax}][#,]jmax[#{.jmax}]
|
|
184
|
+
[#=]hlines?[1-#{jmax}][#=]vlines?[|:{"c|"*#{jmax}}:{"c"*(#{.jmax}-#{jmax})}]
|
|
185
|
+
[#<]{#init]self[#hlines]#{hlines}[#vlines]#{vlines}[#}
|
|
186
|
+
[#>]\begin{tabular}{#{.vlines}}[#rb>][hlines[0]]
|
|
187
|
+
[#rb<]
|
|
188
|
+
|
|
189
|
+
cells=@vars.extract_raw("self")[:cells]
|
|
190
|
+
#Dyndoc.warn "print:cells",cells
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
## Introduce because of Ruby >= 1.9.3 change of behavior about binding
|
|
194
|
+
## childBinding used inside filter_mngr.rb to fetch variables defined inside
|
|
195
|
+
childBinding,res=binding,nil
|
|
196
|
+
|
|
197
|
+
## DEBUG: Dyndoc.warn 'tabR';R4rb < "print(#{.tabR})"
|
|
198
|
+
|
|
199
|
+
varnames=[] # to save the predefined names used in Table
|
|
200
|
+
|
|
201
|
+
(1..#{.imax}).each do |i| #
|
|
202
|
+
|
|
203
|
+
if cells[i]
|
|
204
|
+
cells[i].each{|cmd,code,sep| #
|
|
205
|
+
case cmd
|
|
206
|
+
when :var
|
|
207
|
+
code =~ /^([^=]*)=(.*)/
|
|
208
|
+
#Dyndoc.warn [$1,$2]
|
|
209
|
+
varnames << $1
|
|
210
|
+
res=$2.strip.to_aRy(sep)
|
|
211
|
+
res.unshift(nil) #to have the counter in the R spirit
|
|
212
|
+
#Dyndoc.warn "res",res
|
|
213
|
+
#Dyndoc.warn "#{$1}=res"
|
|
214
|
+
childBinding.eval("#{$1}=res")
|
|
215
|
+
#Dyndoc.warn "print.Tableau",["#{$1}",eval("#{$1}",childBinding),childBinding]
|
|
216
|
+
end
|
|
217
|
+
}
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
[#rb>] ## VERY IMPORTANT: DO NOT REMOVE this #rb> tag this was added to use dyndoc to call newly created variables inside the previous block
|
|
222
|
+
if RUBY_VERSION >= "1.9.3" # not necessary with other ruby engine and previous version
|
|
223
|
+
## DO NOT REMOVE this apparently useless line, otherwise there is a bug in Ruby >= 1.9.3!
|
|
224
|
+
## DEBUG: Dyndoc.warn "Table: vars => "+varnames.join(",")+":",[:{varnames}] unless varnames.empty?
|
|
225
|
+
[:{varnames}]
|
|
226
|
+
## My explanation: creation of variables in binding as in the previous #rb< block is delayed and are not directly synchronized inside the environment.
|
|
227
|
+
## this leads to a bug when calling as in the next block these variables.
|
|
228
|
+
## Thanks of dyndoc, the line [:{varnames}] simply call these variables
|
|
229
|
+
## to get them ready to be used in the next block.
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
(1..#{.imax}).each do |i| #
|
|
233
|
+
#for j in 1..#{.jmax} do
|
|
234
|
+
(1..#{.jmax}).each do |j| #
|
|
235
|
+
|
|
236
|
+
{#>][#=]cell[:r{#{.tabR}[:{i},:{j}]}]
|
|
237
|
+
[#>]{#if]#{=cell}[0,8]=="__MCOL__"[#=]cell[:{#{=cell}[8..-1]}]
|
|
238
|
+
[#?]#{=cell}[0,1]=="&"[#>][ & ]
|
|
239
|
+
[#?]#{=cell}[0,1]=="{"[#>!][\multicolumn#{cell}]
|
|
240
|
+
[#else]
|
|
241
|
+
[#?]j>#{jmax} or i>#{imax}[#>]\phantom{[#?]end
|
|
242
|
+
[#>!]#{cell}
|
|
243
|
+
[#?]j>#{jmax} or i>#{imax}[#>]}[#?]end
|
|
244
|
+
[#?]j<#{.jmax}[#>][ & ][#if}
|
|
245
|
+
[#?]j==#{.jmax}[#>]\\ {#if]!hlines[i].empty?[#rb>][hlines[i]][#}[#nl]
|
|
246
|
+
[#>}
|
|
247
|
+
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
##### ruby 2.0 trouble about binding!
|
|
252
|
+
#Dyndoc.warn "HERE!!!!",[childBinding,$curDyn.tmpl.rbenvir_ls(childBinding),$curDyn.tmpl.rbEnvirs]
|
|
253
|
+
#Dyndoc.warn "TOTO",(tmp=$curDyn.tmpl.rbEnvirs.values.map{|v| $curDyn.tmpl.rbenvir_ls(v)})
|
|
254
|
+
#Dyndoc.warn "TOTOA",[:a,($curDyn.tmpl.rbEnvirs.values.map{|v| $curDyn.tmpl.rbenvir_ls(v)}.flatten.include? :childBinding)]
|
|
255
|
+
#if $curDyn.tmpl.rbEnvirs.values.map{|v| $curDyn.tmpl.rbenvir_ls(v)}.flatten.include? :childBinding
|
|
256
|
+
# tmp=[];
|
|
257
|
+
# $curDyn.tmpl.rbEnvirs.each_key{|k|
|
|
258
|
+
# Dyndoc.warn "TOTOB",$curDyn.tmpl.rbenvir_ls($curDyn.tmpl.rbEnvirs[k])
|
|
259
|
+
# if $curDyn.tmpl.rbenvir_ls($curDyn.tmpl.rbEnvirs[k]).include? :childBinding
|
|
260
|
+
# if $curDyn.tmpl.rbenvir_ls(($curDyn.tmpl.rbEnvirs[k]).eval("childBinding")).include? :toto
|
|
261
|
+
# tmp << ($curDyn.tmpl.rbEnvirs[k]).eval("childBinding").eval("toto[i]")
|
|
262
|
+
# end
|
|
263
|
+
# end
|
|
264
|
+
# }
|
|
265
|
+
# Dyndoc.warn "TOTO2", tmp
|
|
266
|
+
#end
|
|
267
|
+
|
|
268
|
+
#=end
|
|
269
|
+
[#>]\end{tabular}
|
|
270
|
+
[#meth}
|
|
271
|
+
|
|
272
|
+
{#meth]header.Tabular
|
|
273
|
+
[#rb<]hlines=#{=.hlines}.split(",",-1).map{|e| e.strip}
|
|
274
|
+
[#>]\begin{tabular}{#{.vlines}}:{hlines[0]}
|
|
275
|
+
[#}
|
|
276
|
+
|
|
277
|
+
{#meth]rows.Tabular[#,]what[]
|
|
278
|
+
[#}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
########################################################
|
|
2
|
+
# include: false or in web mode helps to provide additional tag info
|
|
3
|
+
########################################################
|
|
4
|
+
{#def]pdflatex[#,]name[][#,]code[][#,]preamble[][#,]include[][#,]scale[][#,]optTex[][#,]rm[true]
|
|
5
|
+
[#?]#{0?preamble}[#=]preamble[\usepackage{tikz}]
|
|
6
|
+
[#?]end
|
|
7
|
+
[#=]code[\documentclass[varwidth]{standalone}
|
|
8
|
+
#{preamble}
|
|
9
|
+
\begin{document}
|
|
10
|
+
#{code}
|
|
11
|
+
\end{document}
|
|
12
|
+
]
|
|
13
|
+
[#?]{#dyndoc_mode#} == :web [#=]imgName[#{name}][#=]name[{#cqlsweb_rsrc_path]#{name}[#}][#?]end
|
|
14
|
+
[#rb<]
|
|
15
|
+
jobname=#{=name}
|
|
16
|
+
jobname,output=File.basename(jobname),File.dirname(jobname)
|
|
17
|
+
FileUtils.mkdir_p output unless File.directory? output
|
|
18
|
+
#p "PDFLATEX!!! #{name}"
|
|
19
|
+
#p #{=code}
|
|
20
|
+
CqlsDoc::Converter.pdflatex(#{=code},"-jobname="+jobname+" -output-directory="+output)
|
|
21
|
+
[#?]#{rm}[#rb<]#p Dir["#{name}.*"]
|
|
22
|
+
#puts File.readlines("#{name}.log")
|
|
23
|
+
Dir["#{name}.*"].select{|e| File.extname(e)!=".pdf"}.each{|f| File.unlink(f)}
|
|
24
|
+
[#>]{#if]#{=include} != "false"
|
|
25
|
+
[#?]#{+?scale}[#=]optTex[{#if]#{+?optTex}[#>]#{optTex},[#if}#{scale}]
|
|
26
|
+
[#?]#{+?optTex}[#=]optTex[[#{optTex}]][#?]end
|
|
27
|
+
[#>]{#if]{#dyndoc_mode#} == :web[#>]<img src="/rsrc/#{imgName}.pdf" alt="pdflatex :{jobname}" {#if]#{+?include}[#>]#{include}[#if}/>[#else]\includegraphics#{optTex}{#{name}}[#if}
|
|
28
|
+
[#if}
|
|
29
|
+
[#def}
|
|
30
|
+
|
|
31
|
+
{#def]tikzpicture[#,]name[][#,]code[]
|
|
32
|
+
[#rb<]#p #{=code}
|
|
33
|
+
[#>]{#pdflatex]#{name}[#code]\begin{tikzpicture}
|
|
34
|
+
#{code}
|
|
35
|
+
\end{tikzpicture}
|
|
36
|
+
[#}
|
|
37
|
+
[#def}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Pour package latex réfléchir comment faire?
|
|
2
|
+
|
|
3
|
+
{#def]uvTex[#,]code[][#,]key[][#,]file[][#,]syntax[dyndoc][#,]render[amy][#,]lines[true]
|
|
4
|
+
[#rb<]
|
|
5
|
+
syntax,render=#{=syntax}.strip.downcase,#{=render}.strip
|
|
6
|
+
#Dyndoc.warn "Syntax", syntax,render
|
|
7
|
+
#if File.exists? File.join(ENV["HOME"],"dyndoc","share","uv")
|
|
8
|
+
#require File.join(ENV["HOME"],"dyndoc","share","uv","uv")
|
|
9
|
+
require 'dyndoc/common/uv'
|
|
10
|
+
syntax=File.join(Uv.syntax_path,syntax+".syntax")
|
|
11
|
+
#end
|
|
12
|
+
#Dyndoc.warn "test",(!(#{=code}.empty?) or #{=key}.empty?)
|
|
13
|
+
uv_code = (#{=file}.empty? ? nil : File.read(#{=file}))
|
|
14
|
+
uv_code=((!(#{=code}.empty?) or #{=key}.empty?) ? #{=code} : CqlsDoc::Utils.dyndoc_raw_text(#{=key})).strip unless uv_code
|
|
15
|
+
#Dyndoc.warn "CODE", #{=key},uv_code,syntax
|
|
16
|
+
warn_level = $VERBOSE
|
|
17
|
+
$VERBOSE = nil
|
|
18
|
+
uv_res=Uv.parse(uv_code, "latex", syntax , #{lines}, render)
|
|
19
|
+
$VERBOSE = warn_level
|
|
20
|
+
#Dyndoc.warn "RESULT", uv_res
|
|
21
|
+
[#rb>]uv_res
|
|
22
|
+
[#>]<\n>
|
|
23
|
+
[#def}
|
|
24
|
+
|
|
25
|
+
{#def]rverbTexUV[#,]code[][#,]render[amy]
|
|
26
|
+
[#>]{#uvTex]{#rverb]#{code}
|
|
27
|
+
[#mode]raw[#rverb}[#syntax]r[#uvTex}
|
|
28
|
+
[#def}
|
|
29
|
+
|
|
30
|
+
{#def]testDynCode[#,]key[][#,]render[amy][#,]raw[false][#,]result[Result][#>]
|
|
31
|
+
|{#uvTex][#key]#{key}[#render]#{render}[#uvTex}
|
|
32
|
+
|\textbf{#{result}}:[#=]res[{#dyn]test|#{key}[#}][#>]
|
|
33
|
+
|[#?]!(#{=res} =~ /includegraphics/) and !#{raw}[#>]\begin{verbatim}[#?]end[#>]
|
|
34
|
+
|#{res}
|
|
35
|
+
|[#?]!(#{=res} =~ /includegraphics/ ) and !#{raw}[#>]\end{verbatim}[#?]end[#>]
|
|
36
|
+
[#def}
|
|
37
|
+
|
|
38
|
+
{#def]dynCode[#,]key[][#rb>]CqlsDoc::Utils.dyndoc_raw_text(#{=key})[#}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
{#def]knitr_init[#r<]require(knitr)
|
|
42
|
+
opts_knit$set(progress = FALSE, verbose = FALSE)
|
|
43
|
+
if(!exists(".knitr4dyndoc")) .knitr4dyndoc<-list(init=TRUE)
|
|
44
|
+
[#?]#r{.knitr4dyndoc$init}[#<]{#document]
|
|
45
|
+
[#package]\usepackage{color}
|
|
46
|
+
\usepackage{alltt}
|
|
47
|
+
[#preamble]{#blck][#r<].knitr4dyndoc$init <- FALSE
|
|
48
|
+
[#R>]cat(knitr:::make_header_latex(),knitr:::.header.hi.tex,knitr:::.header.framed,sep="\n")[#blck}
|
|
49
|
+
[#document}
|
|
50
|
+
[#def}
|
|
51
|
+
|
|
52
|
+
{#def]knitr[#,]code[]
|
|
53
|
+
[#<]{#knitr_init#}
|
|
54
|
+
[#rb<]code4knitr=#{=code}.gsub(/\\/,'\\\\\\\\')
|
|
55
|
+
[#r<].knitr4dyndoc$res <- knit(text=":{code4knitr}")
|
|
56
|
+
[#R>]cat(.knitr4dyndoc$res)
|
|
57
|
+
[#def}
|
|
58
|
+
|
|
59
|
+
{#def]Sweave[#,]code[]
|
|
60
|
+
[#<]{#knitr_init#}
|
|
61
|
+
[#rb<]code4knitr=#{=code}.gsub(/\\/,'\\\\\\\\')
|
|
62
|
+
[#r<].knitr4dyndoc$res <- Sweave2knitr(text=readLines(textConnection(":{code4knitr}")))
|
|
63
|
+
.knitr4dyndoc$res <- paste(.knitr4dyndoc$res,collapse="\n")
|
|
64
|
+
.knitr4dyndoc$res <- knit(text=.knitr4dyndoc$res)
|
|
65
|
+
[#R>]cat(.knitr4dyndoc$res)
|
|
66
|
+
[#def}
|
|
67
|
+
|
|
68
|
+
## for latex dyndoc documentation
|
|
69
|
+
{#def]seqTag[#,]instr[][#,]bold[false][#>]\texttt{{#if]#{bold}[#>]\bf[#if}\char 91\char 35#{instr}\char 93}[#def}
|
|
70
|
+
{#def]openTag[#,]instr[][#,]bold[false][#>]\texttt{{#if]#{bold}[#>]\bf[#if}\char 123\char 35#{instr}\char 93}[#def}
|
|
71
|
+
{#def]closeTag[#,]instr[][#,]bold[false][#>]\texttt{{#if]#{bold}[#>]\bf[#if}\char 91\char 35#{instr}\char 125}[#def}
|
|
72
|
+
|
|
73
|
+
{#def]OpenTag[#,]instr[][#>]{#openTag]#{instr}[#bold]true[#}[#def}
|
|
74
|
+
{#def]CloseTag[#,]instr[][#>]{#closeTag]#{instr}[#bold]true[#}[#def}
|
|
75
|
+
{#def]SeqTag[#,]instr[][#>]{#seqTag]#{instr}[#bold]true[#}[#def}
|
|
76
|
+
|
|
77
|
+
|
|
Binary file
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{#new]AceEditor[#of]HtmlLoader[#code]
|
|
2
|
+
[<link rel="stylesheet" type="text/css" href="/dHtmlX/dhtmlx.css"/>
|
|
3
|
+
<link rel="stylesheet" type="text/css" href="/dHtmlX/types/ftypes.css"/>
|
|
4
|
+
<link href="/stylesheets/fileuploader.css" rel="stylesheet" type="text/css"/>
|
|
5
|
+
<script src="/dHtmlX/dhtmlx.js"></script>
|
|
6
|
+
<script src="/dHtmlX/types/ftypes.js"></script>
|
|
7
|
+
<script src="/javascripts/fileuploader.js" type="text/javascript"></script>]
|
|
8
|
+
[#}
|
|
9
|
+
|
|
10
|
+
{#meth]new.AceEditor[#,]key[][#,].mode[latex,ruby][#,].theme[twilight,chrome,clouds,cobalt,crimson_editor,dawn,dreamweaver,eclipse,idle_fingers,kr_theme,merbivore,merbivore_soft,mono_industrial,monokai,pastel_on_dark,solarized_dark,solarized_light,textmate,tomorrow,tomorrow_night_blue,tomorrow_night_bright,tomorrow_night_eighties,tomorrow_night,tomorrow,vibrant_ink,xcode]
|
|
11
|
+
[#=].key[{#if]#{+?key}[#>]#{key}[#else]{#objname]self[#}[#if}]
|
|
12
|
+
[#}
|
|
13
|
+
|
|
14
|
+
{#meth]init.AceEditor[#,]theme[#{.theme}][#,]mode[#{.mode}][#>]
|
|
15
|
+
<div id="main" style="position: absolute; top: 80px; width: 97.5%; height: 100%; margin: 0px;overflow: auto"></div>
|
|
16
|
+
<div id="editor" style="width: 100%; height: 100%;overflow: auto"></div>
|
|
17
|
+
<div id="log"></div>
|
|
18
|
+
<div id="html"></div>
|
|
19
|
+
<div id="editor-fileuploader">
|
|
20
|
+
Before uploading files, select a target directory in the tree beside (no selection means root tree).</br>
|
|
21
|
+
Click the button below or drag files on it.</br></br>
|
|
22
|
+
<div id="qqfileuploader">
|
|
23
|
+
|
|
24
|
+
<noscript>
|
|
25
|
+
<p>Please enable JavaScript to use file uploader.</p>
|
|
26
|
+
<!-- or put a simple form for upload here -->
|
|
27
|
+
</noscript>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<script src="/ace/ace.js" type="text/javascript" charset="utf-8"></script>
|
|
32
|
+
<script src="/ace/keybinding-emacs.js" type="text/javascript" charset="utf-8"></script>
|
|
33
|
+
{#case]th:#{theme}[#else][#>]<script src="/ace/theme-#{th}.js" type="text/javascript" charset="utf-8"></script>[#\n][#case}
|
|
34
|
+
{#case]md:#{mode}[#else][#>]<script src="/ace/mode-#{md}.js" type="text/javascript" charset="utf-8"></script>[#\n][#case}
|
|
35
|
+
{#hide]
|
|
36
|
+
<script src="/ace-mode-rstudio/extern.js" type="text/javascript" charset="utf-8"></script>
|
|
37
|
+
<script src="/ace-mode-rstudio/auto_brace_insert.js" type="text/javascript" charset="utf-8"></script>
|
|
38
|
+
<script src="/ace-mode-rstudio/tex_highlight_rules.js" type="text/javascript" charset="utf-8"></script>
|
|
39
|
+
<script src="/ace-mode-rstudio/r_highlight_rules.js" type="text/javascript" charset="utf-8"></script>
|
|
40
|
+
<script src="/ace-mode-rstudio/r.js" type="text/javascript" charset="utf-8"></script>
|
|
41
|
+
<script src="/ace-mode-rstudio/r_code_model.js" type="text/javascript" charset="utf-8"></script>
|
|
42
|
+
<script src="/ace-mode-rstudio/r_scope_tree.js" type="text/javascript" charset="utf-8"></script>
|
|
43
|
+
[#hide}
|
|
44
|
+
<script src="/javascripts/acEditor-mode-r.js" type="text/javascript" charset="utf-8"></script>
|
|
45
|
+
<script src="/javascripts/acEditor-mode-dyndoc.js" type="text/javascript" charset="utf-8"></script>
|
|
46
|
+
<script src="/javascripts/acEditor_dyndoc.js" type="text/javascript" charset="utf-8"></script>
|
|
47
|
+
<script>
|
|
48
|
+
function dyndoc_editor_init() {
|
|
49
|
+
var editor=new DyndocACEditor('#{theme}','#{mode}');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
window.onload = dyndoc_editor_init;
|
|
53
|
+
</script>
|
|
54
|
+
[#}
|