dyndoc-ruby 0.7.3 → 0.7.4
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 +4 -4
- data/bin/dyn +4 -0
- data/lib/dyndoc-convert.rb +26 -8
- data/share/dyndoc.yml/README.md +1 -0
- data/share/dyndoc.yml/example.dyndoc.yml +4 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92aec761fb25501bdaa7c77b583627e1f18b2a8a
|
4
|
+
data.tar.gz: a7edf41a3bda9d06afeb5f46daa76b387f103d4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdbb1be0061c988046b91027312d7c54d649169395eab6440fe02e83f8561029d722fef771e25b0483c876cb3404a1b2d15ff28fb7aa96777113ed64a3e2fd2c
|
7
|
+
data.tar.gz: 9838e9e865f98c9101b2b088d211c3be8596b0c0071b56e92268c8c879d7c399751b38d5183c6026d8f9d76a6ae32dcf67e08b823164199bc045833e2cecabc1
|
data/bin/dyn
CHANGED
@@ -59,6 +59,10 @@ OptionParser.new do |opts|
|
|
59
59
|
Settings["cfg_dyn.cmd_doc"] = [:list]
|
60
60
|
end
|
61
61
|
|
62
|
+
opts.on("-j", "--jl", "import julia") do
|
63
|
+
Settings["cfg_dyn.langs"] << :jl
|
64
|
+
end
|
65
|
+
|
62
66
|
# opts.on("-r", "--remote", "pandoc or pdflatex (dyn)task performed remotely") do
|
63
67
|
# Settings["cfg_dyn.remote_dyntask"] = true
|
64
68
|
# end
|
data/lib/dyndoc-convert.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "dyndoc-core"
|
2
2
|
require 'dyndoc/cli/interactive-client.rb'
|
3
|
+
require 'yaml'
|
3
4
|
|
4
5
|
|
5
6
|
module Dyndoc
|
@@ -42,10 +43,24 @@ module Dyndoc
|
|
42
43
|
def Dyndoc.cli_convert_from_file(dyn_file,html_file,root={}) #ex: root={dyn: , html: }
|
43
44
|
addr="127.0.0.1"
|
44
45
|
|
46
|
+
return unless root[:dyn]
|
47
|
+
|
45
48
|
dyn_libs,dyn_tags=nil,nil
|
46
49
|
|
50
|
+
## requirement: dyn_file is provided relatively to the root[:dyn] (for security reason too)
|
51
|
+
|
52
|
+
dyn_path=dyn_file.split(File::Separator)
|
53
|
+
|
54
|
+
dyn_file=File.join(root[:dyn],dyn_file) unless dyn_file[0]=="/"
|
55
|
+
|
47
56
|
if i=(dyn_file =~ /\_?(?:html)?\.dyn$/)
|
48
57
|
|
58
|
+
cfg={}
|
59
|
+
## find the previous config.yml in the tree folder
|
60
|
+
cfg_yml_files=dyn_path.inject([""]) {|res,e| res + [(res[-1,1]+[e]).flatten]}.map{|pa| File.join(root[:dyn],pa,"config.yml")}.reverse
|
61
|
+
cfg_yml_file=cfg_yml_files.select{|c| File.exists? c}[0]
|
62
|
+
cfg=YAML::load_file(cfg_yml_file) if cfg_yml_file
|
63
|
+
|
49
64
|
## Dyn layout
|
50
65
|
dyn_layout=dyn_file[0...i]+"_layout.dyn" if File.exist? dyn_file[0...i]+"_layout.dyn"
|
51
66
|
|
@@ -55,11 +70,10 @@ module Dyndoc
|
|
55
70
|
## Dyn post
|
56
71
|
dyn_post_code=File.read(dyn_file[0...i]+"_post.dyn") if File.exist? dyn_file[0...i]+"_post.dyn"
|
57
72
|
|
58
|
-
cfg={}
|
59
73
|
|
60
74
|
if File.exist? dyn_file[0...i]+".dyn_cfg"
|
61
|
-
|
62
|
-
|
75
|
+
cfg.merge!{YAML::load_file(dyn_file[0...i]+".dyn_cfg")}
|
76
|
+
else # try do find (in the Zope spirit) a config file in the nearest folder
|
63
77
|
end
|
64
78
|
|
65
79
|
## code to evaluate
|
@@ -82,7 +96,7 @@ module Dyndoc
|
|
82
96
|
html_root= cfg["html_root"] || root[:html] || File.expand_path("..",dyn_file)
|
83
97
|
|
84
98
|
if cfg["layout"]
|
85
|
-
cfg_tmp=File.join(dyn_root,cfg["layout"])
|
99
|
+
cfg_tmp=File.join(dyn_root,cfg["layout"][0] == "/" ? cfg["layout"][1..-1] : ["layout",cfg["layout"]])
|
86
100
|
dyn_layout=cfg_tmp if !dyn_layout and File.exist? cfg_tmp
|
87
101
|
end
|
88
102
|
if cfg["pre"]
|
@@ -95,13 +109,17 @@ module Dyndoc
|
|
95
109
|
dyn_post_code=File.read(cfg_tmp) unless dyn_post_code and File.exist? cfg_tmp
|
96
110
|
end
|
97
111
|
|
98
|
-
|
99
|
-
|
112
|
+
## deal with html_file
|
113
|
+
html_file=File.join(html_root,cfg["html_file"] || html_file)
|
114
|
+
unless File.exist? html_file
|
115
|
+
dirname=File.dirname(html_file)
|
116
|
+
require 'fileutils'
|
117
|
+
FileUtils.mkdir_p dirname
|
100
118
|
end
|
101
119
|
|
102
120
|
dyn_libs=cfg["libs"].strip if cfg["libs"]
|
103
121
|
|
104
|
-
dyn_tags="[#<]{#opt]"+cfg["tags"].strip+"[#opt}" if cfg["tags"]
|
122
|
+
dyn_tags="[#<]{#opt]"+cfg["tags"].strip+"[#opt}[#>]" if cfg["tags"]
|
105
123
|
|
106
124
|
if dyn_libs or dyn_pre_code
|
107
125
|
code_pre = ""
|
@@ -111,8 +129,8 @@ module Dyndoc
|
|
111
129
|
end
|
112
130
|
code += "\n" + dyn_post_code if dyn_post_code
|
113
131
|
## TO TEST!!!
|
114
|
-
code = dyn_tags + code if dyn_tags
|
115
132
|
code = "[#rb<]page = " + page.inspect + "[#>]" +code if page
|
133
|
+
code = dyn_tags + code if dyn_tags
|
116
134
|
dyndoc_start=[:dyndoc_libs,:dyndoc_layout]
|
117
135
|
|
118
136
|
cli=Dyndoc::InteractiveClient.new(code,dyn_file,addr,dyndoc_start)
|
@@ -0,0 +1 @@
|
|
1
|
+
rename `example.dyndoc.yml` `~/.dyndoc.yml` to activate both `R` and `julia`
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dyndoc-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CQLS
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: R4rb
|
@@ -113,6 +113,8 @@ files:
|
|
113
113
|
- share/demo/testBeamer.dyn
|
114
114
|
- share/demo/testBeamer_lib.dyn
|
115
115
|
- share/demo/test_atom.dyn
|
116
|
+
- share/dyndoc.yml/README.md
|
117
|
+
- share/dyndoc.yml/example.dyndoc.yml
|
116
118
|
- share/etc/alias
|
117
119
|
- share/etc/dyn-cli/dyn_layout
|
118
120
|
- share/etc/dyn-cli/layout/default.dyn
|