aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v4
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v4')
-rw-r--r--lib/sisu/v4/constants.rb1
-rw-r--r--lib/sisu/v4/epub_format.rb25
-rw-r--r--lib/sisu/v4/epub_tune.rb9
-rw-r--r--lib/sisu/v4/html.rb12
-rw-r--r--lib/sisu/v4/html_format.rb8
-rw-r--r--lib/sisu/v4/html_tune.rb9
-rw-r--r--lib/sisu/v4/hub.rb2
-rw-r--r--lib/sisu/v4/manifest.rb14
-rw-r--r--lib/sisu/v4/urls.rb4
9 files changed, 45 insertions, 39 deletions
diff --git a/lib/sisu/v4/constants.rb b/lib/sisu/v4/constants.rb
index 7ad3516b..505fdc02 100644
--- a/lib/sisu/v4/constants.rb
+++ b/lib/sisu/v4/constants.rb
@@ -295,6 +295,7 @@ DEVELOPER={
__END__
puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:red).set
puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:green)
+puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:fuchsia)
puts ANSI_C[:red] + __LINE__.to_s + ANSI_C[:off] + ' ' + __FILE__
puts "#{ANSI_C[:red]} #{__LINE__.to_s} #{ANSI_C[:off]} #{__FILE__}"
puts ANSI_C[:fuchsia] + __LINE__.to_s + ANSI_C[:off] + ' ' + __FILE__.gsub(/([^\/]+$)/,"#{ANSI_C[:fuchsia]}\\1#{ANSI_C[:off]}")
diff --git a/lib/sisu/v4/epub_format.rb b/lib/sisu/v4/epub_format.rb
index 48408162..98f4d7e4 100644
--- a/lib/sisu/v4/epub_format.rb
+++ b/lib/sisu/v4/epub_format.rb
@@ -65,30 +65,27 @@ module SiSU_EPUB_Format
def initialize(md,ocn)
@md,@ocn=md,ocn.to_s
@ocn ||=''
- vz=SiSU_Viz::Defaults.new
end
def ocn_display
make=SiSU_Env::ProcessingSettings.new(@md)
if make.build.ocn?
ocn_class='ocn'
if @ocn.to_i==0
- @ocn.gsub(/^(\d+|)$/,
- %{<label class="#{ocn_class}">#{$ep[:hsp]}</label>})
+ @ocn.gsub(/^(\d+|)$/,'')
else
@ocn.gsub(/^(\d+|)$/,
%{<label class="#{ocn_class}"><a href="#o\\1" class="lnk#{ocn_class}">\\1</a></label>})
end
else
ocn_class='ocn_off'
- @ocn.gsub(/^(\d+|)$/,
- %{<label class="#{ocn_class}">#{$ep[:hsp]}</label>})
+ @ocn.gsub(/^(\d+|)$/,'')
end
end
def name
%{<a name="#{@ocn}"></a>}
end
def id #w3c? "tidy" complains about numbers as identifiers ! annoying
- %{id="o#{@ocn}"}
+ (@ocn.empty?) ? '' : %{id="o#{@ocn}"}
end
def goto
%{<a href="##{@ocn}">}
@@ -1226,7 +1223,8 @@ module SiSU_EPUB_Format
if x.is_a?(String)
x=x.gsub(/&nbsp;/,' ') if Ep[:alt]==:on
x.gsub(/&/,'&amp;').
- gsub(/</,'&lt;').gsub(/>/,'&gt;').
+ gsub(/</,"&lt;").gsub(/>/,"&gt;").
+ gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_o_xml]).
#gsub(/</,'&#60;').gsub(/>/,'&#62;').
gsub(/\\\\/,'<br />').
gsub(/&lt;br(?: \/)?&gt;/,'<br />')
@@ -1244,9 +1242,8 @@ module SiSU_EPUB_Format
@css=SiSU_Env::CSS_Stylesheet.new(md)
@seg_name_xhtml=(SiSU_EPUB::Source::Seg.new.seg_name_xhtml || [])
@seg_name_xhtml_tracker=(SiSU_EPUB::Source::Seg.new.seg_name_xhtml_tracker || [])
- @index='index'
- @metalink='#metadata'
@tocband_scroll,@tocband_segtoc=nil,nil
+ @index,@metalink='index','#metadata'
end
def doc_type_xhtml
<<-WOK
@@ -1573,17 +1570,21 @@ output_epub_cont_seg.close
rights=if defined? @md.rights.all \
and @md.rights.all =~/\S+/
rights=SanitizeXML.xml(@md.rights.all)
+ rights=rights.gsub(/<br\s*\/?>/,' ')
%{\n <dc:rights>#{rights}</dc:rights>}
else ''
end
f=SiSU_Env::FileOp.new(@md)
<<-WOK
- <#{$ep[:o]}metadata xmlns:dc="http://purl.org/dc/elements/1.1/"
+ <#{$ep[:o]}metadata
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:opf="http://www.idpf.org/2007/opf"
+ xmlns:dcterms="http://purl.org/dc/terms/"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
unique-identifier="urn:uuid:#{@md.dgst[1]}" version="2.0">
<dc:title>#{@md.title.full}</dc:title>
#{cover_image}#{author}#{editor}#{translator}#{illustrator}#{language}#{date_published}#{subject}#{rights}
- <dc:identifier opf:scheme="URI">#{f.output_path.epub.url}/#{f.base_filename.epub}</dc:identifier>
+ <dc:identifier opf:scheme="URI">#{f.output_path.epub.url.gsub(/http:\/\//,'')}/#{f.base_filename.epub}</dc:identifier>
<dc:identifier id="bookid">urn:uuid:#{@md.dgst[1]}</dc:identifier>
<!-- <dc:identifier id="EPB-UUID">urn:uuid:#{@md.dgst[1]}</dc:identifier> -->
</#{$ep[:o]}metadata>
@@ -1687,7 +1688,7 @@ output_epub_cont_seg.close
fn=fn_base + Sfx[:epub_xhtml]
name=hashtag ? fn + hashtag : fn
name=name ? name : dob.name
- guide_name=(name =~/#{Sfx[:epub_xhtml]}/) ? name : (name + Sfx[:epub_xhtml])
+ guide_name=(name =~/#{Sfx[:epub_xhtml]}/) ? name : (name + Sfx[:epub_xhtml])
<<-WOK
<reference type="text" href="#{guide_name}" />
WOK
diff --git a/lib/sisu/v4/epub_tune.rb b/lib/sisu/v4/epub_tune.rb
index bce4aed7..fbb42bc4 100644
--- a/lib/sisu/v4/epub_tune.rb
+++ b/lib/sisu/v4/epub_tune.rb
@@ -123,7 +123,7 @@ module SiSU_EPUB_Tune
begin
@cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX
SiSU_Screen::Ansi.new(@md.opt.cmd,'Tune').txt_grey if @md.opt.cmd =~/[MVv]/
- data=SiSU_EPUB_Tune::Tune.new(@data,@md).amp_html
+ data=SiSU_EPUB_Tune::Tune.new(@data,@md).amp_angle_brackets
data=SiSU_EPUB_Tune::Tune.new(data,@md).endnotes_html
data=SiSU_EPUB_Tune::Tune.new(data,@md).url_markup
data=SiSU_EPUB_Tune::Tune.new(data,@md).markup
@@ -156,6 +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(/#{Mx[:nbsp]}/,$ep[:hsp]).
gsub(/<(p|br)>/,'<\1 />')
dob.obj=SiSU_EPUB_Tune::CleanXHTML.new(dob.obj).clean
@@ -274,10 +275,12 @@ module SiSU_EPUB_Tune
@tuned_file << dob
end
end
- def amp_html
+ def amp_angle_brackets
data,data_new=@data,[]
data.each do |dob|
- dob.obj=dob.obj.gsub(/&/u,'&amp;')
+ dob.obj=dob.obj.
+ gsub(/&/u,'&amp;').
+ gsub(/</u,'&lt;').gsub(/>/u,'&gt;')
data_new << dob
end
data_new
diff --git a/lib/sisu/v4/html.rb b/lib/sisu/v4/html.rb
index 94b20afe..9b73823b 100644
--- a/lib/sisu/v4/html.rb
+++ b/lib/sisu/v4/html.rb
@@ -108,18 +108,18 @@ module SiSU_HTML
data=nil
tuned_file_array=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions
data=tuned_file_array
- if @opt.act[:html_scroll][:set]==:on
+ if @opt.act[:html_scroll][:set]==:on
scr_endnotes=SiSU_HTML::Source::Endnotes.new(data,@md).scroll
end
toc=SiSU_HTML::Source::Toc.new(@md,data).songsheet
links_guide=SiSU_HTML::Source::LinksGuide.new(data,@md).toc
data=tuned_file_array
scr_toc=SiSU_HTML::Source::ScrollHeadAndSegToc.new(@md,toc,links_guide).in_common #watch
- if @opt.act[:html_seg][:set]==:on
+ if @opt.act[:html_seg][:set]==:on
SiSU_HTML::Source::Seg.new(@md,data).songsheet
end
data=tuned_file_array
- if @opt.act[:html_scroll][:set]==:on
+ if @opt.act[:html_scroll][:set]==:on
scr=SiSU_HTML::Source::Scroll.new(@md,data,scr_endnotes).songsheet
scroll=SiSU_HTML::Source::ScrollOutput.new(scr_toc,scr[:body],scr[:metadata],scr[:owner_details],scr[:tails],@md).publish
SiSU_HTML::Source::Output.new(scroll,@md).scroll
@@ -602,7 +602,7 @@ WOK
ads=SiSU_HTML_Promo::Ad.new(@md)
@segtoc << format_head_toc.seg_navigation_tail << ads.div.close << ads.display << format_head_toc.html_close
@segtoc=@segtoc.flatten.compact #watch
- if @md.opt.act[:html_seg][:set]==:on
+ if @md.opt.act[:html_seg][:set]==:on
SiSU_HTML::Source::Output.new(@segtoc,@md).segtoc
end
@segtoc=[]
@@ -633,7 +633,7 @@ WOK
@o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure
end
def scroll
- if @md.opt.act[:html_scroll][:set]==:on
+ if @md.opt.act[:html_scroll][:set]==:on
begin
@filename_html_scroll=@file.write_file.html_scroll
@data.each do |para|
@@ -657,7 +657,7 @@ WOK
end
end
def segtoc
- if @md.opt.act[:html_seg][:set]==:on
+ if @md.opt.act[:html_seg][:set]==:on
begin
@filename_html_segtoc=@file.write_file.html_segtoc
@data.each do |para|
diff --git a/lib/sisu/v4/html_format.rb b/lib/sisu/v4/html_format.rb
index 7fcf89a0..25a8dbee 100644
--- a/lib/sisu/v4/html_format.rb
+++ b/lib/sisu/v4/html_format.rb
@@ -67,8 +67,8 @@ module SiSU_HTML_Format
@ocn ||=''
end
def ocn_display
- @make=SiSU_Env::ProcessingSettings.new(@md)
- if @make.build.ocn?
+ make=SiSU_Env::ProcessingSettings.new(@md)
+ if make.build.ocn?
ocn_class='ocn'
if @ocn.to_i==0
@ocn.gsub(/^(\d+|)$/,
@@ -104,11 +104,10 @@ module SiSU_HTML_Format
@vz=SiSU_Viz::Defaults.new
@seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || [])
@seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || [])
- @metalink='#metadata'
@tocband_scroll,@tocband_segtoc=nil,nil
@stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet
@o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure
- @index='index'
+ @index,@metalink='index','#metadata'
@toc="#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}"
end
def url_path_image_sys
@@ -1235,7 +1234,6 @@ WOK
def clean(txt)
txt=txt.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/,'').
gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'')
- txt
end
def subtoc_lev(tag,attrib)
@txt=clean(@txt)
diff --git a/lib/sisu/v4/html_tune.rb b/lib/sisu/v4/html_tune.rb
index 2661ee52..41845007 100644
--- a/lib/sisu/v4/html_tune.rb
+++ b/lib/sisu/v4/html_tune.rb
@@ -144,7 +144,7 @@ module SiSU_HTML_Tune
data_tuned=[]
#@tuned_file=[]
data.each do |dob|
- dob=angle_brackets(dob)
+ dob=amp_angle_brackets(dob)
dob=endnotes_html(dob)
dob=url_markup(dob)
dob=markup(dob)
@@ -241,8 +241,11 @@ module SiSU_HTML_Tune
end
dob
end
- def angle_brackets(dob)
- dob.obj=dob.obj.gsub(/<([a-z:\/]+)>/,"#{Dx[:lt_xml]}\\1#{Dx[:gt_xml]}")
+ def amp_angle_brackets(dob)
+ dob.obj=dob.obj.
+ gsub(/&/u,'&amp;').
+ gsub(/<([a-z:\/]+)>/,"#{Dx[:lt_xml]}\\1#{Dx[:gt_xml]}").
+ gsub(/</u,'&lt;').gsub(/>/u,'&gt;')
dob
end
def endnotes_html(dob)
diff --git a/lib/sisu/v4/hub.rb b/lib/sisu/v4/hub.rb
index d55a5f17..e02fa940 100644
--- a/lib/sisu/v4/hub.rb
+++ b/lib/sisu/v4/hub.rb
@@ -673,7 +673,7 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on
or @opt.act[:scp][:set]==:on \
or @opt.act[:webrick][:set]==:on \
or @opt.act[:zap][:set]==:on \
- or (
+ or (
@opt.cmd =~/^-/ \
and @opt.cmd =~/([abCcDdeFGgHhIjikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \
and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \
diff --git a/lib/sisu/v4/manifest.rb b/lib/sisu/v4/manifest.rb
index c5a841a1..d7c4d33a 100644
--- a/lib/sisu/v4/manifest.rb
+++ b/lib/sisu/v4/manifest.rb
@@ -511,14 +511,14 @@ WOK
end
end
def metadata_tests
- if defined? @md.title #%
+ if defined? @md.title #%
if defined? @md.title.full \
and @md.title.full=~/\S+/
id,info=@translate.full_title,@md.title.full
metadata(id,info)
end
end
- if defined? @md.creator #%
+ if defined? @md.creator #%
if defined? @md.creator.author \
and @md.creator.author=~/\S+/
id,info=@translate.author,@md.creator.author
@@ -562,7 +562,7 @@ WOK
metadata(id,info)
end
end
- if defined? @md.date #%
+ if defined? @md.date #%
if defined? @md.date.published \
and @md.date.published=~/\S+/ #dc
id,info=@translate.date,@md.date.published
@@ -599,7 +599,7 @@ WOK
id,info=@translate.publisher,@md.publisher
metadata(id,info)
end
- if defined? @md.notes #%
+ if defined? @md.notes #%
if defined? @md.notes.description \
and @md.notes.description=~/\S+/
id,info=@translate.description,@md.notes.description
@@ -626,7 +626,7 @@ WOK
metadata(id,info)
end
end
- if defined? @md.title #%
+ if defined? @md.title #%
if defined? @md.title.language \
and @md.title.language=~/\S+/
id,info=@translate.language,@md.title.language
@@ -638,7 +638,7 @@ WOK
metadata(id,info)
end
end
- if defined? @md.classify #%
+ if defined? @md.classify #%
if defined? @md.topic_register_array \
and @md.topic_register_array.length > 0
@manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{@translate.topic_register}:</p></th><td>\n}
@@ -701,7 +701,7 @@ WOK
metadata(id,info)
end
end
- if defined? @md.identifier #%
+ if defined? @md.identifier #%
if defined? @md.identifier.oclc \
and @md.identifier.oclc=~/\S+/
id,info=@translate.cls_oclc,@md.identifier.oclc
diff --git a/lib/sisu/v4/urls.rb b/lib/sisu/v4/urls.rb
index ad7ab480..e5341581 100644
--- a/lib/sisu/v4/urls.rb
+++ b/lib/sisu/v4/urls.rb
@@ -324,11 +324,11 @@ module SiSU_Urls
or @opt.act[:html_scroll][:set]==:on \
or @opt.act[:html_seg][:set]==:on)
if x =~/scroll/
- if @opt.act[:html_scroll][:set]==:on
+ if @opt.act[:html_scroll][:set]==:on
show.html.scroll(x)
end
else
- if @opt.act[:html_seg][:set]==:on
+ if @opt.act[:html_seg][:set]==:on
show.html.toc(x)
end
end