aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v4
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v4')
-rw-r--r--lib/sisu/v4/constants.rb14
-rw-r--r--lib/sisu/v4/dal_doc_objects.rb13
-rw-r--r--lib/sisu/v4/dal_doc_str.rb12
-rw-r--r--lib/sisu/v4/dal_idx.rb11
-rw-r--r--lib/sisu/v4/epub.rb32
-rw-r--r--lib/sisu/v4/epub_concordance.rb10
-rw-r--r--lib/sisu/v4/epub_format.rb137
-rw-r--r--lib/sisu/v4/epub_segments.rb6
-rw-r--r--lib/sisu/v4/epub_tune.rb10
-rw-r--r--lib/sisu/v4/html_scroll.rb6
-rw-r--r--lib/sisu/v4/html_segments.rb4
-rw-r--r--lib/sisu/v4/param_make.rb2
12 files changed, 134 insertions, 123 deletions
diff --git a/lib/sisu/v4/constants.rb b/lib/sisu/v4/constants.rb
index 08279630..65b17796 100644
--- a/lib/sisu/v4/constants.rb
+++ b/lib/sisu/v4/constants.rb
@@ -198,10 +198,24 @@ Px={
}
Px[:lng_lst_rgx]=Px[:lng_lst].join('|')
Ep={
+ alt: :on,
d_oebps: 'OEBPS',
+ d_image: 'OEBPS/image',
+ d_css: 'OEBPS/css',
f_ncx: 'toc.ncx',
f_opf: 'content.opf',
}
+$ep=if Ep[:alt]==:on
+ {
+ o: 'opf:',
+ hsp: ' ',
+ }
+else
+ {
+ o: '',
+ hsp: ' ',
+ }
+end
Db={
name_prefix: "SiSU#{SiSU_version_dir}a_",
name_prefix_db: "sisu_#{SiSU_version_dir}a_",
diff --git a/lib/sisu/v4/dal_doc_objects.rb b/lib/sisu/v4/dal_doc_objects.rb
index 37dfdcd3..13fd8ddb 100644
--- a/lib/sisu/v4/dal_doc_objects.rb
+++ b/lib/sisu/v4/dal_doc_objects.rb
@@ -420,17 +420,18 @@ module SiSU_DAL_DocumentStructure
end
end
class ObjectLayout
- attr_accessor :obj,:is,:of,:tmp
+ attr_accessor :obj,:is,:of,:from,:tmp
def initialize
@of=:layout
- @is=@obj=@tmp=nil
+ @is=@obj=@from=@tmp=nil
end
- def break(h,o=nil) #decide how to deal with, perhaps no obj?
+ def break(h,f=nil) #decide how to deal with
of= @of #String, classification - group
is= :break #String, classification - specific type
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@obj,@tmp=of,is,obj,tmp
+ obj= h[:obj] #String, text content
+ from= f
+ tmp= h[:tmp] #available for processing, empty after use
+ @of,@is,@obj,@from,@tmp=of,is,obj,from,tmp
self
end
def insert(h,o=nil) #decide how to deal with, could mimic paragraph?
diff --git a/lib/sisu/v4/dal_doc_str.rb b/lib/sisu/v4/dal_doc_str.rb
index 40fad15e..a04ad3ad 100644
--- a/lib/sisu/v4/dal_doc_str.rb
+++ b/lib/sisu/v4/dal_doc_str.rb
@@ -236,9 +236,9 @@ module SiSU_DAL_DocumentStructureExtract
when /^<(?:br)?:(?:pa?r|o(?:bj|---)?)>\s*$/ #[br:par] #[br:obj]
SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_obj])
when /^(?:-\\\\-|<:pb>)\s*$/ #[br:pg]
- SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page])
+ SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page],:markup)
when /^(?:=\\\\=|<:pn>)\s*$/ #[br:pgn]
- SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new])
+ SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new],:markup)
else #paragraph
image=image_test(t_o)
note=endnote_test?(t_o)
@@ -740,19 +740,19 @@ module SiSU_DAL_DocumentStructureExtract
elsif dob.obj=~/#{Mx[:pa_non_object_no_heading]}/
dob.obj=dob.obj.gsub(/#{Mx[:pa_non_object_no_heading]}/,'')
if dob.is==:para
- h={ obj: dob.obj, ocn_: false, ocn: nil }
+ h={ obj: dob.obj, ocn_: false, ocn: nil, hang: dob.hang, indent: dob.indent, bullet_: dob.bullet_, tags: dob.tags, parent: dob.parent }
dob=SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h,dob)
elsif dob.is==:heading
- h={ obj: dob.obj, ocn_: false, ocn: nil, toc_: true }
+ h={ obj: dob.obj, ocn_: false, ocn: nil, toc_: true, parent: dob.parent }
dob=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,dob)
end
elsif dob.obj=~/#{Mx[:pa_non_object_dummy_heading]}/
dob.obj=dob.obj.gsub(/#{Mx[:pa_non_object_dummy_heading]}/,'')
if dob.is==:para
- h={ obj: dob.obj, ocn_: false, ocn: nil }
+ h={ obj: dob.obj, ocn_: false, ocn: nil, hang: dob.hang, indent: dob.indent, bullet_: dob.bullet_, tags: dob.tags, parent: dob.parent }
dob=SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h,dob)
elsif dob.is==:heading
- h={ obj: dob.obj, ocn_: false, ocn: nil, toc_: false }
+ h={ obj: dob.obj, ocn_: false, ocn: nil, toc_: false, parent: dob.parent }
dob=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,dob)
end
else dob
diff --git a/lib/sisu/v4/dal_idx.rb b/lib/sisu/v4/dal_idx.rb
index 63eb487e..a1d66402 100644
--- a/lib/sisu/v4/dal_idx.rb
+++ b/lib/sisu/v4/dal_idx.rb
@@ -161,12 +161,7 @@ module SiSU_DAL_BookIndex
the_idx
end
def clean_xml(str)
- str=str.gsub(/&/,'&#038;').
- gsub(/\(/,'&#040;').
- gsub(/\)/,'&#041;').
- gsub(/\*/,'&#042;').
- gsub(/\+/,'&#043;').
- gsub(/,/,'&#044;')
+ str=str.gsub(/&/,'&amp;')
str
end
def index(the_idx)
@@ -193,8 +188,8 @@ module SiSU_DAL_BookIndex
idx[:html] << ''
idx[:xhtml] << ''
else
- idx[:html] << %{<a href="##{x}">#{x}</a>,&nbsp;}
- idx[:xhtml] << %{<a href="##{x.downcase}">#{x}</a>,&nbsp;}
+ idx[:html] << %{<a href="##{x}">#{x}</a>,#{$ep[:hsp]}}
+ idx[:xhtml] << %{<a href="##{x.downcase}">#{x}</a>,#{$ep[:hsp]}}
end
end
idx[:html] << '</p>'
diff --git a/lib/sisu/v4/epub.rb b/lib/sisu/v4/epub.rb
index 195f719e..a3b9211e 100644
--- a/lib/sisu/v4/epub.rb
+++ b/lib/sisu/v4/epub.rb
@@ -549,7 +549,7 @@ module SiSU_EPUB
segtoc << format_txt_obj.center_bold
if defined? @md.creator.author \
and @md.creator.author
- creator_endnote=@md.creator.author.gsub(/(\*+)/,%{&nbsp;<sup><a href="#notes">\\1</a></sup>})
+ creator_endnote=@md.creator.author.gsub(/(\*+)/,%{#{$ep[:hsp]}<sup><a href="#notes">\\1</a></sup>})
tmp_head=creator_endnote + "\n"
txt_obj={ txt: tmp_head }
format_txt_obj=SiSU_EPUB_Format::FormatTextObject.new(@md,txt_obj)
@@ -708,21 +708,21 @@ module SiSU_EPUB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <title>Cover</title>
- <meta http-equiv="Content-Type" content='text/html; charset=utf-8' />
- <link rel="stylesheet" href="css/xhtml.css" type="text/css" />
- <style type="text/css"> img { max-width: 100%; } </style>
-</head>
-<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
- <div class="svg_outer">
- <div class="svg_inner">
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 #{@md.make.cover_image[:w]} #{@md.make.cover_image[:h]}" preserveAspectRatio="xMidYMid meet">
- <image width="#{@md.make.cover_image[:w]}" height="#{@md.make.cover_image[:h]}" xlink:href="image/#{@md.make.cover_image[:cover]}" />
- </svg>
- </div>
- </div>
-</body>
+ <head>
+ <title>Cover</title>
+ <meta http-equiv="Content-Type" content='text/html; charset=utf-8' />
+ <link rel="stylesheet" href="css/xhtml.css" type="text/css" />
+ <style type="text/css"> img { max-width: 100%; } </style>
+ </head>
+ <body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
+ <div class="svg_outer">
+ <div class="svg_inner">
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 #{@md.make.cover_image[:w]} #{@md.make.cover_image[:h]}" preserveAspectRatio="xMidYMid meet">
+ <image width="#{@md.make.cover_image[:w]}" height="#{@md.make.cover_image[:h]}" xlink:href="image/#{@md.make.cover_image[:cover]}" />
+ </svg>
+ </div>
+ </div>
+ </body>
</html>
WOK
filename_xhtml.puts cover_image,"\n"
diff --git a/lib/sisu/v4/epub_concordance.rb b/lib/sisu/v4/epub_concordance.rb
index 93774d30..60242567 100644
--- a/lib/sisu/v4/epub_concordance.rb
+++ b/lib/sisu/v4/epub_concordance.rb
@@ -102,9 +102,9 @@ module SiSU_EPUB_Concordance
@vz=SiSU_Viz::Defaults.new
txt_path=%{#{@md.dir_out}}
@fnb=@md.fnb
- @lex_button=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="../_sisu/image/sisu.png" alt="SiSU home --&gt;"></a>}
+ @lex_button=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="../_sisu/image/sisu.png" alt="SiSU home"></a>}
@doc_details =<<WOK
-<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right">&nbsp;</td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.file.base_filename.epub}"><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.creator.author}</p></td></tr></table>
+<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right">#{$ep[:hsp]}</td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.file.base_filename.epub}"><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.creator.author}</p></td></tr></table>
WOK
end
def create
@@ -122,7 +122,7 @@ WOK
[if number of occurences exceed number of references - word occurs more than once in at least one reference. Footnote/endnotes are either assigned to the paragraph from which they are referenced or ignored, so it is relevant to check the footnotes referenced from within a paragraph as well.]
</p>
<p>
- (After the page is fully loaded) you can jump directly to a word by appending a hash (#) and the word to the url for this text, (do not forget that words are case sensitive, and may be listed twice (starting with and without an upper case letter)), #your_word # [&nbsp;http://[web host]/#{@fnb}/concordance.html#your_word&nbsp;]
+ (After the page is fully loaded) you can jump directly to a word by appending a hash (#) and the word to the url for this text, (do not forget that words are case sensitive, and may be listed twice (starting with and without an upper case letter)), #your_word # [#{$ep[:hsp]}http://[web host]/#{@fnb}/concordance.html#your_word#{$ep[:hsp]}]
</p>
WOK
end
@@ -284,12 +284,12 @@ WOK
end
end
end
- scr='<font size="1" color="#777777" face=times new roman><img border="0" height="15" width="15" src="../_sisu/image/b_doc.png" alt="Full Text">&nbsp;scroll:&nbsp;</font><font size="1" color="#222222" face=times new roman>doc#&nbsp;</font> '
+ scr=%{<font size="1" color="#777777" face=times new roman><img border="0" height="15" width="15" src="../_sisu/image/b_doc.png" alt="Full Text">#{$ep[:hsp]}scroll:#{$ep[:hsp]}</font><font size="1" color="#222222" face=times new roman>doc##{$ep[:hsp]}</font> }
seg=''
@file_concordance << SiSU_EPUB_Concordance::Source::DocTitle.new(@particulars).create
alph=%W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
@file_concordance << '<p>'
- alph.each {|x| @file_concordance << %{<a href="##{x}">#{x}</a>,&nbsp;}}
+ alph.each {|x| @file_concordance << %{<a href="##{x}">#{x}</a>,#{$ep[:hsp]}}}
@file_concordance << '</p>'
letter=alph.shift
@file_concordance << %{\n<p class="letter"><a name="A">A</a></p>}
diff --git a/lib/sisu/v4/epub_format.rb b/lib/sisu/v4/epub_format.rb
index dd3273d0..d8baae63 100644
--- a/lib/sisu/v4/epub_format.rb
+++ b/lib/sisu/v4/epub_format.rb
@@ -69,7 +69,7 @@ module SiSU_EPUB_Format
ocn_class='ocn'
if @ocn.to_i==0
@ocn.gsub(/^(\d+|)$/,
- %{<label class="#{ocn_class}">&nbsp;</label>})
+ %{<label class="#{ocn_class}">#{$ep[:hsp]}</label>})
else
@ocn.gsub(/^(\d+|)$/,
%{<label class="#{ocn_class}"><a href="#o\\1" class="lnk#{ocn_class}">\\1</a></label>})
@@ -77,7 +77,7 @@ module SiSU_EPUB_Format
else
ocn_class='ocn_off'
@ocn.gsub(/^(\d+|)$/,
- %{<label class="#{ocn_class}">&nbsp;</label>})
+ %{<label class="#{ocn_class}">#{$ep[:hsp]}</label>})
end
end
def name
@@ -1220,6 +1220,7 @@ module SiSU_EPUB_Format
module SanitizeXML
def self.xml(x)
if x.is_a?(String)
+ x=x.gsub(/&nbsp;/,' ') if Ep[:alt]==:on
x.gsub(/&/,'&amp;').
gsub(/</,'&lt;').gsub(/>/,'&gt;').
#gsub(/</,'&#60;').gsub(/>/,'&#62;').
@@ -1246,8 +1247,6 @@ module SiSU_EPUB_Format
def doc_type_xhtml
<<-WOK
<?xml version='1.0' encoding='utf-8'?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
- "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
WOK
end
@@ -1305,25 +1304,25 @@ application/epub+zip
segfilename=dir_epub_cont + '/' + name
output_epub_cont_seg=File.new(segfilename,'w')
output_epub_cont_seg << %{#{doc_type}
-<head>
- <title>
- #{dob.obj} -
- #{@md.html_title}
- </title>
-<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
-#{@css.xhtml_epub}
-</head>
-#{@vz.color_body}
-<div class="content">
- <div class="substance">
- <label class="ocn"><a href="#o#{dob.ocn}" class="lnkocn">#{dob.ocn}</a></label>
- <h1 class="norm" id="o#{dob.ocn}">
- #{dob.obj}
- </h1>
- </div>
-</div>
-</body>
-</html>}
+ <head>
+ <title>
+ #{dob.obj} -
+ #{@md.html_title}
+ </title>
+ <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
+ #{@css.xhtml_epub}
+ </head>
+ #{@vz.color_body}
+ <div class="content">
+ <div class="substance">
+ <label class="ocn"><a href="#o#{dob.ocn}" class="lnkocn">#{dob.ocn}</a></label>
+ <h1 class="norm" id="o#{dob.ocn}">
+ #{dob.obj}
+ </h1>
+ </div>
+ </div>
+ </body>
+ </html>}
output_epub_cont_seg.close
end
def toc_ncx #list of navigation points (like chapters), table of contents, listing each navigation point (chapters and such) under the navigation map
@@ -1341,9 +1340,7 @@ output_epub_cont_seg.close
end
def open
<<-WOK
-<?xml version="1.0"?>
-<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN"
- "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">
+<?xml version='1.0' encoding='utf-8'?>
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
WOK
end
@@ -1404,12 +1401,12 @@ output_epub_cont_seg.close
? ''
: "-#{no}"
<<-WOK
- <navPoint id="navpoint#{id_u}" playOrder="#{no}">
- <navLabel>
- <text>Table of Contents</text>
- </navLabel>
- <content src="index#{Sfx[:epub_xhtml]}" />
- </navPoint>
+ <navPoint id="navpoint#{id_u}" playOrder="#{no}">
+ <navLabel>
+ <text>Table of Contents</text>
+ </navLabel>
+ <content src="index#{Sfx[:epub_xhtml]}" />
+ </navPoint>
WOK
end
def navpoint(dob,no,fn_base,hashtag=nil)
@@ -1419,16 +1416,16 @@ output_epub_cont_seg.close
? ''
: "-#{no}"
<<-WOK
- <navPoint id="navpoint#{id_u}" playOrder="#{no}">
- <navLabel>
- <text>#{dob.obj}</text>
- </navLabel>
- <content src="#{name}" />
+ <navPoint class="chapter" id="navpoint#{id_u}" playOrder="#{no}">
+ <navLabel>
+ <text>#{dob.obj}</text>
+ </navLabel>
+ <content src="#{name}" />
WOK
end
def navpoint_close
<<-WOK
- </navPoint>
+ </navPoint>
WOK
end
def navmap_close
@@ -1454,7 +1451,7 @@ output_epub_cont_seg.close
def package_open
<<-WOK
<?xml version='1.0' encoding='utf-8'?>
-<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="EPB-UUID" version="2.0">
+<package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="EPB-UUID">
WOK
end
def package_close
@@ -1466,7 +1463,7 @@ output_epub_cont_seg.close
cover_image=if defined? @md.make.cover_image \
and @md.make.cover_image.is_a?(Hash) \
and @md.make.cover_image[:cover] =~/\S+/
- %{\n <meta name="cover" content="cover_image" />}
+ %{\n <#{$ep[:o]}meta name="cover" content="cover_image" />}
else ''
end
author=if defined? @md.creator.author \
@@ -1577,7 +1574,7 @@ output_epub_cont_seg.close
end
f=SiSU_Env::FileOp.new(@md)
<<-WOK
- <metadata xmlns:dc="http://purl.org/dc/elements/1.1/"
+ <#{$ep[:o]}metadata xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:opf="http://www.idpf.org/2007/opf"
unique-identifier="urn:uuid:#{@md.dgst[1]}" version="2.0">
<dc:title>#{@md.title.full}</dc:title>
@@ -1585,7 +1582,7 @@ output_epub_cont_seg.close
<dc:identifier opf:scheme="URI">#{f.output_path.epub.url}/#{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> -->
- </metadata>
+ </#{$ep[:o]}metadata>
WOK
end
def manifest_open
@@ -1608,7 +1605,7 @@ output_epub_cont_seg.close
and @md.make.cover_image.is_a?(Hash) \
and md.make.cover_image[:cover] =~/\S+/
<<-WOK
- <item id="cover_image_file" href="cover_image#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" />
+ <item id="cover_image#{Sfx[:epub_xhtml]}" href="cover_image#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" />
WOK
else ''
end
@@ -1646,7 +1643,7 @@ output_epub_cont_seg.close
end
def spine_cover_image
<<-WOK
- <itemref idref="cover_image_file" />
+ <itemref idref="cover_image#{Sfx[:epub_xhtml]}" />
WOK
end
def spine_sisu_toc
@@ -1674,7 +1671,7 @@ output_epub_cont_seg.close
end
def guide_cover_image
<<-WOK
- <reference type="cover" title="Cover of [book title]" href="cover_image#{Sfx[:epub_xhtml]}" />
+ <reference type="cover" title="Cover of #{SanitizeXML.xml(@md.title.full)}" href="cover_image#{Sfx[:epub_xhtml]}" />
WOK
end
def guide_sisu_toc
@@ -1727,20 +1724,20 @@ output_epub_cont_seg.close
end
def head
%{#{doc_type}
-<head>
-<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
-#{@css.xhtml_epub}
-</head>
-#{@vz.color_body}}
+ <head>
+ <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
+ #{@css.xhtml_epub}
+ </head>
+ #{@vz.color_body}}
end
def concordance
if @md.concord_make
%{#{@vz.margin_css}
- <h4 class="toc">
- <a href="./#{@md.file.base_filename.html_concordance}">
- <i>Concordance</i>
- </a>
- </h4>
+ <h4 class="toc">
+ <a href="./#{@md.file.base_filename.html_concordance}">
+ <i>Concordance</i>
+ </a>
+ </h4>
#{@vz.table_close}}
else
%{#{@vz.margin_css}
@@ -1807,15 +1804,15 @@ output_epub_cont_seg.close
end
def head
%{#{doc_type}
-<head>
- <title>
- #{@seg_name_xhtml[@seg_name_xhtml_tracker]} -
- #{@md.html_title}
- </title>
-<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
-#{@css.xhtml_epub}
-</head>
-#{@vz.color_body}}
+ <head>
+ <title>
+ #{@seg_name_xhtml[@seg_name_xhtml_tracker]} -
+ #{@md.html_title}
+ </title>
+ <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
+ #{@css.xhtml_epub}
+ </head>
+ #{@vz.color_body}}
end
def endnote_mark
%{
@@ -1833,7 +1830,7 @@ output_epub_cont_seg.close
<a href="#owner.details">
Owner Details
<font size="1" color="#777777">
- &nbsp;&nbsp;&nbsp;
+ #{$ep[:hsp]*3}
</font>
</a>
</font>
@@ -1914,7 +1911,7 @@ output_epub_cont_seg.close
def no_paranum
%{
<div class="substance">
- <label class="ocn">&nbsp;</label>
+ <label class="ocn">#{$ep[:hsp]}</label>
<p class="norm">
#{@txt}
</p>
@@ -2059,7 +2056,7 @@ output_epub_cont_seg.close
#{@txt}
</p>
#{@vz.margin_num_css}
- &nbsp;&nbsp;&nbsp;
+ #{$ep[:hsp]*3}
#{@vz.table_close}}
end
def bold_heading #unused
@@ -2069,7 +2066,7 @@ output_epub_cont_seg.close
#{@txt}
</p>
#{@vz.margin_num_css}
- &nbsp;&nbsp;&nbsp;
+ #{$ep[:hsp]*3}
#{@vz.table_close}}
end
def toc_head_copy_at
@@ -2123,8 +2120,8 @@ output_epub_cont_seg.close
note=$1
note=note.gsub(/[\n\s]+/m,' ')
txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ').
- gsub(/<a[\n\s]+"[\n\s]+href="#note_ref\d+">&nbsp;<sup id="note\d+">\d+<\/sup>&nbsp;/m,'').
- gsub(/<a[\n\s]+"[\n\s]+href="#note_ref\d+">#{Mx[:nbsp]}<sup id="note\d+">\d+<\/sup>#{Mx[:nbsp]}/m,'') #remove
+ gsub(/<a[\n\s]+"[\n\s]+href="#note_ref\d+">#{$ep[:hsp]}<sup id="note\d+">\d+<\/sup>#{$ep[:hsp]}/m,'').
+ gsub(/<a[\n\s]+"[\n\s]+href="#note_ref\d+">#{$ep[:hsp]}<sup id="note\d+">\d+<\/sup>#{$ep[:hsp]}/m,'') #remove
end
%{<#{tag} class="#{attrib}">
<a href="#o#{@ocn}"><i>#{txt}</i></a> #{note}
diff --git a/lib/sisu/v4/epub_segments.rb b/lib/sisu/v4/epub_segments.rb
index e2727232..007e4672 100644
--- a/lib/sisu/v4/epub_segments.rb
+++ b/lib/sisu/v4/epub_segments.rb
@@ -305,7 +305,7 @@ WOK
txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display }
format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
@@seg[:headings] << format_seg.title_heading1.gsub(clean,'')
- @@heading1=@@heading1.gsub(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
+ @@heading1=@@heading1.gsub(/#{$ep[:hsp]}<a name="-[\d*+]+" href="#_[\d*+]+">#{$ep[:hsp]}<sup>[\d*+]+<\/sup>#{$ep[:hsp]}<\/a>/,'')
end
if @@is2==1
heading2=@@heading2
@@ -316,7 +316,7 @@ WOK
txt_obj={ txt: heading2, ocn_display: @p_num.ocn_display }
format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
@@seg[:headings] << format_seg.title_heading2.gsub(clean,'')
- @@heading2=@@heading2.gsub(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
+ @@heading2=@@heading2.gsub(/#{$ep[:hsp]}<a name="-[\d*+]+" href="#_[\d*+]+">#{$ep[:hsp]}<sup>[\d*+]+<\/sup>#{$ep[:hsp]}<\/a>/,'')
end
if @@is3==1
heading3=@@heading3
@@ -327,7 +327,7 @@ WOK
txt_obj={ txt: heading3, ocn_display: @p_num.ocn_display }
format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
@@seg[:headings] << format_seg.title_heading3.gsub(clean,'')
- @@heading3=@@heading3.gsub(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
+ @@heading3=@@heading3.gsub(/#{$ep[:hsp]}<a name="-[\d*+]+" href="#_[\d*+]+">#{$ep[:hsp]}<sup>[\d*+]+<\/sup>#{$ep[:hsp]}<\/a>/,'')
end
if @@is4==1
heading4=@@heading4
diff --git a/lib/sisu/v4/epub_tune.rb b/lib/sisu/v4/epub_tune.rb
index b64fd675..f34db8ff 100644
--- a/lib/sisu/v4/epub_tune.rb
+++ b/lib/sisu/v4/epub_tune.rb
@@ -103,7 +103,7 @@ module SiSU_EPUB_Tune
str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;').
gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;').
gsub(/<br>/u,'<br />').
- gsub(/#{Mx[:nbsp]}/u,'&nbsp;')
+ gsub(/#{Mx[:nbsp]}/u,$ep[:hsp])
end
end
class Tune
@@ -151,8 +151,8 @@ module SiSU_EPUB_Tune
gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
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,'●&nbsp;&nbsp;').
- gsub(/#{Mx[:nbsp]}/,'&nbsp;').
+ gsub(/#{Mx[:gl_bullet]}/m,"●#{$ep[:hsp]*2}").
+ gsub(/#{Mx[:nbsp]}/,$ep[:hsp]).
gsub(/<(p|br)>/,'<\1 />')
dob.obj=SiSU_EPUB_Tune::CleanXHTML.new(dob.obj).clean
@tuned_file << dob
@@ -253,9 +253,9 @@ module SiSU_EPUB_Tune
%{\n<center><a href="\\1" target="_top"><img src="#{@env.url.images_epub}/\\2" alt="\\3" /></a></center>\n})
end
dob.obj=dob.obj.gsub(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_choice}" alt="stellar" />}).
- gsub(/!new/,%{&nbsp;<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_new}" alt="new" />}).
+ gsub(/!new/,%{#{$ep[:hsp]}<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_new}" alt="new" />}).
gsub(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>').
- gsub(/<:to(\d{1,7}?)>/,'<a href="#to\1">to&nbsp;{&nbsp;\1&nbsp;}</a> ').
+ gsub(/<:to(\d{1,7}?)>/,%{<a href="#to\\1">to#{$ep[:hsp]}\{#{$ep[:hsp]}\\1#{$ep[:hsp]}\}</a> }).
gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #http ftp matches escaped, no decoration
gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}}).
gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@brace_url.xml_close}}) #http ftp matches with decoration
diff --git a/lib/sisu/v4/html_scroll.rb b/lib/sisu/v4/html_scroll.rb
index bccc96ff..f8d104bb 100644
--- a/lib/sisu/v4/html_scroll.rb
+++ b/lib/sisu/v4/html_scroll.rb
@@ -99,8 +99,7 @@ module SiSU_HTML_Scroll
@rcdc=true
end
dob.obj=dob.obj.gsub(/href="[a-z0-9._-]+(#\S+?")/m,'href="\1'). # internal document links
- gsub(/href="#{Xx[:segment]}/m,'href="').
- gsub(/(?:\s*#{Mx[:br_page]}\s*|\s*#{Mx[:br_page_new]}\s*)+/m,'<p><hr width=90% /></p>')
+ gsub(/href="#{Xx[:segment]}/m,'href="')
if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]})/
unless dob.is ==:code
dob.obj=dob.obj.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
@@ -123,6 +122,9 @@ module SiSU_HTML_Scroll
elsif dob.ln==6
sto.heading_body6
end
+ elsif dob.is==:break \
+ and dob.from==:markup
+ '<p><hr width=90% /></p>'
elsif dob.is==:heading_insert
x=if dob.ln==1
unless dob.obj.empty?
diff --git a/lib/sisu/v4/html_segments.rb b/lib/sisu/v4/html_segments.rb
index 5a110b41..543dc209 100644
--- a/lib/sisu/v4/html_segments.rb
+++ b/lib/sisu/v4/html_segments.rb
@@ -474,7 +474,9 @@ module SiSU_HTML_Seg
sto.code
elsif dob.is==:table
sto.table
- elsif dob.is==:break
+ elsif dob.is==:break \
+ and dob.from==:markup
+ '<p><hr width=90% /></p>'
end
if @md.flag_separate_endnotes
dob.obj=dob.obj.gsub(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#_\\1">}) #endnote- twice #removed file type
diff --git a/lib/sisu/v4/param_make.rb b/lib/sisu/v4/param_make.rb
index ce35307c..5d184897 100644
--- a/lib/sisu/v4/param_make.rb
+++ b/lib/sisu/v4/param_make.rb
@@ -460,7 +460,7 @@ module SiSU_Param_Make
s=@h['cover_image'].split(/\s*;\s*/)
s=s[0] #if
image={}
- if s =~/{(\S+\.(?:jpg|png|gif))(?:\s+(\d+x\d+))?\s+(?:"(.+?)")?\s*}image/
+ if s =~/{\s*(\S+\.(?:jpg|png|gif))(?:\s+(\d+x\d+))?(?:\s+"(.+?)")?\s*}image/
image[:cover]=$1
if $2
image[:dimensions]=$2