diff options
-rw-r--r-- | data/doc/sisu/CHANGELOG_v4 | 2 | ||||
-rw-r--r-- | lib/sisu/v4/texpdf.rb | 44 | ||||
-rw-r--r-- | lib/sisu/v4/texpdf_format.rb | 94 |
3 files changed, 73 insertions, 67 deletions
diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4 index 83692be3..8244ed40 100644 --- a/data/doc/sisu/CHANGELOG_v4 +++ b/data/doc/sisu/CHANGELOG_v4 @@ -33,6 +33,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_4.0.6.orig.tar.xz files) and sisu resource configuration sub-directory, if any (./_sisu) (identifies when needed in runtime) +* v4: texpdf, cosmetic code + * v4: sysenv, webserv dir (output dir), ensure it is determined from base markup dir where relative path provided (remove possibility of it being done from a language sub-directory), fix diff --git a/lib/sisu/v4/texpdf.rb b/lib/sisu/v4/texpdf.rb index aa1f9444..20998e6c 100644 --- a/lib/sisu/v4/texpdf.rb +++ b/lib/sisu/v4/texpdf.rb @@ -607,7 +607,7 @@ module SiSU_TeX dob end def tex_box_listings - <<WOK + <<-WOK \\definecolor{listinggray}{gray}{0.9} \\definecolor{lbcolor}{rgb}{0.9,0.9,0.9} \\lstset{ @@ -632,10 +632,10 @@ module SiSU_TeX commentstyle=\\color[rgb]{0.133,0.545,0.133}, stringstyle=\\color[rgb]{0.627,0.126,0.941}, } -WOK + WOK end def tex_box_boites - <<WOK + <<-WOK \\def\\codeblockboitebox{% \\def\\bkvz@before@breakbox{\\ifhmode\\par\\fi\\vskip\\breakboxskip\\relax}% \\def\\bkvz@set@linewidth{\\advance\\linewidth -2\\fboxrule @@ -653,7 +653,7 @@ WOK \\def\\bkvz@bottom{\\hrule\\@height\\fboxrule}% \\breakbox} \\def\\endcodeblockboitebox{\\endbreakbox} -WOK + WOK end def tex_codeblock codeblock_box=if @codeblock_box=='listings' @@ -678,7 +678,7 @@ WOK @@tex_head[ps][:p]=orient_portrait.document_head_with_orientation(@codeblock_box) @@tex_head[ps][:l]=orient_landscape.document_head_with_orientation(@codeblock_box) end - @tex_file <<<<WOK + @tex_file <<<<-WOK #{@tex_ml.header}#{@tex_ml.footer} \\tolerance=300 \\clubpenalty=300 @@ -708,7 +708,7 @@ WOK % (tilde hash amp affected by http) % \\sloppy \\begin{document} -WOK + WOK sisu_rc_footnote=if @md.sc_info then @tex_ml.doc_sc_info_footnote_full else @tex_ml.doc_sc_info_footnote_brief end @@ -724,10 +724,10 @@ WOK sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.creator.author) author=sp_char.special_characters @tex_file << if @md.author_home - <<WOK + <<-WOK \\author{\\href{#{@md.author_home}}{#{@copymark} \\textnormal{#{author}}}} -WOK + WOK else "\n\\author{#{@copymark} \\textnormal{#{author}}}" end end @@ -736,22 +736,22 @@ WOK and @md.make.cover_image[:cover] =~/\S+/ x={} dir=SiSU_Env::InfoEnv.new(@md.fns) - x[:l] =<<WOK + x[:l] =<<-WOK \\titlepic{\\includegraphics[width=0.3\\textwidth]{#{dir.path.image_source_include}/#{@md.make.cover_image[:cover]}}} -WOK - x[:p] =<<WOK + WOK + x[:p] =<<-WOK \\titlepic{\\includegraphics[width=0.6\\textwidth]{#{dir.path.image_source_include}/#{@md.make.cover_image[:cover]}}} -WOK + WOK @tex_file << x x=nil end @tex_file << unless @md.fnb =~/^mail\s*$/ then @tex_ml.site else '\date' end - @tex_file <<<<WOK + @tex_file <<<<-WOK \\pagenumbering{roman}\\maketitle \\pagestyle{fancy} -WOK + WOK if defined? @md.rights.all \ and @md.rights.all @tex_file << "\\newpage\n" @@ -760,24 +760,27 @@ WOK end x={} if (@make.build.toc?) - toc=<<WOK + toc=<<-WOK \\renewcommand{\\contentsname}{#{@translate.contents}} \\tableofcontents -WOK + WOK toc_pb={ l: @tex_ml.newpage('landscape'), p: @tex_ml.newpage('portrait') } else toc='' toc_pb={ l: '', p: '' } end - x[:l] =<<WOK + if @md.opt.act[:pdf_l][:set]==:on + x[:l] =<<-WOK #{@tex_ml.newpage('landscape')} \\pagestyle{fancy} #{toc}#{toc_pb[:l]} \\pagenumbering{arabic} #{@tex_ml.paraskip_normal} #{@tex_ml.newpage('landscape')} -WOK - x[:p] =<<WOK + WOK + end + if @md.opt.act[:pdf_p][:set]==:on + x[:p] =<<-WOK #{@tex_ml.newpage('portrait')} \\pagestyle{fancy} #{toc}#{toc_pb[:p]} @@ -785,7 +788,8 @@ WOK \\pagenumbering{arabic} #{@tex_ml.paraskip_normal} #{@tex_ml.newpage('portrait')} -WOK + WOK + end @tex_file << x x=nil data.each do |dob| #% case follows with levels 1-6 indents & graphics diff --git a/lib/sisu/v4/texpdf_format.rb b/lib/sisu/v4/texpdf_format.rb index e1dbcb18..abb4c5e0 100644 --- a/lib/sisu/v4/texpdf_format.rb +++ b/lib/sisu/v4/texpdf_format.rb @@ -798,7 +798,7 @@ module SiSU_TeX_Pdf # fc-list :outline -f "%{family}\n" case @tex2pdf when /xe/ - <<WOK + <<-WOK \\usepackage{polyglossia, ucs, fontspec, xltxtra, xunicode} \\setmainlanguage{#{tex_head_lang[:mainlang]}} \\setotherlanguage{#{tex_head_lang[:otherlang]}} @@ -806,19 +806,19 @@ module SiSU_TeX_Pdf \\setmonofont[Scale=0.85]{#{texpdf_font_mono}} % \\setsansfont{#{texpdf_font_sans}} % \\setromanfont{#{texpdf_font_serif}} -WOK + WOK when /pdf/ if @md.file_encoding =~ /iso-?8859/i #% iso8859 - <<WOK + <<-WOK % \\usepackage[latin1]{inputenc} \\usepackage{fontspec} -WOK + WOK else #% utf-8 assumed - <<WOK + <<-WOK \\usepackage{babel} \\usepackage{ucs} \\usepackage[utf8x]{inputenc} -WOK + WOK end end end @@ -826,18 +826,18 @@ WOK generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] lastdone="Last Generated on: #{Time.now}" rubyv="Ruby version: #{@md.ruby_version}" - <<WOK + <<-WOK %% SiSU (Linux & Ruby - \"better ways\") LaTeX output %% #{generator} %% #{rubyv} %% LaTeX output %% #{lastdone} %% SiSU http://www.jus.uio.no/sisu -WOK + WOK end def tex_head_paper_portrait(d) multicol=(@md.book_idx ? '\usepackage{multicol}' : '') - <<WOK + <<-WOK #{tex_head_info} \\documentclass[#{d[:fontsize]},#{d[:papertype]},titlepage]{scrartcl} %with titlepage \\setlength{\\textheight}{#{d[:textheight]}mm} \\setlength{\\textwidth}{#{d[:textwidth]}mm} @@ -847,10 +847,10 @@ WOK \\setlength{\\marginparsep}{#{d[:marginparsep]}} \\setlength{\\marginparwidth}{#{d[:marginparwidth]}} #{multicol} -WOK + WOK end def tex_head_paper_landscape(d) - <<WOK + <<-WOK #{tex_head_info} \\documentclass[#{d[:fontsize]},#{d[:papertype]},landscape,titlepage,twocolumn]{scrartcl} %with titlepage \\setlength{\\textheight}{#{d[:textheight]}mm} \\setlength{\\textwidth}{#{d[:textwidth]}mm} @@ -860,10 +860,10 @@ WOK \\setlength{\\columnsep}{#{d[:columnsep]}} \\setlength{\\marginparsep}{#{d[:marginparsep]}} \\setlength{\\marginparwidth}{#{d[:marginparwidth]}} -WOK + WOK end def tex_head_paper_portrait_dvi(d) - <<WOK + <<-WOK #{tex_head_info} \\documentclass[#{d[:fontsize]},#{d[:papertype]},titlepage]{scrartcl} %with titlepage \\setlength{\\textheight}{#{d[:textheight]}mm} \\setlength{\\textwidth}{#{d[:textwidth]}mm} @@ -872,7 +872,7 @@ WOK \\setlength{\\headsep}{#{d[:headsep]}} \\setlength{\\marginparsep}{#{d[:marginparsep]}} \\setlength{\\marginparwidth}{#{d[:marginparwidth]}} -WOK + WOK end def tex_head_paper_dimensions d={} @@ -946,22 +946,22 @@ WOK def tex_head_pdftex_dvi color=case @layout when /portrait/ - <<WOK + <<-WOK colorlinks=true, urlcolor=myblack, filecolor=myblack, linkcolor=myblack, -WOK + WOK when /landscape/ - <<WOK + <<-WOK colorlinks=true, urlcolor=myblue, % \\href{...}{...} external url filecolor=mygreen, % \\href{...} local file linkcolor=myred, % \\href{...} and \\pageref{...} -WOK + WOK end if @layout =~/portrait|landscape/ - <<WOK + <<-WOK \\usepackage{alltt} \\usepackage{thumbpdf} \\usepackage[#{@tex2pdf}, @@ -1000,9 +1000,9 @@ WOK \\definecolor{mywhite}{rgb}{1,1,1} \\usepackage{url} %\\usepackage{breakurl} -WOK + WOK elsif @txt =~/dvi/ - <<WOK + <<-WOK \\usepackage{alltt} #{color.strip} pageanchor=true, @@ -1021,16 +1021,16 @@ WOK \\definecolor{mywhite}{rgb}{1,1,1} \\usepackage{url} %\\usepackage{breakurl} -WOK + WOK end end def tex_head_codeblock(codeblock_box_type) codeblock_box=if codeblock_box_type=='listings' - <<WOK + <<-WOK \\usepackage{listings} \\usepackage{color} \\usepackage{textcomp} -WOK + WOK elsif codeblock_box_type=='boites' "\\usepackage{boites}" else @@ -1039,7 +1039,7 @@ WOK codeblock_box end def tex_head_misc - <<WOK + <<-WOK \\usepackage{textcomp} \\usepackage[parfill]{parskip} \\usepackage[normalem]{ulem} @@ -1052,12 +1052,12 @@ WOK %\\usepackage{mathptmx} \\usepackage{amssymb} % amssymb used for backslash -WOK + WOK end def document_head_with_orientation(codeblock_box_type) - endnotes=("\\usepackage{endnotes}" if @txt =~/endnotes?/)||'' #not implemented see also def endnotes + endnotes=("\\usepackage{endnotes}" if @txt =~/endnotes?/) || '' #not implemented see also def endnotes @lang.list[@md.i18n[0]][:xlp] - <<WOK + <<-WOK #{tex_head_paper} #{tex_head_encode} #{tex_head_pdftex_dvi} @@ -1134,7 +1134,7 @@ WOK {\\normalfont\\normalsize\\itshape\\raggedright}} % \\makeatother \\selectlanguage{#{@lang.list[@md.i18n[0]][:xlp]}} -WOK + WOK end def a4generic end @@ -1443,13 +1443,13 @@ WOK def newpage(orientation) case orientation when /landscape/ # using longtable latex package -<<WOK + <<-WOK \\clearpage -WOK + WOK when /portrait/ -<<WOK + <<-WOK \\newpage -WOK + WOK end end def sisu_rights @@ -1461,7 +1461,7 @@ WOK end else '' end -<<WOK + <<-WOK \\\\ ~ {\\begin{footnotesize}#{base_prog_txt} \\\\ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU} \\begin{tiny}[ #{v[:project]} #{v[:version]} of #{v[:date_stamp]} ]\\end{tiny} \\href{http://www.jus.uio.no/sisu}{www.jus.uio.no/sisu} @@ -1470,19 +1470,19 @@ WOK \\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later, #{@brace_url.tex_open}\\href{http://www.fsf.org/licenses/gpl.html}{http://www.fsf.org/licenses/gpl.html}#{@brace_url.tex_close}. {\\end{footnotesize} \\\\ -WOK + WOK end def doc_sc_info_footnote_full -<<WOK + <<-WOK \\footnote{%\nGenerated by \\href{http://www.jus.uio.no/sisu}{SiSU \\ www.jus.uio.no/sisu }\\ \\newline \\scriptsize{Document version information: \\emph{sourcefile} \\uline{#{@md.fnstex}}; \\emph{version} \\uline{#{@md.sc_number}}; \\emph{date} \\uline{#{@md.sc_date}}; \\emph{time} \\uline{#{@md.sc_time}}}} -WOK + WOK end def doc_sc_info_footnote_brief " \\footnote{%\nGenerated by \\href{http://www.jus.uio.no/sisu}{SiSU} \\ \\href{http://www.jus.uio.no/sisu}{www.jus.uio.no/sisu} \\newline \\href{http://www.sisudoc.org}{www.sisudoc.org} \\\n}" end def doc_sc_info v=SiSU_Env::InfoVersion.instance.get_version -<<WOK + <<-WOK \\\\ {\\begin{footnotesize} Document version information: \\\\ @@ -1490,11 +1490,11 @@ Document version information: \\\\ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu }\\- version information: \\\\ \\uline{ #{v[:project]} #{v[:version]} of #{v[:date_stamp]}} \\end{footnotesize}}& -WOK + WOK end def doc_no_sc_info v=SiSU_Env::InfoVersion.instance.get_version -<<WOK + <<-WOK \\\\ {\\begin{small} Document information: \\\\ @@ -1503,15 +1503,15 @@ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu } \\\\ \\uline{ #{v[:project]} #{v[:version]} of #{v[:date_stamp]}} \\end{small}}& -WOK + WOK end def endnotes #not used should be inserted before MetaData section which preceeds doc_tail, but is "part of document" -<<WOK + <<-WOK \\subsection*{Endnotes} \\addcontentsline{toc}{section}{Endnotes} \\ \\listofendnotes -WOK + WOK end def doc_tail dir=SiSU_Env::InfoEnv.new(@md.fns) @@ -1524,7 +1524,7 @@ WOK " SiSU " end url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') -<<WOK + <<-WOK \\begin{english}[variant=british] \\subsection*{Information on this document copy and an unofficial List of Some web related information and sources} \\addcontentsline{toc}{section}{Information on this document copy and an unofficial List of Some web related information and sources} @@ -1551,11 +1551,11 @@ WOK #{sitename} found at: \\begin{scriptsize}#{site}\\end{scriptsize}\\subsubsection*{Links that may be of interest at #{@vz.txt_home} and elsewhere:} \\addcontentsline{toc}{subsection}{Links that may be of interest} \\end{english} -WOK + WOK end def mail_tail #not retested, the old mail_tail is commented out and appended to this program dir=SiSU_Env::InfoEnv.new(@md.fns) -<<WOK + <<-WOK \\subsection*{Mail sender details} \\addcontentsline{toc}{subsection}{Mail sender details} \\\\ @@ -1566,7 +1566,7 @@ Mail from: ralph@amissah.com\\\\ \"Support Open Standards and Open Sources for the Information Technology Infrastructure\" RA \\subsubsection*{Information on this document copy #{site}\\copyright} Presentations' look and feel generated by \\href{http://www.jus.uio.no/sisu/}{SiSU Scribe} \\href{http://www.jus.uio.no/sisu/}{http://www.jus.uio.no/sisu/} programmed in Ruby on Debian/Gnu/Linux by Copyright \\copyright Ralph Amissah, W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{\\includegraphics*[width=35pt]{#{dir.path.image_source_include}/sisu.png}}for #{sitename}. SiSU Scribe (sisu information structuring unit) produces Electronic Documents, i.e. it generates structured output for use in a number of file formats, including the pdf file produced here. -WOK + WOK end end end |