aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-01-06 22:31:25 -0500
committerRalph Amissah <ralph@amissah.com>2014-01-06 22:31:28 -0500
commita90463bbbc266938a39ef9110db3e0edf56b5f94 (patch)
tree80115f18400af6c89b53f4851292a4fbe5cd5bf9 /lib
parentbin/sisu, version dir (fix) & version info (diff)
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
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v4/dal_doc_str.rb2
-rw-r--r--lib/sisu/v4/epub_format.rb2
-rw-r--r--lib/sisu/v4/epub_tune.rb2
-rw-r--r--lib/sisu/v4/html.rb6
-rw-r--r--lib/sisu/v4/sysenv.rb2
-rw-r--r--lib/sisu/v5/ao_doc_str.rb2
-rw-r--r--lib/sisu/v5/html.rb23
-rw-r--r--lib/sisu/v5/sysenv.rb2
-rw-r--r--lib/sisu/v5/xhtml_epub2_format.rb2
-rw-r--r--lib/sisu/v5/xhtml_epub2_tune.rb2
10 files changed, 23 insertions, 22 deletions
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(/&nbsp;/,' ') if Ep[:alt]==:on
x.gsub(/&/,'&amp;').
gsub(/</,"&lt;").gsub(/>/,"&gt;").
- 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(/</,'&#60;').gsub(/>/,'&#62;').
gsub(/\\\\/,'<br />').
gsub(/&lt;br(?: \/)?&gt;/,'<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]}/,'<tt>\1</tt>'). # 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'
%{<b><a href="#{link}#{@md.lang_code_insert}#{Sfx[:html]}">#{linkname}</a></b>}
@@ -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'
%{<b><a href="#{link}#{@md.lang_code_insert}#{Sfx[:html]}">#{linkname}</a></b>}
@@ -370,16 +370,13 @@ WOK
end
else
@@toc[:scr] << '<br />'
- link=(dob.ln) \
- ? dob.ln
- : ''
- %{<b><a href="##{link}">#{linkname}</a></b>}
+ %{<b><a href="##{dob.ocn}">#{linkname}</a></b>}
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] =~/<a href="#">/
+ format_toc.lev1.gsub(/<a href="#">|<\/a>/,'')
else format_toc.lev1
end
toc
@@ -401,7 +398,10 @@ WOK
title=%{#{p_num.goto}#{linkname}</a>}
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] =~/<a href="#">/
+ format_toc.lev2.gsub(/<a href="#">|<\/a>/,'')
+ else format_toc.lev2
+ end
end
toc
end
@@ -422,7 +422,10 @@ WOK
title=%{#{p_num.goto}#{linkname}</a>}
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] =~/<a href="#">/
+ format_toc.lev3.gsub(/<a href="#">|<\/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(/&nbsp;/,' ') if Ep[:alt]==:on
x.gsub(/&/,'&amp;').
gsub(/</,"&lt;").gsub(/>/,"&gt;").
- 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(/</,'&#60;').gsub(/>/,'&#62;').
gsub(/\\\\/,'<br />').
gsub(/&lt;br(?: \/)?&gt;/,'<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]}/,'<tt>\1</tt>'). # 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