Changeset 127
- Timestamp:
- 04/26/2006 23:04:48 (3 years ago)
- Files:
-
- 1 modified
-
trunk/lib/redcloth/docbook.rb (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/redcloth/docbook.rb
r126 r127 255 255 text.gsub!( %r{<programlisting>\n}, "<programlisting>" ) 256 256 text.gsub!( %r{\n</programlisting>}, "</programlisting>\n" ) 257 257 258 i = 1 259 text.gsub!(/\[\d+\]/) do |ref| 260 id = ref[/\d+/].to_i 261 if id == i 262 i += 1 263 if text =~ /<footnote id="fn#{id}">(.*?)<\/footnote>/ 264 "<footnote id=\"footnote#{id}\">#{$1}</footnote>" 265 else 266 ref 267 end 268 else 269 ref 270 end 271 end 272 273 text.gsub!(/<footnote id="fn\d+">(.*?)<\/footnote>/, '') 274 258 275 DOCBOOK_TAGS.each do |qtag_rc, ht, qtag_re, rtype, escaped_re| 259 276 text.gsub!( escaped_re ) do |m| … … 568 585 def docbook_fn_( tag, num, atts, cite, content ) 569 586 atts << " id=\"fn#{ num }\"" 570 content = "<superscript>#{ num }</superscript> #{ content }"571 587 atts = shelve( atts ) if atts 572 "< para>#{ content }</para>"588 "<footnote#{atts}><para>#{ content }</para></footnote>" 573 589 end 574 590 … … 689 705 end 690 706 691 def docbook_footnote_ref( text )692 text.gsub!( /\b\[([0-9]+?)\](\s)?/,693 '<superscript><link linkend="#fn\1">\1</link></superscript>\2' )694 end695 696 707 def inline_docbook_glyphs( text, level = 0 ) 697 708 if text !~ HASTAG_MATCH 698 709 docbook_pgl text 699 docbook_footnote_ref text700 710 else 701 711 codepre = 0