Permalink
Browse files

allow comments to link to other figures

  • Loading branch information...
1 parent 83a26c3 commit 1d72d1e779c6950ee07a80ee23557a15a1fcdfaf @jamis committed Jan 31, 2010
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/build.rb
View
@@ -48,7 +48,19 @@ def htmlify(text)
index += 1
end
- f.print " <span class='comment'>(#{htmlify(comment)})</span>" if comment
+ if comment
+ comment = htmlify(comment).gsub(/\[\[(.*?)\]\]/) do
+ target = $1
+ if data[target]
+ "<a href='#{file_for($1)}'>#{target}</a>"
+ else
+ warn "no such figure #{target.inspect}"
+ target
+ end
+ end
+ f.print " <span class='comment'>(#{comment})</span>"
+ end
+
f.print "</div>"
f.puts '</li>'
end

0 comments on commit 1d72d1e

Please sign in to comment.