dyndoc-ruby 0.8.0 → 0.8.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-convert.rb +28 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 435bd097c09c1f84c3563c140c1d2ddc0c1cefbe
|
4
|
+
data.tar.gz: dab182d72493fd9e57becbcf893d02d4946b0499
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67718adc452e2b60a4125e2ce4c4181f378f30e72e6eb9fa95e7ff29f9acb4ede9008fac4a1ea999b7c5c0b39b913fe22fbe4d150870d7ab5a855a040226452e
|
7
|
+
data.tar.gz: 73ec96e20978162b86e0e2738261f63ef0948e3aee0c70fbf3c7d5aac28af4ad94dc12986809073fa28c9c39a6741513d0dcbe2c8491c3f6f534c1d6fa50b44a
|
data/lib/dyndoc-convert.rb
CHANGED
@@ -51,8 +51,26 @@ module Dyndoc
|
|
51
51
|
|
52
52
|
dyn_path=dyn_file.split(File::Separator)
|
53
53
|
|
54
|
+
## Complete info related to the related dyn file
|
55
|
+
html_files=opts[:html_files]
|
56
|
+
if opts[:user]
|
57
|
+
html_urls={}
|
58
|
+
html_files.each{|tag,html_file| html_urls[tag]=(html_file =~ /^\/users\/#{opts[:user]}(.*)/ ? $1 : html_file)}
|
59
|
+
html_files=html_urls
|
60
|
+
end
|
61
|
+
|
62
|
+
cfg_files={
|
63
|
+
fullname: dyn_file,
|
64
|
+
basename: File.basename(dyn_file,".*"),
|
65
|
+
long_url: html_file,
|
66
|
+
url: File.basename(html_file,".*"),
|
67
|
+
tag: opts[:doc_tag],
|
68
|
+
urls: html_files
|
69
|
+
}
|
70
|
+
|
54
71
|
dyn_file=File.join(opts[:dyn_root],dyn_file) unless dyn_file[0]=="/"
|
55
72
|
|
73
|
+
|
56
74
|
if i=(dyn_file =~ /\_?(?:html)?\.dyn$/)
|
57
75
|
|
58
76
|
cfg={}
|
@@ -62,6 +80,9 @@ module Dyndoc
|
|
62
80
|
cfg_yml_file=cfg_yml_files.select{|c| File.exists? c}[0]
|
63
81
|
cfg=YAML::load_file(cfg_yml_file) if cfg_yml_file
|
64
82
|
|
83
|
+
## add info related to dyn file
|
84
|
+
cfg.merge!(cfg_files)
|
85
|
+
|
65
86
|
## Dyn layout
|
66
87
|
dyn_layout=dyn_file[0...i]+"_layout.dyn" if File.exist? dyn_file[0...i]+"_layout.dyn"
|
67
88
|
|
@@ -80,7 +101,7 @@ module Dyndoc
|
|
80
101
|
## code to evaluate
|
81
102
|
code=File.read(dyn_file)
|
82
103
|
|
83
|
-
page=
|
104
|
+
page={}
|
84
105
|
|
85
106
|
if code =~ /^\-{3}/
|
86
107
|
b=code.split(/^(\-{3,})/,-1)
|
@@ -102,6 +123,7 @@ module Dyndoc
|
|
102
123
|
else
|
103
124
|
cfg_tmp=File.join(dyn_root,cfg["layout"][0] == "/" ? cfg["layout"][1..-1] : ["layout",cfg["layout"]])
|
104
125
|
end
|
126
|
+
Dyndoc.warn :layout,cfg_tmp
|
105
127
|
dyn_layout=cfg_tmp if !dyn_layout and File.exist? cfg_tmp
|
106
128
|
end
|
107
129
|
if cfg["pre"]
|
@@ -141,7 +163,7 @@ module Dyndoc
|
|
141
163
|
docs_tags += (cfg["tags"]||"").split(",").map{|e| e.strip}
|
142
164
|
dyn_tags="[#<]{#opt]"+docs_tags.join(",")+"[#opt}[#>]" unless docs_tags.empty?
|
143
165
|
|
144
|
-
Dyndoc.warn :dyn_tags,[docs_tags,dyn_tags]
|
166
|
+
### Dyndoc.warn :dyn_tags,[docs_tags,dyn_tags]
|
145
167
|
|
146
168
|
if dyn_libs or dyn_pre_code
|
147
169
|
code_pre = ""
|
@@ -151,8 +173,9 @@ module Dyndoc
|
|
151
173
|
end
|
152
174
|
code += "\n" + dyn_post_code if dyn_post_code
|
153
175
|
## TO TEST!!!
|
154
|
-
|
155
|
-
|
176
|
+
Dyndoc.warn :cfg,cfg
|
177
|
+
Dyndoc.warn :page,page
|
178
|
+
code = "[#rb<]require 'ostruct';cfg = OpenStruct.new(" + cfg.inspect + ");page = OpenStruct.new(" + page.inspect + ")[#>]" +code
|
156
179
|
code = dyn_tags + code if dyn_tags
|
157
180
|
|
158
181
|
## add path for user
|
@@ -162,8 +185,7 @@ module Dyndoc
|
|
162
185
|
code_path << "[#main][#<]\n"
|
163
186
|
code = code_path + code
|
164
187
|
|
165
|
-
###
|
166
|
-
Dyndoc.warn :code,code
|
188
|
+
### Dyndoc.warn :code,code
|
167
189
|
|
168
190
|
dyndoc_start=[:dyndoc_libs,:dyndoc_layout]
|
169
191
|
|