diff options
Diffstat (limited to 'lib/sisu/v5/html_tune.rb')
-rw-r--r-- | lib/sisu/v5/html_tune.rb | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/sisu/v5/html_tune.rb b/lib/sisu/v5/html_tune.rb index e9392ca8..39cbb708 100644 --- a/lib/sisu/v5/html_tune.rb +++ b/lib/sisu/v5/html_tune.rb @@ -104,6 +104,16 @@ module SiSU_HTML_Tune def initialize(html='') @html=html end + def clean_for_html + html=@html + str=if html.is_a?(String) + html + else html.obj + end + str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;'). + gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;'). + gsub(/[<]/m,'<').gsub(/[>]/m,'>') + end def clean html=@html str=if html.is_a?(String) @@ -111,7 +121,8 @@ module SiSU_HTML_Tune else html.obj end str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;'). - gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;') + gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;'). + gsub(/[\\]{2}/m,'<br />') end end class Tune @@ -256,14 +267,14 @@ module SiSU_HTML_Tune def endnotes_html(dob) unless dob.is ==:code dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/, - ' <a name="-\2" href="#_\2"> <sup>\2</sup> </a> ' + #note- endnote- - '\1\2 <a name="_\2" href="#-\2"> <sup>\2.</sup></a> \3 \4'). #endnote- note- (careful may have switched) + %{ <a name="#{Mx[:note_ref]}\\2" href="##{Mx[:note]}\\2"> <sup>\\2</sup> </a> } + + %{\\1\\2 <a name="#{Mx[:note]}\\2" href="##{Mx[:note_ref]}\\2"> <sup>\\2.</sup></a> \\3 \\4}). gsub(/(#{Mx[:en_b_o]})([*+]\d+)\s+(.+?)(#{Mx[:en_b_c]})/, - ' <a name="-\2" href="#_\2"> <sup>\2</sup> </a> ' + #note- endnote- - '\1\2 <a name="_\2" href="#-\2"> <sup>\2.</sup></a> \3 \4'). #endnote- note- (careful may have switched) + %{ <a name="#{Mx[:note_ref]}\\2" href="##{Mx[:note]}\\2"> <sup>\\2</sup> </a> } + + %{\\1\\2 <a name="#{Mx[:note]}\\2" href="##{Mx[:note_ref]}\\2"> <sup>\\2.</sup></a> \\3 \\4}). gsub(/(#{Mx[:en_a_o]})([*+]+)\s+(.+?)(#{Mx[:en_a_c]})/, - ' <a name="-\2" href="#_\2"> <sup>\2</sup> </a> ' + #note- endnote- - '\1\2 <a name="_\2" href="#-\2"> <sup>\2</sup></a> \3 \4') #endnote- note- (careful may have switched) + %{ <a name="#{Mx[:note_ref]}\\2" href="##{Mx[:note]}\\2"> <sup>\\2</sup> </a> } + + %{\\1\\2 <a name="#{Mx[:note]}\\2" href="##{Mx[:note_ref]}\\2"> <sup>\\2</sup></a> \\3 \\4}) end dob end |