diff options
author | Ralph Amissah <ralph@amissah.com> | 2014-01-12 21:28:18 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2014-01-12 21:28:18 -0500 |
commit | 593766d8dff3c31e8bcf25f02a37606ac537aa21 (patch) | |
tree | 5895d21686a603c800820f6edfbab087026a80e2 | |
parent | v5: heading recalibration, code (downstream) changes, continue (diff) |
v5: asciidoc, file extension (for now .ad), inline footnotes, minorsisu_4.2.18
-rw-r--r-- | data/doc/sisu/CHANGELOG_v5 | 2 | ||||
-rw-r--r-- | lib/sisu/v5/constants.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v5/txt_asciidoc.rb | 41 |
3 files changed, 6 insertions, 39 deletions
diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index ef9070d6..782fae6a 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -43,6 +43,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.2.1.orig.tar.xz * texpdf, report on pdf output, provide a working link to a generated file-size (multiple document file-sizes may be produced) +* asciidoc, file extension (for now .ad), inline footnotes, minor + %% 5.2.0.orig.tar.xz (2014-01-06:01/1) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.2.0 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.2.0-1 diff --git a/lib/sisu/v5/constants.rb b/lib/sisu/v5/constants.rb index b89f9be8..04c0358a 100644 --- a/lib/sisu/v5/constants.rb +++ b/lib/sisu/v5/constants.rb @@ -66,7 +66,7 @@ YEAR='2014' Sfx={ txt: '.txt', txt_textile: '.textile', - txt_asciidoc: '.asciidoc.txt', + txt_asciidoc: '.ad', txt_markdown: '.md', txt_rst: '.rst', html: '.html', diff --git a/lib/sisu/v5/txt_asciidoc.rb b/lib/sisu/v5/txt_asciidoc.rb index 8bdca1a2..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| @@ -473,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]}/,'<'). @@ -521,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] |