aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v4/options.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v4/options.rb')
-rw-r--r--lib/sisu/v4/options.rb115
1 files changed, 68 insertions, 47 deletions
diff --git a/lib/sisu/v4/options.rb b/lib/sisu/v4/options.rb
index 6aac2b1a..fca60a3d 100644
--- a/lib/sisu/v4/options.rb
+++ b/lib/sisu/v4/options.rb
@@ -465,47 +465,49 @@ module SiSU_Commandline
unless m.empty?
m.each do |m|
case m
- when /^--(?:color-toggle)$/; c=c+'c'
- when /^--(?:color-off)$/; c=c+'k'
- when /^--(?:configure|init-site)$/; c=c+'CC'
- when /^--(?:dal?|machine|abstraction|abs)$/; c=c+'m'
- when /^--(?:txt|text|plaintext)$/; c=c+'t'
- when /^--(?:html)$/; c=c+'h'
- when /^--(?:html-scroll|html-seg)$/; c=c+'H'
+ when /^--(?:color-toggle)$/; c=c+'c'
+ when /^--(?:color-off)$/; c=c+'k'
+ when /^--(?:configure|init-site)$/; c=c+'CC'
+ when /^--(?:dal?|machine|abstraction|abs)$/; c=c+'m'
+ when /^--(?:txt|text|plaintext)$/; c=c+'t'
+ when /^--(?:html)$/; c=c+'h'
+ when /^--(?:html-scroll|html-seg)$/; c=c+'H'
mod << m
- when /^--(?:epub)$/; c=c+'e'
- when /^--(?:od[ft])$/; c=c+'o'
- when /^--(?:pdf)$/; c=c+'p'
- when /^--(?:concordance|wordmap)$/; c=c+'w'
- when /^--(?:manpage|man)$/; c=c+'i'
- when /^--(?:texinfo)$/; c=c+'I'
- when /^--(?:xhtml)$/; c=c+'b'
- when /^--(?:xml-sax)$/; c=c+'x'
- when /^--(?:xml-dom)$/; c=c+'X'
- when /^--(?:images)$/; c=c+'j'
- when /^--(?:hash-digests)$/; c=c+'N'
- when /^--(?:po4a|pot?)$/; c=c+'P'
- when /^--(?:termsheet)$/; c=c+'T'
- when /^--(?:manifest)$/; c=c+'y'
- when /^--(?:qrcode)$/; c=c+'Q'
- when /^--(?:sqlite)$/; c=c+'d'
- when /^--(?:pg|pg?sql|postgresql)$/; c=c+'D'
- when /^--(?:remote|rsync)$/; c=c+'R'
- when /^--(?:scp)$/; c=c+'r'
- when /^--(?:source)$/; c=c+'s'
- when /^--(?:sisupod|pod)$/; c=c+'S'
- when /^--(?:git)$/; c=c+'g'
- when /^--(?:urls)$/; c=c+'U'
- when /^--(?:zap|delete)$/; c=c+'Z'
- when /^--(?:sample-search-form)$/; c=c+'F'
- when /^--(?:webserv|webrick)$/; c=c+'W'
- when /^--(?:profile)$/; c=c+'E'
- when /^--(?:maintenance|keep-processing-files)$/; c=c+'M'
- when /^--(?:verbose[=-]3)$/; c=c+'VM'
- when /^--(?:verbose[=-]2|Verbose|VERBOSE)$/; c=c+'V'
- when /^--(?:verbose(?:[=-]1)?)$/; c=c+'v'
- when /^--(?:version)$/; c=c+'v'
- when /^--(?:verbose[=-]0|quiet|silent)$/; c=c+'q'
+ when /^--(?:epub)$/; c=c+'e'
+ when /^--(?:od[ft])$/; c=c+'o'
+ when /^--(?:pdf)$/; c=c+'p'
+ when /^--pdf-(?:p|l|portrait|landscape)$/; c=c+'L'
+ mod << m
+ when /^--(?:concordance|wordmap)$/; c=c+'w'
+ when /^--(?:manpage|man)$/; c=c+'i'
+ when /^--(?:texinfo)$/; c=c+'I'
+ when /^--(?:xhtml)$/; c=c+'b'
+ when /^--(?:xml-sax)$/; c=c+'x'
+ when /^--(?:xml-dom)$/; c=c+'X'
+ when /^--(?:images)$/; c=c+'j'
+ when /^--(?:hash-digests)$/; c=c+'N'
+ when /^--(?:po4a|pot?)$/; c=c+'P'
+ when /^--(?:termsheet)$/; c=c+'T'
+ when /^--(?:manifest)$/; c=c+'y'
+ when /^--(?:qrcode)$/; c=c+'Q'
+ when /^--(?:sqlite)$/; c=c+'d'
+ when /^--(?:pg|pg?sql|postgresql)$/; c=c+'D'
+ when /^--(?:remote|rsync)$/; c=c+'R'
+ when /^--(?:scp)$/; c=c+'r'
+ when /^--(?:source)$/; c=c+'s'
+ when /^--(?:sisupod|pod)$/; c=c+'S'
+ when /^--(?:git)$/; c=c+'g'
+ when /^--(?:urls)$/; c=c+'U'
+ when /^--(?:zap|delete)$/; c=c+'Z'
+ when /^--(?:sample-search-form)$/; c=c+'F'
+ when /^--(?:webserv|webrick)$/; c=c+'W'
+ when /^--(?:profile)$/; c=c+'E'
+ when /^--(?:maintenance|keep-processing-files)$/; c=c+'M'
+ when /^--(?:verbose[=-]3)$/; c=c+'VM'
+ when /^--(?:verbose[=-]2|Verbose|VERBOSE)$/; c=c+'V'
+ when /^--(?:verbose(?:[=-]1)?)$/; c=c+'v'
+ when /^--(?:version)$/; c=c+'v'
+ when /^--(?:verbose[=-]0|quiet|silent)$/; c=c+'q'
else mod << m #mod only contains command modifiers; commands converted to character
end
end
@@ -518,7 +520,7 @@ module SiSU_Commandline
end
extra=''
if cmd !~/[mn]/
- extra+=if cmd =~/[abegHhIiNOoPpQTtwXxyz]/ \
+ extra+=if cmd =~/[abegHhIiLNOoPpQTtwXxyz]/ \
and cmd !~/[mn]/
'm' #% add dal
elsif ((cmd =~/[Dd]/ \
@@ -561,8 +563,7 @@ module SiSU_Commandline
@act=@@act
else
act={}
- act[:license]=(cmd =~/L/ \
- || mod.inspect =~/"--license/) \
+ act[:license]=(mod.inspect =~/"--license/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
act[:site_init]=(cmd =~/C/ \
@@ -781,10 +782,30 @@ module SiSU_Commandline
|| mod.inspect =~/"--images"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:pdf]=(cmd =~/p/ \
- || mod.inspect =~/"--pdf"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
+ act[:pdf]=if (cmd =~/p/ \
+ || mod.inspect =~/"--pdf"/)
+ if mod.inspect =~/"--portrait"/
+ act[:pdf_p]={ bool: true, set: :on }
+ act[:pdf_l]={ bool: false, set: :na }
+ { bool: false, set: :na }
+ elsif mod.inspect =~/"--landscape"/
+ act[:pdf_l]={ bool: true, set: :on }
+ act[:pdf_p]={ bool: false, set: :na }
+ { bool: false, set: :na }
+ else
+ act[:pdf_p]={ bool: true, set: :on }
+ act[:pdf_l]={ bool: true, set: :on }
+ { bool: true, set: :on }
+ end
+ else
+ act[:pdf_p]=(mod.inspect =~/"--pdf-(?:p|portrait)"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:pdf_l]=(mod.inspect =~/"--pdf-(?:l|landscape)"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ { bool: false, set: :na }
+ end
act[:epub]=(cmd =~/e/ \
|| mod.inspect =~/"--epub"/) \
? { bool: true, set: :on }