diff options
author | Ralph Amissah <ralph@amissah.com> | 2014-01-12 21:30:22 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2014-01-12 21:30:22 -0500 |
commit | 3ca7ba8c0fdfd9ad9681012f1816b8ec534e8083 (patch) | |
tree | f1efb49ba113fea43cd39b71698b66f43cdb0531 /lib/sisu/v5/txt_asciidoc.rb | |
parent | debian/changelog (4.2.17-1) (diff) | |
parent | v5: asciidoc, file extension (for now .ad), inline footnotes, minor (diff) |
Merge tag 'sisu_4.2.18' into debian/sid
SiSU 4.2.18
Diffstat (limited to 'lib/sisu/v5/txt_asciidoc.rb')
-rw-r--r-- | lib/sisu/v5/txt_asciidoc.rb | 45 |
1 files changed, 6 insertions, 39 deletions
diff --git a/lib/sisu/v5/txt_asciidoc.rb b/lib/sisu/v5/txt_asciidoc.rb index 07b8832f..98df1cfc 100644 --- a/lib/sisu/v5/txt_asciidoc.rb +++ b/lib/sisu/v5/txt_asciidoc.rb @@ -141,42 +141,6 @@ module SiSU_Txt_AsciiDoc "\n" end # Used for extraction of endnotes from paragraphs - def extract_endnotes(dob='') - notes=dob.obj.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/) - @n=[] - notes.flatten.each do |n| #high cost to deal with <br> appropriately within plaintext, consider - n=n.dup.to_s - if n =~/#{Mx[:br_line]}|#{Mx[:br_nl]}/ - fix = n.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/) #watch #added - fix.each do |x| - unless x.empty?; @n << x - end - end - else @n << n - end - end - notes=@n.flatten - notes.each do |e| - util=(e.to_s =~/^\[[\d*+]+\]:/) \ - ? (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,4,1)) - : (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,1,1)) - wrap=util.line_wrap - wrap=if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m - wrap.gsub(/^(\s*)([\d*+]+)\s+(.+?)\s*\Z/m, <<-GSUB -\\1[\\2]: \\3 - GSUB - ) - else - wrap.gsub(/^(.+)\Z/m, <<-GSUB -\\1 - GSUB - ) - end - @@endnotes[:para] << "-#{wrap}" - @@endnotes[:end] << '' << wrap - end - @@endnotes - end def plaintext_metadata array=SiSU_Metadata::Summary.new(@md).plaintext.metadata array.each do |meta| @@ -258,7 +222,7 @@ WOK '+' end def l5 - '' #'.' #proposed + '.' #'.' #proposed end self end @@ -368,6 +332,7 @@ WOK def heading_decorated_inline(dob) if dob.is==:heading heading_inline = case dob.lc + when 0 then decorate.heading.inline.l0 when 1 then decorate.heading.inline.l1 when 2 then decorate.heading.inline.l2 when 3 then decorate.heading.inline.l3 @@ -382,6 +347,7 @@ WOK if dob.is==:heading #times=@wrap_width if times > @wrap_width case dob.lc + when 0 then decorate.heading.underscore.l0*times + p_num << break_line*2 when 1 then decorate.heading.underscore.l1*times + p_num << break_line*2 when 2 then decorate.heading.underscore.l2*times + p_num << break_line*2 when 3 then decorate.heading.underscore.l3*times + p_num << break_line*2 @@ -471,7 +437,8 @@ WOK gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]'). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}") - extract_endnotes(dob) + dob.obj=dob.obj.gsub(/\s*#{Mx[:en_a_o]}([\d*+]+)\s+(.+?)#{Mx[:en_a_c]}/,' footnote:[note\1,\2]'). + gsub(/\s*#{Mx[:en_b_o]}([\d*+]+\s+.+?)#{Mx[:en_b_c]}/,' footnote:[\1]') dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]'). # endnote marker marked up gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]'). # endnote marker marked up gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<'). @@ -519,7 +486,7 @@ WOK @plaintext[:body] << dob.obj + p_num << break_line elsif dob.is==:break sp=' ' - ln='-' + ln='<' #ln='-' @plaintext[:body] <<=if dob.obj==Mx[:br_page] \ or dob.obj==Mx[:br_page_new] \ or dob.obj==Mx[:br_page_line] |