aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--data/doc/sisu/CHANGELOG_v49
-rw-r--r--lib/sisu/v4/options.rb57
-rw-r--r--lib/sisu/v4/param.rb26
3 files changed, 76 insertions, 16 deletions
diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4
index 494a51e8..715341a5 100644
--- a/data/doc/sisu/CHANGELOG_v4
+++ b/data/doc/sisu/CHANGELOG_v4
@@ -31,6 +31,15 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_4.0.6.orig.tar.xz
discrete, individually callable
* --pdf-l (--pdf-landscape), --pdf-p (--pdf-portrait)
* sisu latex output & xetex generation
+ * pdf (options, param), papersize, command-line options to override sisurc
+ settings, [a4,a5,b5,letter,legal] when --pdf* used:
+ * --papersize-a4 --papersize-letter (also --a4 --letter)
+ * --papersize=a4,letter
+ * --pdf-a4 --pdf-letter (for portrait only --pdf-p-a4 --pdf-p-letter)
+ [orientation & papersize options are set independently so calling
+ --pdf-p-a4 & --pdf-l-letter would result in landscapes and portraits of
+ both a4 & letter (rather than an individual request for a portrait A4 & a
+ landscape letter size)]
* texpdf, cosmetic code
* v4: utils (debug renamed)
diff --git a/lib/sisu/v4/options.rb b/lib/sisu/v4/options.rb
index fca60a3d..8f07e0c4 100644
--- a/lib/sisu/v4/options.rb
+++ b/lib/sisu/v4/options.rb
@@ -476,8 +476,14 @@ module SiSU_Commandline
when /^--(?:epub)$/; c=c+'e'
when /^--(?:od[ft])$/; c=c+'o'
when /^--(?:pdf)$/; c=c+'p'
+ when /^--pdf-(?:a4|a5|b5|legal|letter)$/; c=c+'p'
+ mod << m
when /^--pdf-(?:p|l|portrait|landscape)$/; c=c+'L'
mod << m
+ when /^--pdf-(?:p(?:ortrait)?|l(?:andscape)?)-(?:a4|letter|a5|b5|legal)$/; c=c+'L'
+ mod << m
+ when /^--pdf-(?:a4|letter|a5|b5|legal)-(?:p(?:ortrait)?|l(?:andscape)?)$/; c=c+'L'
+ mod << m
when /^--(?:concordance|wordmap)$/; c=c+'w'
when /^--(?:manpage|man)$/; c=c+'i'
when /^--(?:texinfo)$/; c=c+'I'
@@ -783,7 +789,7 @@ module SiSU_Commandline
? { bool: true, set: :on }
: { bool: false, set: :na }
act[:pdf]=if (cmd =~/p/ \
- || mod.inspect =~/"--pdf"/)
+ || mod.inspect =~/"--pdf"|"--pdf-(?:a4|a5|b5|letter|legal)"/)
if mod.inspect =~/"--portrait"/
act[:pdf_p]={ bool: true, set: :on }
act[:pdf_l]={ bool: false, set: :na }
@@ -799,13 +805,62 @@ module SiSU_Commandline
end
else
act[:pdf_p]=(mod.inspect =~/"--pdf-(?:p|portrait)"/) \
+ || (mod.inspect =~/"--pdf(?:-p(?:ortrait)?-(?:a4|a5|b5|letter|legal))"/) \
+ || (mod.inspect =~/"--pdf-(?:a4|a5|b5|letter|legal)(?:-p(?:ortrait)?)"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
act[:pdf_l]=(mod.inspect =~/"--pdf-(?:l|landscape)"/) \
+ || (mod.inspect =~/"--pdf(?:-l(?:andscape)?-(?:a4|a5|b5|letter|legal))"/) \
+ || (mod.inspect =~/"--pdf-(?:a4|a5|b5|letter|legal)(?:-l(?:andscape)?)"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
{ bool: false, set: :na }
end
+ if act[:pdf][:set]==:on \
+ or act[:pdf_p][:set]==:on \
+ or act[:pdf_l][:set]==:on
+ #mod.inspect =~/"--pdf-([pl]-|portrait-|landscape-)?(?:a4|a5|b5|letter|legal)"/
+ act[:pdf_a4]=if mod.inspect =~/"--pdf(?:-[pl]|-portrait|-landscape)?-a4"/ \
+ or mod.inspect =~/"--pdf-a4(?:-[pl]|-portrait|-landscape)?"/ \
+ or mod.inspect =~/"--a4"|--papersize-a4"/ \
+ or mod.inspect =~/"--papersize=\S*a4\b\S*"/ #--papersize=a4,a5
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ act[:pdf_a5]=if mod.inspect =~/"--pdf(?:-[pl]|-portrait|-landscape)?-a5"/ \
+ or mod.inspect =~/"--pdf-a5(?:-[pl]|-portrait|-landscape)?"/ \
+ or mod.inspect =~/"--a5"|"--papersize-a5"/ \
+ or mod.inspect =~/"--papersize=\S*a5\b\S*"/ #--papersize=a4,a5
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ act[:pdf_b5]=if mod.inspect =~/"--pdf(-[pl]|-portrait|-landscape)?-b5"/ \
+ or mod.inspect =~/"--pdf-b5(?:-[pl]|-portrait|-landscape)?"/ \
+ or mod.inspect =~/"--b5"|"--papersize-b5"/ \
+ or mod.inspect =~/"--papersize=\S*b5\b\S*"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ act[:pdf_letter]=if mod.inspect =~/"--pdf(-[pl]|-portrait|-landscape)?-letter"/ \
+ or mod.inspect =~/"--pdf-letter(?:-[pl]|-portrait|-landscape)?"/ \
+ or mod.inspect =~/"--letter"|"--papersize-letter"/ \
+ or mod.inspect =~/"--papersize=\S*letter\b\S*"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ act[:pdf_legal]=if mod.inspect =~/"--pdf(-[pl]|-portrait|-landscape)?-legal"/ \
+ or mod.inspect =~/"--pdf-legal(?:-[pl]|-portrait|-landscape)?"/ \
+ or mod.inspect =~/"--legal"|"--papersize-legal"/ \
+ or mod.inspect =~/"--papersize=\S*legal\b\S*"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ end
act[:epub]=(cmd =~/e/ \
|| mod.inspect =~/"--epub"/) \
? { bool: true, set: :on }
diff --git a/lib/sisu/v4/param.rb b/lib/sisu/v4/param.rb
index bcbf9ce3..8d0cf482 100644
--- a/lib/sisu/v4/param.rb
+++ b/lib/sisu/v4/param.rb
@@ -894,16 +894,6 @@ module SiSU_Param
end
end
#protected
- def determine_papersize(l)
- l=case l
- when /eu|europe|uk/i; 'A4' #European default, SiSU default
- when /(?:us-)?legal|legal/i; 'US_legal' #U.S. alternative
- when /(?:us-)?letter|u.s.|us/i; 'US_letter' #U.S. default
- when /book_a5|a5/i; 'book_a5'
- when /book_b5|b5|book/i; 'book_b5' #book default - larger
- else 'A4'
- end
- end
def extract
@user,@home,@hostname,@pwd=ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD']
@programs,@wc,@language,@language_original={},{},{},{}
@@ -1303,11 +1293,17 @@ module SiSU_Param
gsub(/num_top\s*=\s*([\dA-C])/,"num_top=#{@num_top}").
gsub(/toc_lev_limit\s*=\s*([\dA-C])/,"toc_lev_limit=#{@toc_lev_limit}")
end
- if @opt.mod.inspect =~/--papersize[=-]\S+|--pdf[=-]\S+/ \
- or @opt.mod.inspect =~/--(?:a4|letter|legal|book|a5|b5)\b/i #command line config/header override
- @papersize=determine_papersize(@opt.mod.inspect)
- end
- @papersize_array=@papersize.scan(/(?:a4|letter|legal|book|a5|b5)/i)
+ papersize_array_rc=@papersize.downcase.scan(/(?:a4|letter|legal|book|a5|b5)/)
+ papersize_array_opt=[
+ ((@opt.act[:pdf_a4][:set]==:on) ? 'a4' : ''),
+ ((@opt.act[:pdf_a5][:set]==:on) ? 'a5' : ''),
+ ((@opt.act[:pdf_b5][:set]==:on) ? 'b5' : ''),
+ ((@opt.act[:pdf_letter][:set]==:on) ? 'letter' : ''),
+ ((@opt.act[:pdf_legal][:set]==:on) ? 'legal' : ''),
+ ] - [""]
+ @papersize_array=(papersize_array_opt.length > 0) \
+ ? papersize_array_opt
+ : papersize_array_rc
fn=@opt.fno #decide what to do a filesize on .ssm tells very little about actual document size
@filesize=(File.size(fn)).to_s
if @sys.openssl !=false