diff options
Diffstat (limited to 'guides/rails_guides')
-rw-r--r-- | guides/rails_guides/markdown/renderer.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/guides/rails_guides/markdown/renderer.rb b/guides/rails_guides/markdown/renderer.rb index d76ec53b34..2f36af1fb3 100644 --- a/guides/rails_guides/markdown/renderer.rb +++ b/guides/rails_guides/markdown/renderer.rb @@ -25,13 +25,24 @@ HTML def paragraph(text) if text =~ /^(TIP|IMPORTANT|CAUTION|WARNING|NOTE|INFO|TODO)[.:](.*?)/ convert_notes(text) + elsif text =~ /^\[<sup>(\d+)\]:<\/sup> (.+)$/ + linkback = %(<a href="#footnote-#{$1}-ref"><sup>#{$1}</sup></a>) + %(<p class="footnote" id="footnote-#{$1}">#{linkback} #{$2}</p>) else + text = convert_footnotes(text) "<p>#{text}</p>" end end private + def convert_footnotes(text) + text.gsub(/\[<sup>(\d+)\]<\/sup>/i) do + %(<sup class="footnote" id="footnote-#{$1}-ref">) + + %(<a href="#footnote-#{$1}">#{$1}</a></sup>) + end + end + def brush_for(code_type) case code_type when 'ruby', 'sql', 'plain' |