aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v2
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v2')
-rw-r--r--lib/sisu/v2/defaults.rb3
-rw-r--r--lib/sisu/v2/html_segments.rb2
-rw-r--r--lib/sisu/v2/param.rb52
-rw-r--r--lib/sisu/v2/texpdf.rb25
-rw-r--r--lib/sisu/v2/texpdf_format.rb11
5 files changed, 51 insertions, 42 deletions
diff --git a/lib/sisu/v2/defaults.rb b/lib/sisu/v2/defaults.rb
index 09a9808b..da61c7eb 100644
--- a/lib/sisu/v2/defaults.rb
+++ b/lib/sisu/v2/defaults.rb
@@ -364,6 +364,9 @@ module SiSU_Viz
def url_sisudoc
'http://www.sisudoc.org'
end
+ def url_footer_signature
+ 'http://www.jus.uio.no/sisu'
+ end
def url_root
'/sisu' #watch
end
diff --git a/lib/sisu/v2/html_segments.rb b/lib/sisu/v2/html_segments.rb
index bed30afa..33e56402 100644
--- a/lib/sisu/v2/html_segments.rb
+++ b/lib/sisu/v2/html_segments.rb
@@ -297,7 +297,7 @@ module SiSU_HTML_seg
'</div>'
else ''
end
- @@seg[:tocband_bannerless] << conditional_div_close << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav])
+ @@seg[:tocband_bannerless] << '<br />' << conditional_div_close << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav])
@@seg[:headings] << format_head_seg.seg_head_escript if SiSU_HTML_Format::Head_seg.method_defined? :seg_head_escript #debug PHP move up in text #bug
@@seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author).gsub(clean,'')
ocn=if @@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
diff --git a/lib/sisu/v2/param.rb b/lib/sisu/v2/param.rb
index 8b75edfc..89eaced3 100644
--- a/lib/sisu/v2/param.rb
+++ b/lib/sisu/v2/param.rb
@@ -224,7 +224,7 @@ module SiSU_Param
@h
end
def title
- a=@s.split(/[ ]*\n[ ]*/m)
+ a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
@h=build_hash(a)
def main
s=@h['main']
@@ -269,7 +269,7 @@ module SiSU_Param
self
end
def creator #there are sub categories that need to be catered for and sometimes more than one author etc.; implement array.to_s.length validation test later, current test on string approximate as string is not used
- a=@s.split(/[ ]*\n[ ]*/m)
+ a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
@h=build_hash(a)
def author
@h['author']=(@h['author'] ? @h['author'] : @h['main'])
@@ -378,7 +378,7 @@ module SiSU_Param
self
end
def rights
- a=@s.split(/[ ]*\n[ ]*/m)
+ a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
@h=build_hash(a)
def copyright
def text #you may wish to expand to take from all
@@ -433,27 +433,27 @@ module SiSU_Param
s=copyright.text + ';'
if defined? copyright.translation \
and copyright.translation
- s +=' translation ' + copyright.translation + ';'
+ s +='<br> translation ' + copyright.translation + ';'
end
if defined? copyright.illustrations \
and copyright.illustrations
- s +=' illustrations ' + copyright.illustrations + ';'
+ s +='<br> illustrations ' + copyright.illustrations + ';'
end
if defined? copyright.photographs \
and copyright.photographs
- s +=' photographs ' + copyright.photographs + ';'
+ s +='<br> photographs ' + copyright.photographs + ';'
end
if defined? copyright.digitization \
and copyright.digitization
- s +=' digitization ' + copyright.digitization + ';'
+ s +='<br> digitization ' + copyright.digitization + ';'
end
if defined? copyright.audio \
and copyright.audio
- s +=' audio ' + copyright.audio + ';'
+ s +='<br> audio ' + copyright.audio + ';'
end
if defined? copyright.license \
and copyright.license
- s +=' License: ' + copyright.license
+ s +='<br> License: ' + copyright.license
end
if s.empty?
SiSU_Screen::Ansi.new(@cmd,'WARNING Document Rights information missing; provide @rights: :copyright:').warn unless @opt.cmd =~/q/
@@ -468,7 +468,7 @@ module SiSU_Param
self
end
def classify
- a=@s.split(/[ ]*\n[ ]*/m)
+ a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
@h=build_hash(a)
def coverage
s=@h['coverage']
@@ -528,14 +528,14 @@ module SiSU_Param
self
end
def publisher
- a=@s.split(/[ ]*\n[ ]*/m)
+ a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
@h=build_hash(a)
s=@h['main']
l,n=Db[:col_name],'publisher'
validate_length(s,l,n)
end
def date
- a=@s.split(/[ ]*\n[ ]*/m)
+ a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
@h=build_hash(a)
def added_to_site
s=@h['added_to_site']
@@ -575,7 +575,7 @@ module SiSU_Param
self
end
def language # as things stand this should really be populated from title.language and original.language, resolve
- a=@s.split(/[ ]*\n[ ]*/m)
+ a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
@h=build_hash(a)
def document
s=@h['document']=(@h['document'] ? @h['document'] : @h['main'])
@@ -600,24 +600,24 @@ module SiSU_Param
self
end
def make
- a=@s.split(/[ ]*\n[ ]*/m)
+ a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
@h=build_hash(a)
def headings
lv=[]
- s=@s
- s=((s =~/;/) ? (s.split(/;\s*/)) : [ s ])
- lv[0]=s
- lv1=s[0] ||='1~ ' #some arbitrary changes made
+ x=@h['headings']
+ x=((x =~/;/) ? (x.split(/;\s*/)) : [ x ])
+ lv[0]=x
+ lv1=x[0] ||='1~ ' #some arbitrary changes made
lv[1]=/^#{lv1}/
- lv2=s[1] ||='2~ '
+ lv2=x[1] ||='2~ '
lv[2]=/^#{lv2}/
- lv3=s[2] ||='3~ '
+ lv3=x[2] ||='3~ '
lv[3]=/^#{lv3}/
- lv4=s[3] ||='4~ '
+ lv4=x[3] ||='4~ '
lv[4]=/^#{lv4}/
- lv5=s[4] ||='5~ '
+ lv5=x[4] ||='5~ '
lv[5]=/^#{lv5}/
- lv6=s[5] ||='6~ '
+ lv6=x[5] ||='6~ '
lv[6]=/^#{lv6}/
lv
end
@@ -720,7 +720,7 @@ module SiSU_Param
@s
end
def original
- a=@s.split(/[ ]*\n[ ]*/m)
+ a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
@h=build_hash(a)
def publisher
s=@h['publisher']
@@ -755,11 +755,11 @@ module SiSU_Param
self
end
def links
- a=@s.split(/[ ]*\n[ ]*/m)
+ a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
a
end
def notes
- a=@s.split(/[ ]*\n[ ]*/m)
+ a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
@h=build_hash(a)
def abstract
@h['abstract']
diff --git a/lib/sisu/v2/texpdf.rb b/lib/sisu/v2/texpdf.rb
index 0d77d65b..91cd84b6 100644
--- a/lib/sisu/v2/texpdf.rb
+++ b/lib/sisu/v2/texpdf.rb
@@ -295,10 +295,10 @@ module SiSU_TeX
and not @md.rights.all.empty?
rght=@md.rights #.author.dup #dup is necessary, else contents of :rights changed
sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,rght.copyright.all)
- copymark=if @md.author_copymark; '{\\begin{small}\\raisebox{1ex}{\\copyright}\\end{small}} '
- else ''
- end
- copymark='Copyright {\\begin{small}\\raisebox{1ex}{\\copyright}\\end{small}} '
+ copymark=@md.author_copymark \
+ ? '{\begin{small}\copyright\end{small}} ' \
+ : ''
+ copymark='Copyright {\begin{small}\copyright\end{small}} '
copyright=sp_char.special_characters_safe.gsub(/^\s*Copyright \(C\)/, copymark)
@@rights||="\n #{Tex[:backslash]*2}[3]\\ \\linebreak #{copyright}"
end
@@ -437,16 +437,15 @@ module SiSU_TeX
sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,dob.tmp,dob.is)
dob.tmp=sp_char.special_characters_safe
dob.tmp.gsub!(/#{Mx[:nbsp]}/,'{~}')
- dob.tmp.gsub!(/(?:#{Mx[:br_nl]}\s*)+/,"\n\n") #watch
+ #dob.tmp.gsub!(/#{Mx[:nbsp]}\s*/,'{~}')
+ dob.tmp.gsub!(/(?:#{Mx[:br_nl]}\s*)+/,' \\\\\\ ') #watch
dob.tmp.gsub!(/\n\n\n/m," \\newline\n\n") #watch
ocn=SiSU_TeX_Pdf::Format_text_object.new(@md).ocn_display(dob)
dob.tmp = ocn \
+ @tex_ml.paraskip_small \
- + "\n" \
- + ' \\begin{Codeblock}' \
- + "\n" \
+ + '\begin{Codeblock}' \
+ dob.tmp \
- + ' \\end{Codeblock}' \
+ + ' \end{Codeblock}' \
+ "\n" \
+ @tex_ml.paraskip_normal
dob
@@ -566,8 +565,10 @@ module SiSU_TeX
\\makeatother
\\chardef\\txtbullet="2022
\\chardef\\tilde="7E
+%\\chardef\\asterisk="2A
+\\def\\asterisk{{\\rm \\char42} }
\\definecolor{Light}{gray}{.92}
-\\newcommand{\\Codeblock}[1]{\\normaltext\\raggedright\\tiny\\ttfamily\\texbackslash#1}
+\\newcommand{\\Codeblock}[1]{\\normaltext\\raggedright\\small\\ttfamily\\texbackslash#1}
\\newcommand{\\monosp}[1]{\\normaltext\\ttfamily\\texbackslash#1}
% \\sloppy
\\begin{document}
@@ -594,8 +595,8 @@ WOK
else "\n\\author{#{@copymark} \\textnormal{#{author}}}"
end
end
- @tex_file << unless @md.fnb =~/^mail\s*$/; "\n\\date{\\begin{footnotesize} copy @ #{@tex_ml.site} \\end{footnotesize}}"
- else "\\date"
+ @tex_file << unless @md.fnb =~/^mail\s*$/; @tex_ml.site
+ else '\date'
end
@tex_file <<<<WOK
\\pagenumbering{roman}\\maketitle
diff --git a/lib/sisu/v2/texpdf_format.rb b/lib/sisu/v2/texpdf_format.rb
index 4e489466..41802557 100644
--- a/lib/sisu/v2/texpdf_format.rb
+++ b/lib/sisu/v2/texpdf_format.rb
@@ -992,7 +992,8 @@ WOK
str.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>') # ~ SiSU special character also LaTeX
str.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'\#') # # SiSU special character also LaTeX
str.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') # ! SiSU not really special sisu character but done, also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*') # * should you wish to escape astrisk e.g. describing \*{bold}*
+ str.gsub!(/(^|\s)\*\s/,'\1\asterisk ') # * should you wish to escape astrisk e.g. describing \*{bold}*
+ str.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'\*') # * should you wish to escape astrisk e.g. describing \*{bold}*
str.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-') # - SiSU special character also LaTeX
str.gsub!(/#{Mx[:gl_o]}#043#{Mx[:gl_c]}/,'+') # + SiSU special character also LaTeX
str.gsub!(/#{Mx[:gl_o]}#044#{Mx[:gl_c]}/,',') # + SiSU special character also LaTeX
@@ -1196,12 +1197,16 @@ WOK
end
else ''
end
- "\\lfoot[\\textrm{\\thepage}]{\\tiny \\href{#{@vz.url_sisu}}{#{@vz.txt_signature}}#{base_prog_txt}}\n" +
+ "\\lfoot[\\textrm{\\thepage}]{\\tiny \\href{#{@vz.url_footer_signature}}{#{@vz.txt_signature}}#{base_prog_txt}}\n" +
"\\cfoot[\\href{#{@vz.url_home}}{#{@vz.url_txt}}]{\\href{#{@vz.url_home}}{#{@vz.url_txt}}}\n" +
"\\rfoot[\\tiny \\href{#{@vz.url_sisu}}{#{@vz.txt_signature}}]{\\textrm{\\thepage}}\n"
end
def site
- "\\href{#{@vz.url_home}}{#{@vz.url_txt}}"
+ if not @vz.url_home.empty? \
+ and not @vz.url_txt.empty?
+ "\n\\date{\\begin{footnotesize} copy @ \\href{#{@vz.url_home}}{#{@vz.url_txt}} \\end{footnotesize}}"
+ else ''
+ end
end
def sitename #owners site, eg freeculture, free.for.all, gutenberg etc.
"\\href{#{@vz.url_home}}{#{@vz.txt_home}}"