From 063a3a502976dd25a8178522002e67e5af85dab7 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 10 Jul 2010 11:18:39 -0400 Subject: param, header reading more robust (re: commented out parts) --- lib/sisu/v2/param.rb | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/param.rb b/lib/sisu/v2/param.rb index 8b75edfc..a313fa1c 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 @@ -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'] -- cgit v1.2.3 From 88909db5a7fe112b9a3d9c60588d48f03e0a4ee5 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 12 Jul 2010 08:49:31 -0400 Subject: param, rights (all) add line breaks between copyright, license and other rights --- lib/sisu/v2/param.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/param.rb b/lib/sisu/v2/param.rb index a313fa1c..89eaced3 100644 --- a/lib/sisu/v2/param.rb +++ b/lib/sisu/v2/param.rb @@ -433,27 +433,27 @@ module SiSU_Param s=copyright.text + ';' if defined? copyright.translation \ and copyright.translation - s +=' translation ' + copyright.translation + ';' + s +='
translation ' + copyright.translation + ';' end if defined? copyright.illustrations \ and copyright.illustrations - s +=' illustrations ' + copyright.illustrations + ';' + s +='
illustrations ' + copyright.illustrations + ';' end if defined? copyright.photographs \ and copyright.photographs - s +=' photographs ' + copyright.photographs + ';' + s +='
photographs ' + copyright.photographs + ';' end if defined? copyright.digitization \ and copyright.digitization - s +=' digitization ' + copyright.digitization + ';' + s +='
digitization ' + copyright.digitization + ';' end if defined? copyright.audio \ and copyright.audio - s +=' audio ' + copyright.audio + ';' + s +='
audio ' + copyright.audio + ';' end if defined? copyright.license \ and copyright.license - s +=' License: ' + copyright.license + s +='
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/ -- cgit v1.2.3 From 59a86332cb9d653f1f7c3b3fe77e95aa8aa30135 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 12 Jul 2010 16:51:12 -0400 Subject: texpdf, if no "copy @" info remove; rename left footer; asterisk issue --- lib/sisu/v2/defaults.rb | 3 +++ lib/sisu/v2/texpdf.rb | 16 +++++++++------- lib/sisu/v2/texpdf_format.rb | 11 ++++++++--- 3 files changed, 20 insertions(+), 10 deletions(-) (limited to 'lib') 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/texpdf.rb b/lib/sisu/v2/texpdf.rb index 0d77d65b..531cc5c9 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 @@ -566,8 +566,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 +596,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 <<<') # ~ 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}}" -- cgit v1.2.3 From 2b27e5ae1c9e69715be42ea575d4d334ddb03dbd Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 13 Jul 2010 11:18:34 -0400 Subject: texpdf, codeblocks, left margin flush --- lib/sisu/v2/texpdf.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/texpdf.rb b/lib/sisu/v2/texpdf.rb index 531cc5c9..91cd84b6 100644 --- a/lib/sisu/v2/texpdf.rb +++ b/lib/sisu/v2/texpdf.rb @@ -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 -- cgit v1.2.3 From 6b2b8965af475523f9ce7b2d5ae474382dd9fd3a Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 13 Jul 2010 18:07:13 -0400 Subject: html_segments, line space between end of text and section bottom navigation bar --- lib/sisu/v2/html_segments.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') 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 '' else '' end - @@seg[:tocband_bannerless] << conditional_div_close << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) + @@seg[:tocband_bannerless] << '
' << 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 -- cgit v1.2.3