Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

one way function linking from examples

  • Loading branch information...
commit 5a2b8ba1ab421867ed110a4f382a0b4c2ce1d42c 1 parent 271ec42
@schacon schacon authored
View
5 TODO.txt
@@ -1,10 +1,11 @@
TODO
-* links to example usage from example docco'd code
-
+* cross-link rocco code
* fix to group chooser
+* version history for types, too
+
* only update certain tags / HEAD, force full update
* doc other branches (specify in config file)
View
2  docurium.gemspec
@@ -15,6 +15,8 @@ Gem::Specification.new do |s|
s.rubyforge_project = 'docurium'
s.add_dependency "version_sorter", "~>1.1.0"
+ s.add_dependency "mustache", ">= 0.99.4"
+ s.add_dependency "rocco", "= 0.7.0"
s.add_development_dependency "bundler", "~>1.0"
s.files = `git ls-files`.split("\n")
View
15 lib/docurium.rb
@@ -6,7 +6,7 @@
require 'pp'
class Docurium
- Version = VERSION = '0.0.2'
+ Version = VERSION = '0.0.3'
attr_accessor :branch, :output_dir, :data
@@ -69,10 +69,22 @@ def generate_docs
end
files.each do |file|
out " # #{file}"
+
+ # highlight, roccoize and link
rocco = Rocco.new(file, files, {:language => 'c'})
rocco_layout = Rocco::Layout.new(rocco, tf)
rocco_layout.version = version
rf = rocco_layout.render
+
+ # look for function names in the examples and link
+ @data[:functions].each do |f, fdata|
+ rf.gsub!(f) do |f|
+ # save data for cross-link
+ "<a href=\"../../##{version}/group/#{fdata[:group]}/#{f}\">#{f}</a>"
+ end
+ end
+
+ # write example to docs directory
rf_path = File.basename(file).split('.')[0..-2].join('.') + '.html'
rel_path = "ex/#{version}/#{rf_path}"
rf_path = File.join(outdir, rel_path)
@@ -239,6 +251,7 @@ def group_functions
if !rest
group = value[:file].gsub('.h', '').gsub('/', '_')
end
+ @data[:functions][key][:group] = group
func[group] ||= []
func[group] << key
func[group].sort!
View
2  lib/docurium/layout.mustache
@@ -12,7 +12,7 @@
Jump To &hellip;
<div id="jump_wrapper">
<div id="jump_page">
- <a class="source" href="/#{{ version }}">API Docs</a>
+ <a class="source" href="../../#{{ version }}">API Docs</a>
{{#sources}}
<a class="source" href="{{ url }}">{{ basename }}</a>
{{/sources}}
Please sign in to comment.
Something went wrong with that request. Please try again.