riddl 0.99.200 → 0.99.201

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c67aa38ff11dcb881b3ea8653e11d12da9611687
4
- data.tar.gz: cb1bde4833c693dae96bd714d1d30b38e78b798a
3
+ metadata.gz: 21c0e9e4bba99ce37d3853069628442dfd21ed25
4
+ data.tar.gz: 034b4367ae7b1d1432695585fcaba8b172080e37
5
5
  SHA512:
6
- metadata.gz: d5229e2f25d0b333031a6ee59e097056a9653f198924245d2f4b16c4914c37d6f8a25a5068696aa6c390be9fd7618f63dd2ea2a77a99dbfea266e28a53ce2a9f
7
- data.tar.gz: c4743b2544bf733c8e24339c61503d19f895a6b8b3562d31ceb23f9e364362043597bf9f440973c6a540dd23c0ede4ab3a0367daf46f137b9d5bffb28cbae89c
6
+ metadata.gz: 46b8be50b6c6165955a95295719ec5fceaa6f4203d948e623340a96932b88b9ecd55c50fd641c190b1e816d31f49f9f54c14ed529d1cf271fcd30b5e70ad235e
7
+ data.tar.gz: 08e0bb4042364870e1c64b189cba34cc6e48a6827e255fc8e01d932e6745fe42f2917cf854d159fb67f39fe619334af8c47e519fcb1a15ba48006b8d04855b6b
@@ -21,6 +21,9 @@
21
21
  content: counter(h1counter) "." counter(h2counter) ".\0000a0\0000a0";
22
22
  counter-increment: h2counter;
23
23
  }
24
+ .code {
25
+ border: 1px dashed #425d73; background-color: #DEE6EE; margin:0px; padding: 0.5em 1em; font-family: monospace; font-size:0.9em;
26
+ }
24
27
  </style>
25
28
 
26
29
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
@@ -43,6 +46,33 @@
43
46
  return out;
44
47
  };
45
48
 
49
+ function docChildren(path,name,data){
50
+ var ret= [];
51
+ var subject = path ? $(path,data) : $(data);
52
+ subject.children().each(function(k,ele){
53
+ if (ele.localName == name && ele.namespaceURI == "http://riddl.org/ns/documentation/1.0") {
54
+ ret.push(ele);
55
+ }
56
+ });
57
+ return $(ret);
58
+ }
59
+
60
+ function codeFormat(temp) {
61
+ temp = temp.replace(/\&/g,"&amp;").replace(/\"/g,"&quot;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/'/g,"&apos;");
62
+ temp = temp.replace(/\t/g,' ');
63
+ temp = temp.replace(/\r/g,'');
64
+ temp = temp.replace(/^$/g,' ');
65
+ temp = temp.replace(/^ */gm,function mf(m){
66
+ var tm = (m.length + 2) * 0.6 + 2 * 0.6;
67
+ return "<div style='text-indent:-" + tm + "em;margin-left:" + tm + "em'>" + (Array(m.length + 1).join("&#160;"));
68
+ });
69
+ temp = temp.replace(/ /g," &#160;");
70
+ temp = temp.replace(/\n/g,"</div>\n");
71
+ temp += "</div>\n";
72
+ temp = temp.replace(/href=&quot;([^&]+)&quot;/g,'href=&quot;<a href="/__doc_includes/$1">$1</a>&quot;')
73
+ return temp;
74
+ }
75
+
46
76
  $(document).ready(function(){
47
77
  var rpath = "<%= @h['RIDDL_DECLARATION_PATH'] %>";
48
78
  var pathele = _.compact(rpath.split('/'));
@@ -60,15 +90,16 @@
60
90
  $.ajax({
61
91
  url: rpath + "?riddl-resource-description",
62
92
  success: function(data){
63
- $('#main').append(marked($('description > resource > documentation',data).text()));
93
+ $('#main').append(marked(docChildren('description > resource','documentation',data).text()));
64
94
 
65
95
  var subr = $('description > resource > resource',data);
66
96
  if (subr.length == 0) {
67
97
  $('#subresources').remove();
68
98
  } else {
69
99
  $('description > resource > resource',data).each(function(k,ele){
70
- var sum = $('documentation',ele).attr('summary');
71
- var exa = $('example',ele).length == 0 ? null : $('example',ele).text();
100
+ var sum = docChildren(null,'documentation',ele).attr('summary');
101
+ var exa = docChildren(null,'example',ele);
102
+ exa = exa.length == 0 ? null : exa.text();
72
103
  if (exa) {
73
104
  var rell = exa;
74
105
  var relt = exa + ' (' + $(ele).attr('relative') + ')';
@@ -87,11 +118,11 @@
87
118
  });
88
119
  }
89
120
 
90
- var oprs = $('description > resource > :not(documentation):not(resource):not(example)',data);
121
+ var oprs = $('description > resource > get, description > resource > post, description > resource > put, description > resource > delete, description > resource > request',data);
91
122
  if (oprs.length == 0) {
92
123
  $('#operations').remove();
93
124
  } else {
94
- $('description > resource > :not(documentation):not(resource):not(example)',data).each(function(k,ele){
125
+ oprs.each(function(k,ele){
95
126
  var sum = $('documentation',ele).attr('summary');
96
127
  var details = $('documentation',ele).text();
97
128
  var tin = $(ele).attr('in');
@@ -159,12 +190,12 @@
159
190
  }
160
191
 
161
192
  if (tin && tin != "*") {
162
- $('.input .message',clone).text(vkbeautify.xml($(tinmess).serializeXML()));
193
+ $('.input .message',clone).html(codeFormat(vkbeautify.xml($(tinmess).serializeXML(),' ')));
163
194
  } else {
164
195
  $('.input',clone).remove();
165
196
  }
166
197
  if (tout) {
167
- $('.output .message',clone).text(vkbeautify.xml($(toutmess).serializeXML()));
198
+ $('.output .message',clone).html(codeFormat(vkbeautify.xml($(toutmess).serializeXML(),' ')));
168
199
  } else {
169
200
  $('.output',clone).remove();
170
201
  }
@@ -187,11 +218,11 @@
187
218
  <p class="text"></p>
188
219
  <div class="input">
189
220
  <h3>Input</h3>
190
- <pre class='message'></pre>
221
+ <div class='message code'></div>
191
222
  </div>
192
223
  <div class="output">
193
224
  <h3>Output</h3>
194
- <pre class='message'></pre>
225
+ <div class='message code'></div>
195
226
  </div>
196
227
  </section>
197
228
  </template>
@@ -8,23 +8,24 @@ module Riddl
8
8
  class WrapperUtils
9
9
  def get_resource_deep(path,pres)
10
10
  #{{{
11
- path.split('/').each do |pa|
11
+ path.split('/(').each do |pa|
12
+ pa.chop!
12
13
  next if pa == ""
13
14
  if pres.resources.has_key?(pa)
14
15
  pres = pres.resources[pa]
15
16
  else
16
17
  return nil
17
18
  end
18
- end
19
+ end unless path == '/'
19
20
  pres
20
21
  #}}}
21
22
  end
22
- def rpaths(res,what)
23
+ def rpaths(res,what,finalize=false)
23
24
  #{{{
24
- what += what == '' ? '/' : res.path
25
+ what += what == '' ? '/' : (finalize ? '(' + res.path + ')' : res.path)
25
26
  ret = [[what,res.recursive]]
26
27
  res.resources.each do |name,r|
27
- ret += rpaths(r,what == '/' ? what : what + '/')
28
+ ret += rpaths(r,what == '/' ? what : what + '/',finalize)
28
29
  end
29
30
  ret.sort!
30
31
  ret
@@ -265,6 +266,7 @@ module Riddl
265
266
  description
266
267
  declaration
267
268
  tmp = []
269
+
268
270
  tmp = @description.paths if @is_description
269
271
  tmp = @declaration.paths if @is_declaration
270
272
  tmp.map do |t|
@@ -11,7 +11,7 @@ module Riddl
11
11
  get_resource_deep(path,@facade.resource)
12
12
  end
13
13
  def paths
14
- rpaths(@facade.resource,'')
14
+ rpaths(@facade.resource,'',true)
15
15
  end
16
16
 
17
17
  def description_xml
@@ -7,7 +7,7 @@ module Riddl
7
7
  class Description < WrapperUtils
8
8
 
9
9
  def paths(res=@resource,what='')
10
- rpaths(res,what)
10
+ rpaths(res,what,true)
11
11
  end
12
12
  def get_resource(path)
13
13
  get_resource_deep(path,@resource)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "riddl"
3
- s.version = "0.99.200"
3
+ s.version = "0.99.201"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3"
6
6
  s.summary = "restful interface description and declaration language: tools and client/server libs"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riddl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.99.200
4
+ version: 0.99.201
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
8
8
  autorequire:
9
9
  bindir: tools
10
10
  cert_chain: []
11
- date: 2015-12-29 00:00:00.000000000 Z
11
+ date: 2016-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xml-smart