From a90463bbbc266938a39ef9110db3e0edf56b5f94 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 6 Jan 2014 22:31:25 -0500 Subject: v4 v5: fixes * ao_doc_str, nodes, possible parents, correction * epub, url closure decoration * sysenv, qrcode report absent program, minor * html scroll toc, clean links where none, exclude metadata --- lib/sisu/v4/dal_doc_str.rb | 2 +- lib/sisu/v4/epub_format.rb | 2 +- lib/sisu/v4/epub_tune.rb | 2 +- lib/sisu/v4/html.rb | 6 ++---- lib/sisu/v4/sysenv.rb | 2 +- lib/sisu/v5/ao_doc_str.rb | 2 +- lib/sisu/v5/html.rb | 23 +++++++++++++---------- lib/sisu/v5/sysenv.rb | 2 +- lib/sisu/v5/xhtml_epub2_format.rb | 2 +- lib/sisu/v5/xhtml_epub2_tune.rb | 2 +- 10 files changed, 23 insertions(+), 22 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v4/dal_doc_str.rb b/lib/sisu/v4/dal_doc_str.rb index f9dd4954..96e1ac5d 100644 --- a/lib/sisu/v4/dal_doc_str.rb +++ b/lib/sisu/v4/dal_doc_str.rb @@ -813,7 +813,7 @@ module SiSU_DAL_DocumentStructureExtract when /2/ '1' when /3/ - '3' + '2' end end def possible_children(parent) diff --git a/lib/sisu/v4/epub_format.rb b/lib/sisu/v4/epub_format.rb index 9873c96f..4a060806 100644 --- a/lib/sisu/v4/epub_format.rb +++ b/lib/sisu/v4/epub_format.rb @@ -1225,7 +1225,7 @@ module SiSU_EPUB_Format x=x.gsub(/ /,' ') if Ep[:alt]==:on x.gsub(/&/,'&'). gsub(//,">"). - gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_o_xml]). + gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_c_xml]). #gsub(//,'>'). gsub(/\\\\/,'
'). gsub(/<br(?: \/)?>/,'
') diff --git a/lib/sisu/v4/epub_tune.rb b/lib/sisu/v4/epub_tune.rb index 45291ca8..dd9f478d 100644 --- a/lib/sisu/v4/epub_tune.rb +++ b/lib/sisu/v4/epub_tune.rb @@ -156,7 +156,7 @@ module SiSU_EPUB_Tune gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1'). # tt, kbd gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). gsub(/#{Mx[:gl_bullet]}/m,"●#{$ep[:hsp]*2}"). - gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_o_xml]). + gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_c_xml]). gsub(/#{Mx[:nbsp]}/,$ep[:hsp]). gsub(/<(p|br)>/,'<\1 />') dob.obj=SiSU_EPUB_Tune::CleanXHTML.new(dob.obj).clean diff --git a/lib/sisu/v4/html.rb b/lib/sisu/v4/html.rb index 1dda9aae..7acb279a 100644 --- a/lib/sisu/v4/html.rb +++ b/lib/sisu/v4/html.rb @@ -329,7 +329,7 @@ WOK and link !~/#/ #% keep eye on link SiSU_HTML_Format::ParagraphNumber.new(@md,link) end - title=if dob.obj !~/Metadata/ then linkname + title=if dob.obj !~/^Metadata$/; linkname else link='metadata' %{#{linkname}} @@ -364,9 +364,7 @@ WOK end txt_obj={ txt: title } format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) - toc[:scr]=if dob.name =~/^meta/ \ - and dob.obj =~/Document Information/ - format_toc.lev0 + toc[:scr]=if dob.obj =~/^Metadata$/; '' else format_toc.lev1 end toc diff --git a/lib/sisu/v4/sysenv.rb b/lib/sisu/v4/sysenv.rb index e58f3fc4..b216089d 100644 --- a/lib/sisu/v4/sysenv.rb +++ b/lib/sisu/v4/sysenv.rb @@ -797,7 +797,7 @@ module SiSU_Env ? (system(%{ echo "#{@input}" | #{program} -s 3 -o #{@output} })) - : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if cmd =~/V/) + : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if @cmd =~/V/) #found end def imagemagick #imagemagick is a image manipulation program diff --git a/lib/sisu/v5/ao_doc_str.rb b/lib/sisu/v5/ao_doc_str.rb index 94be6528..40be4e30 100644 --- a/lib/sisu/v5/ao_doc_str.rb +++ b/lib/sisu/v5/ao_doc_str.rb @@ -814,7 +814,7 @@ module SiSU_AO_DocumentStructureExtract when /2/ '1' when /3/ - '3' + '2' end end def possible_children(parent) diff --git a/lib/sisu/v5/html.rb b/lib/sisu/v5/html.rb index 955b57f1..fda8e8ab 100644 --- a/lib/sisu/v5/html.rb +++ b/lib/sisu/v5/html.rb @@ -342,7 +342,7 @@ WOK and link !~/#/ #% keep eye on link SiSU_HTML_Format::ParagraphNumber.new(@md,link) end - title=if dob.obj !~/Metadata/ then linkname + title=if dob.obj !~/^Metadata$/ then linkname else link='metadata' %{#{linkname}} @@ -370,16 +370,13 @@ WOK end else @@toc[:scr] << '
' - link=(dob.ln) \ - ? dob.ln - : '' - %{#{linkname}} + %{#{linkname}} end txt_obj={ txt: title } format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) - toc[:scr]=if dob.name =~/^meta/ \ - and dob.obj =~/Document Information/ - format_toc.lev0 + toc[:scr]=if dob.obj =~/^Metadata$/ then '' + elsif txt_obj[:txt] =~// + format_toc.lev1.gsub(/|<\/a>/,'') else format_toc.lev1 end toc @@ -401,7 +398,10 @@ WOK title=%{#{p_num.goto}#{linkname}} txt_obj={ txt: title } format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) - toc[:scr]=format_toc.lev2 + toc[:scr]=if txt_obj[:txt] =~// + format_toc.lev2.gsub(/|<\/a>/,'') + else format_toc.lev2 + end end toc end @@ -422,7 +422,10 @@ WOK title=%{#{p_num.goto}#{linkname}} txt_obj={ txt: title } format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) - toc[:scr]=format_toc.lev3 + toc[:scr]=if txt_obj[:txt] =~// + format_toc.lev3.gsub(/|<\/a>/,'') + else format_toc.lev3 + end end toc end diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index 1d0920f5..d6a46bc4 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -798,7 +798,7 @@ module SiSU_Env ? (system(%{ echo "#{@input}" | #{program} -s 3 -o #{@output} })) - : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if cmd =~/V/) + : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if @cmd =~/V/) #found end def imagemagick #imagemagick is a image manipulation program diff --git a/lib/sisu/v5/xhtml_epub2_format.rb b/lib/sisu/v5/xhtml_epub2_format.rb index f4943d6d..b7b5f9a0 100644 --- a/lib/sisu/v5/xhtml_epub2_format.rb +++ b/lib/sisu/v5/xhtml_epub2_format.rb @@ -1226,7 +1226,7 @@ module SiSU_XHTML_EPUB2_Format x=x.gsub(/ /,' ') if Ep[:alt]==:on x.gsub(/&/,'&'). gsub(//,">"). - gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_o_xml]). + gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_c_xml]). #gsub(//,'>'). gsub(/\\\\/,'
'). gsub(/<br(?: \/)?>/,'
') diff --git a/lib/sisu/v5/xhtml_epub2_tune.rb b/lib/sisu/v5/xhtml_epub2_tune.rb index c4cb9c36..6ac53c39 100644 --- a/lib/sisu/v5/xhtml_epub2_tune.rb +++ b/lib/sisu/v5/xhtml_epub2_tune.rb @@ -161,7 +161,7 @@ module SiSU_XHTML_EPUB2_Tune gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1'). # tt, kbd gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). gsub(/#{Mx[:gl_bullet]}/m,"●#{$ep[:hsp]*2}"). - gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_o_xml]). + gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_c_xml]). gsub(/#{Mx[:nbsp]}/,$ep[:hsp]). gsub(/<(p|br)>/,'<\1 />') dob.obj=SiSU_XHTML_EPUB2_Tune::CleanXHTML.new(dob.obj).clean -- cgit v1.2.3