aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-06-19 21:13:06 -0400
committerRalph Amissah <ralph@amissah.com>2014-06-19 21:13:06 -0400
commite0c38cb8d044e0b3dc449e10d1aa14ef3b6900ad (patch)
tree9ad8da13c9c4ac1d66a97438238e425784afd640
parentv6: docbook, tags (name touch) (diff)
v6: docbook, ocn & footnote numbers (as xml comments)
-rw-r--r--data/doc/sisu/CHANGELOG_v63
-rw-r--r--lib/sisu/v6/txt_shared.rb9
-rw-r--r--lib/sisu/v6/xml_docbook5.rb4
-rw-r--r--lib/sisu/v6/xml_shared.rb3
4 files changed, 13 insertions, 6 deletions
diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6
index 96ed1f24..820995f8 100644
--- a/data/doc/sisu/CHANGELOG_v6
+++ b/data/doc/sisu/CHANGELOG_v6
@@ -39,6 +39,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.0.8.orig.tar.xz
* code blocks, clean trailing newlines
* misc, minorish
+* docbook,
+ * ocn & footnote numbers (as xml comments)
+
%% 6.0.7.orig.tar.xz (2014-05-25:20/7)
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_6.0.7
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_6.0.7-1
diff --git a/lib/sisu/v6/txt_shared.rb b/lib/sisu/v6/txt_shared.rb
index 8d2a09b7..3159844f 100644
--- a/lib/sisu/v6/txt_shared.rb
+++ b/lib/sisu/v6/txt_shared.rb
@@ -62,8 +62,8 @@
=end
module SiSU_TextUtils
class Wrap
- def initialize(para='',n_char_max=76,n_indent=0,n_hang=nil)
- @para,@n_char_max,@n_indent=para,n_char_max,n_indent
+ def initialize(para='',n_char_max=76,n_indent=0,n_hang=nil,post='')
+ @para,@n_char_max,@n_indent,@post,=para,n_char_max,n_indent,post
@n_char_max_extend = n_char_max
@n_hang=n_hang ? n_hang : @n_indent
end
@@ -110,7 +110,10 @@ module SiSU_TextUtils
end
@oldword=word if word =~/\S+/
end
- spaces_hang + out.join(spaces_indent)
+ post=(@post.empty?) \
+ ? ''
+ : "\n" + (' '*@n_indent) +@post
+ spaces_hang + out.join(spaces_indent) + post
end
def line_wrap_indent1
@n_indent,@n_hang=2,2
diff --git a/lib/sisu/v6/xml_docbook5.rb b/lib/sisu/v6/xml_docbook5.rb
index a835288a..3f5333b2 100644
--- a/lib/sisu/v6/xml_docbook5.rb
+++ b/lib/sisu/v6/xml_docbook5.rb
@@ -200,7 +200,7 @@ module SiSU_XML_Docbook_Book
data.each_with_index do |o,i|
if (defined? o.ocn and not o.ocn.nil?)
ocn=(@make.build.ocn?) \
- ? "\n#{Dx[:ocn_o]}#{o.ocn}#{Dx[:ocn_c]}"
+ ? "<!-- o#{o.ocn} -->"
: ''
id=%{ id="o#{o.ocn}" }
else
@@ -221,7 +221,7 @@ module SiSU_XML_Docbook_Book
#{spaces*o.lc}<title#{id}>
}
end
- filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj + ocn,80,(@splv*2+2)).line_wrap
+ filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj,80,(@splv*2+2),nil,ocn).line_wrap
filename_docbook.puts %{#{spaces*o.lc}</title>}
h=o.lc
elsif (o.of ==:para or o.of ==:block)
diff --git a/lib/sisu/v6/xml_shared.rb b/lib/sisu/v6/xml_shared.rb
index 033659f0..aeb73f22 100644
--- a/lib/sisu/v6/xml_shared.rb
+++ b/lib/sisu/v6/xml_shared.rb
@@ -460,7 +460,8 @@ module SiSU_XML_Munge
clean(str)
end
def markup_docbook(dob='') # work on, initially a copy of fictionbook!
- dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m,'<footnote>\1</footnote>').
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(\d+)\s*(.+?)#{Mx[:en_a_c]}/m,'<footnote><para><!-- fn\1 -->\2</para></footnote>').
+ gsub(/\\\\/,'</para><para>').
gsub(/&/,'&amp;'). #sort
gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; '). #sort