docurium 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/TODO.txt CHANGED
@@ -1,10 +1,11 @@
1
1
  TODO
2
2
 
3
- * links to example usage from example docco'd code
4
-
3
+ * cross-link rocco code
5
4
 
6
5
  * fix to group chooser
7
6
 
7
+ * version history for types, too
8
+
8
9
  * only update certain tags / HEAD, force full update
9
10
 
10
11
  * doc other branches (specify in config file)
data/lib/docurium.rb CHANGED
@@ -6,7 +6,7 @@ require 'docurium/layout'
6
6
  require 'pp'
7
7
 
8
8
  class Docurium
9
- Version = VERSION = '0.0.2'
9
+ Version = VERSION = '0.0.3'
10
10
 
11
11
  attr_accessor :branch, :output_dir, :data
12
12
 
@@ -69,13 +69,33 @@ class Docurium
69
69
  end
70
70
  files.each do |file|
71
71
  out " # #{file}"
72
+
73
+ # highlight, roccoize and link
72
74
  rocco = Rocco.new(file, files, {:language => 'c'})
73
75
  rocco_layout = Rocco::Layout.new(rocco, tf)
74
76
  rocco_layout.version = version
75
77
  rf = rocco_layout.render
78
+
76
79
  rf_path = File.basename(file).split('.')[0..-2].join('.') + '.html'
77
80
  rel_path = "ex/#{version}/#{rf_path}"
78
81
  rf_path = File.join(outdir, rel_path)
82
+
83
+ # look for function names in the examples and link
84
+ id_num = 0
85
+ @data[:functions].each do |f, fdata|
86
+ rf.gsub!(/#{f}([^\w])/) do |fmatch|
87
+ extra = $1
88
+ id_num += 1
89
+ name = f + '-' + id_num.to_s
90
+ # save data for cross-link
91
+ @data[:functions][f][:examples] ||= {}
92
+ @data[:functions][f][:examples][file] ||= []
93
+ @data[:functions][f][:examples][file] << rel_path + '#' + name
94
+ "<a name=\"#{name}\" href=\"../../##{version}/group/#{fdata[:group]}/#{f}\">#{f}</a>#{extra}"
95
+ end
96
+ end
97
+
98
+ # write example to docs directory
79
99
  FileUtils.mkdir_p(File.dirname(rf_path))
80
100
  File.open(rf_path, 'w+') do |f|
81
101
  @data[:examples] ||= []
@@ -239,6 +259,7 @@ class Docurium
239
259
  if !rest
240
260
  group = value[:file].gsub('.h', '').gsub('/', '_')
241
261
  end
262
+ @data[:functions][key][:group] = group
242
263
  func[group] ||= []
243
264
  func[group] << key
244
265
  func[group].sort!
data/site/css/style.css CHANGED
@@ -184,6 +184,10 @@ h1.funcTitle small {
184
184
  padding: 10px;
185
185
  }
186
186
 
187
+ .funcEx {
188
+ padding: 10px;
189
+ }
190
+
187
191
  .signatures a {
188
192
  background: #ddd;
189
193
  padding: 4px;
data/site/js/docurium.js CHANGED
@@ -181,6 +181,23 @@ $(function() {
181
181
  flink = $('<a>').attr('target', 'github').attr('href', link).append(fdata[fname].file)
182
182
  content.append($('<div>').addClass('fileLink').append("Defined in: ").append(flink))
183
183
 
184
+ // Show where this is used in the examples
185
+ if(ex = fdata[fname].examples) {
186
+ also = $('<div>').addClass('funcEx')
187
+ also.append("Used in examples: ")
188
+ for( fname in ex ) {
189
+ lines = ex[fname]
190
+ line = $('<li>')
191
+ line.append($('<strong>').append(fname))
192
+ for( var i in lines ) {
193
+ flink = $('<a>').attr('href', lines[i]).append(' [' + (parseInt(i) + 1) + '] ')
194
+ line.append(flink)
195
+ }
196
+ also.append(line)
197
+ }
198
+ content.append(also)
199
+ }
200
+
184
201
  // Show other functions in this group
185
202
  also = $('<div>').addClass('also')
186
203
  flink = $('<a href="#" ref="' + ref.toString() + '" id="groupItem' + group[0] + '">' + group[0] + '</a>')
@@ -377,19 +394,7 @@ $(function() {
377
394
 
378
395
  groupHash: false,
379
396
  groupOf: function (func) {
380
- if(!this.groupHash) {
381
- this.groupHash = {}
382
- data = this.get('data')
383
- for(var i=0; i<data['groups'].length; i++) {
384
- group = data['groups'][i][1]
385
- groupName = data['groups'][i][0]
386
- for(var j=0; j<group.length; j++) {
387
- f = group[j]
388
- this.groupHash[f] = groupName
389
- }
390
- }
391
- }
392
- return this.groupHash[func]
397
+ return this.get('data').functions[func].group
393
398
  },
394
399
 
395
400
  addHotlinks: function() {
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docurium
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Scott Chacon