From 5b0d2c1fc909a5a50bd8168428a0ce42364b0b5c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 6 Feb 2013 21:17:46 -0500 Subject: v4: html, screen reporting for --html-scroll, correctly identify output file --- lib/sisu/v4/html.rb | 7 +++++-- lib/sisu/v4/options.rb | 16 ++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v4/html.rb b/lib/sisu/v4/html.rb index 9e6ec0fa..530b5faf 100644 --- a/lib/sisu/v4/html.rb +++ b/lib/sisu/v4/html.rb @@ -89,14 +89,17 @@ module SiSU_HTML @fnb=@md.fnb @env=@particulars.env loc=@env.url.output_tell + primary_output_file=(@opt.act[:html_seg][:set]==:on) \ + ? (@md.file.output_path.html_seg.dir + '/' + @md.file.base_filename.html_segtoc) + : (@md.file.output_path.html_scroll.dir + '/' + @md.file.base_filename.html_scroll) unless @opt.cmd =~/q/ tool=(@opt.cmd =~/[MVvz]/) \ - ? ("#{@env.program.web_browser} file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}") + ? ("#{@env.program.web_browser} file://#{primary_output_file}") : ("[#{@opt.f_pth[:lng_is]}] #{@opt.fno}") @opt.cmd=~/[MVvz]/ \ ? SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_title_hi - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}").flow if @opt.cmd =~/[MV]/ + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{primary_output_file}").flow if @opt.cmd =~/[MV]/ end data=nil tuned_file_array=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions diff --git a/lib/sisu/v4/options.rb b/lib/sisu/v4/options.rb index fbdfc8f3..6aac2b1a 100644 --- a/lib/sisu/v4/options.rb +++ b/lib/sisu/v4/options.rb @@ -765,16 +765,12 @@ module SiSU_Commandline act[:html_seg]={ bool: true, set: :on } { bool: true, set: :on } else - act[:html_scroll]=if mod.inspect =~/"--html-scroll"/ - { bool: true, set: :on } - else - { bool: false, set: :na } - end - act[:html_seg]=if mod.inspect =~/"--html-seg"/ - { bool: true, set: :on } - else - { bool: false, set: :na } - end + act[:html_scroll]=(mod.inspect =~/"--html-scroll"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:html_seg]=(mod.inspect =~/"--html-seg"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } { bool: false, set: :na } end act[:concordance]=(cmd =~/w/ \ -- cgit v1.2.3 From cd01cd76e133dce0708fcfedf3e62fc6fbae83af Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 6 Feb 2013 21:19:27 -0500 Subject: v4 (v3): utils (debug renamed), SiSU_Utils::CodeMarker (from Debug::Mark) --- lib/sisu/v3/debug.rb | 109 ----------------------------------------------- lib/sisu/v3/hub.rb | 2 +- lib/sisu/v3/utils.rb | 109 +++++++++++++++++++++++++++++++++++++++++++++++ lib/sisu/v4/constants.rb | 4 +- lib/sisu/v4/debug.rb | 109 ----------------------------------------------- lib/sisu/v4/hub.rb | 2 +- lib/sisu/v4/sysenv.rb | 2 +- lib/sisu/v4/utils.rb | 109 +++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 223 insertions(+), 223 deletions(-) delete mode 100644 lib/sisu/v3/debug.rb create mode 100644 lib/sisu/v3/utils.rb delete mode 100644 lib/sisu/v4/debug.rb create mode 100644 lib/sisu/v4/utils.rb (limited to 'lib') diff --git a/lib/sisu/v3/debug.rb b/lib/sisu/v3/debug.rb deleted file mode 100644 index a49cecb7..00000000 --- a/lib/sisu/v3/debug.rb +++ /dev/null @@ -1,109 +0,0 @@ -# encoding: utf-8 -=begin - - * Name: SiSU - - * Description: a framework for document structuring, publishing and search - - * Author: Ralph Amissah - - * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved. - - * License: GPL 3 or later: - - SiSU, a framework for document structuring, publishing and search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see . - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - - - - - - * SiSU uses: - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - * Hompages: - - - - * Download: - - - * Ralph Amissah - - - - ** Description: system environment, debug related - -=end -module SiSU_Debug - class Mark - def initialize(line,file,color=:red) - @line,@file,@color=line.to_s,file,color - end - def ansi(color=nil) - @color=color ? color : @color - c={} - c[:on]=case @color - when :red; ANSI_C[:red] - when :green; ANSI_C[:green] - when :yellow; ANSI_C[:yellow] - when :blue; ANSI_C[:blue] - when :fuchsia; ANSI_C[:fuchsia] - when :cyan; ANSI_C[:cyan] - when :inv_red; ANSI_C[:inv_red] - when :inv_green; ANSI_C[:inv_green] - when :inv_yellow; ANSI_C[:inv_yellow] - when :inv_blue; ANSI_C[:inv_blue] - when :inv_fuchsia; ANSI_C[:inv_fuchsia] - when :inv_cyan; ANSI_C[:inv_cyan] - when :b_red; ANSI_C[:b_red] - when :b_green; ANSI_C[:b_green] - when :b_yellow; ANSI_C[:b_yellow] - when :b_blue; ANSI_C[:b_blue] - when :b_fuchsia; ANSI_C[:b_fuchsia] - when :b_cyan; ANSI_C[:b_cyan] - else ANSI_C[:red] - end - c[:off]= ANSI_C[:off] - #ansi_color + @line.to_s + ansi_color_off + ' ' + @file.gsub(/([^\/]+$)/,"#{ansi_color}\\1#{ansi_color_off}") - c - end - def set(color=nil) - c=ansi(color) - file,path=File.basename(@file),File.dirname(@file) - c[:on] + @line + c[:off] + ' ' + path + '/' "#{c[:on]}#{file}#{c[:off]}" - end - def set_(color=nil) - c=ansi(color) - c[:on] + @line + c[:off] + ' ' + - @file.gsub(/([^\/]+$)/,"#{c[:on]}\\1#{c[:off]}") - end - end -end -__END__ -puts SiSU_Debug::Mark.new(__LINE__,__FILE__).set(:red) -puts SiSU_Debug::Mark.new(__LINE__,__FILE__).set(:green) -puts SiSU_Debug::Mark.new(__LINE__,__FILE__).set(:inv_red) -puts SiSU_Debug::Mark.new(__LINE__,__FILE__,:red).set -puts SiSU_Debug::Mark.new(__LINE__,__FILE__,:green).set -puts SiSU_Debug::Mark.new(__LINE__,__FILE__,:inv_red).set diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb index eeba4cb1..73155047 100644 --- a/lib/sisu/v3/hub.rb +++ b/lib/sisu/v3/hub.rb @@ -68,7 +68,7 @@ module SiSU include SiSU_Viz require_relative 'help' # help.rb include SiSU_Help - require_relative 'debug' # debug.rb + require_relative 'utils' # utils.rb require 'uri' class HubMaster def initialize(argv) diff --git a/lib/sisu/v3/utils.rb b/lib/sisu/v3/utils.rb new file mode 100644 index 00000000..ade6132a --- /dev/null +++ b/lib/sisu/v3/utils.rb @@ -0,0 +1,109 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, debug related + +=end +module SiSU_Debug + class Mark + def initialize(line,file,color=:red) + @line,@file,@color=line.to_s,file,color + end + def ansi(color=nil) + @color=color ? color : @color + c={} + c[:on]=case @color + when :red; ANSI_C[:red] + when :green; ANSI_C[:green] + when :yellow; ANSI_C[:yellow] + when :blue; ANSI_C[:blue] + when :fuchsia; ANSI_C[:fuchsia] + when :cyan; ANSI_C[:cyan] + when :inv_red; ANSI_C[:inv_red] + when :inv_green; ANSI_C[:inv_green] + when :inv_yellow; ANSI_C[:inv_yellow] + when :inv_blue; ANSI_C[:inv_blue] + when :inv_fuchsia; ANSI_C[:inv_fuchsia] + when :inv_cyan; ANSI_C[:inv_cyan] + when :b_red; ANSI_C[:b_red] + when :b_green; ANSI_C[:b_green] + when :b_yellow; ANSI_C[:b_yellow] + when :b_blue; ANSI_C[:b_blue] + when :b_fuchsia; ANSI_C[:b_fuchsia] + when :b_cyan; ANSI_C[:b_cyan] + else ANSI_C[:red] + end + c[:off]= ANSI_C[:off] + #ansi_color + @line.to_s + ansi_color_off + ' ' + @file.gsub(/([^\/]+$)/,"#{ansi_color}\\1#{ansi_color_off}") + c + end + def set(color=nil) + c=ansi(color) + file,path=File.basename(@file),File.dirname(@file) + c[:on] + @line + c[:off] + ' ' + path + '/' "#{c[:on]}#{file}#{c[:off]}" + end + def set_(color=nil) + c=ansi(color) + c[:on] + @line + c[:off] + ' ' + + @file.gsub(/([^\/]+$)/,"#{c[:on]}\\1#{c[:off]}") + end + end +end +__END__ +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:red) +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:green) +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:inv_red) +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:red).set +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).set +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:inv_red).set diff --git a/lib/sisu/v4/constants.rb b/lib/sisu/v4/constants.rb index 65b17796..d774be25 100644 --- a/lib/sisu/v4/constants.rb +++ b/lib/sisu/v4/constants.rb @@ -289,8 +289,8 @@ DEVELOPER={ maintenance: :false, } __END__ -puts SiSU_Debug::Mark.new(__LINE__,__FILE__,:red).set -puts SiSU_Debug::Mark.new(__LINE__,__FILE__).set(:green) +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:red).set +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:green) puts ANSI_C[:red] + __LINE__.to_s + ANSI_C[:off] + ' ' + __FILE__ puts "#{ANSI_C[:red]} #{__LINE__.to_s} #{ANSI_C[:off]} #{__FILE__}" puts ANSI_C[:fuchsia] + __LINE__.to_s + ANSI_C[:off] + ' ' + __FILE__.gsub(/([^\/]+$)/,"#{ANSI_C[:fuchsia]}\\1#{ANSI_C[:off]}") diff --git a/lib/sisu/v4/debug.rb b/lib/sisu/v4/debug.rb deleted file mode 100644 index a49cecb7..00000000 --- a/lib/sisu/v4/debug.rb +++ /dev/null @@ -1,109 +0,0 @@ -# encoding: utf-8 -=begin - - * Name: SiSU - - * Description: a framework for document structuring, publishing and search - - * Author: Ralph Amissah - - * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved. - - * License: GPL 3 or later: - - SiSU, a framework for document structuring, publishing and search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see . - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - - - - - - * SiSU uses: - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - * Hompages: - - - - * Download: - - - * Ralph Amissah - - - - ** Description: system environment, debug related - -=end -module SiSU_Debug - class Mark - def initialize(line,file,color=:red) - @line,@file,@color=line.to_s,file,color - end - def ansi(color=nil) - @color=color ? color : @color - c={} - c[:on]=case @color - when :red; ANSI_C[:red] - when :green; ANSI_C[:green] - when :yellow; ANSI_C[:yellow] - when :blue; ANSI_C[:blue] - when :fuchsia; ANSI_C[:fuchsia] - when :cyan; ANSI_C[:cyan] - when :inv_red; ANSI_C[:inv_red] - when :inv_green; ANSI_C[:inv_green] - when :inv_yellow; ANSI_C[:inv_yellow] - when :inv_blue; ANSI_C[:inv_blue] - when :inv_fuchsia; ANSI_C[:inv_fuchsia] - when :inv_cyan; ANSI_C[:inv_cyan] - when :b_red; ANSI_C[:b_red] - when :b_green; ANSI_C[:b_green] - when :b_yellow; ANSI_C[:b_yellow] - when :b_blue; ANSI_C[:b_blue] - when :b_fuchsia; ANSI_C[:b_fuchsia] - when :b_cyan; ANSI_C[:b_cyan] - else ANSI_C[:red] - end - c[:off]= ANSI_C[:off] - #ansi_color + @line.to_s + ansi_color_off + ' ' + @file.gsub(/([^\/]+$)/,"#{ansi_color}\\1#{ansi_color_off}") - c - end - def set(color=nil) - c=ansi(color) - file,path=File.basename(@file),File.dirname(@file) - c[:on] + @line + c[:off] + ' ' + path + '/' "#{c[:on]}#{file}#{c[:off]}" - end - def set_(color=nil) - c=ansi(color) - c[:on] + @line + c[:off] + ' ' + - @file.gsub(/([^\/]+$)/,"#{c[:on]}\\1#{c[:off]}") - end - end -end -__END__ -puts SiSU_Debug::Mark.new(__LINE__,__FILE__).set(:red) -puts SiSU_Debug::Mark.new(__LINE__,__FILE__).set(:green) -puts SiSU_Debug::Mark.new(__LINE__,__FILE__).set(:inv_red) -puts SiSU_Debug::Mark.new(__LINE__,__FILE__,:red).set -puts SiSU_Debug::Mark.new(__LINE__,__FILE__,:green).set -puts SiSU_Debug::Mark.new(__LINE__,__FILE__,:inv_red).set diff --git a/lib/sisu/v4/hub.rb b/lib/sisu/v4/hub.rb index 2cfcee57..0cfa0d6e 100644 --- a/lib/sisu/v4/hub.rb +++ b/lib/sisu/v4/hub.rb @@ -68,7 +68,7 @@ module SiSU include SiSU_Viz require_relative 'help' # help.rb include SiSU_Help - require_relative 'debug' # debug.rb + require_relative 'utils' # utils.rb require 'uri' class HubMaster def initialize(argv) diff --git a/lib/sisu/v4/sysenv.rb b/lib/sisu/v4/sysenv.rb index d8b6f4fd..c5a1cebb 100644 --- a/lib/sisu/v4/sysenv.rb +++ b/lib/sisu/v4/sysenv.rb @@ -1067,7 +1067,7 @@ module SiSU_Env elsif output_dir_structure.by_filename? '' else - puts SiSU_Debug::Mark.new(__LINE__,__FILE__).set(:fuschia) + puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:fuschia) puts 'set output type, by: language, filetype or filename' end @stub_set_manifest=stub + '/manifest' diff --git a/lib/sisu/v4/utils.rb b/lib/sisu/v4/utils.rb new file mode 100644 index 00000000..7567d26a --- /dev/null +++ b/lib/sisu/v4/utils.rb @@ -0,0 +1,109 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, debug related + +=end +module SiSU_Utils + class CodeMarker + def initialize(line,file,color=:red) + @line,@file,@color=line.to_s,file,color + end + def ansi(color=nil) + @color=color ? color : @color + c={} + c[:on]=case @color + when :red; ANSI_C[:red] + when :green; ANSI_C[:green] + when :yellow; ANSI_C[:yellow] + when :blue; ANSI_C[:blue] + when :fuchsia; ANSI_C[:fuchsia] + when :cyan; ANSI_C[:cyan] + when :inv_red; ANSI_C[:inv_red] + when :inv_green; ANSI_C[:inv_green] + when :inv_yellow; ANSI_C[:inv_yellow] + when :inv_blue; ANSI_C[:inv_blue] + when :inv_fuchsia; ANSI_C[:inv_fuchsia] + when :inv_cyan; ANSI_C[:inv_cyan] + when :b_red; ANSI_C[:b_red] + when :b_green; ANSI_C[:b_green] + when :b_yellow; ANSI_C[:b_yellow] + when :b_blue; ANSI_C[:b_blue] + when :b_fuchsia; ANSI_C[:b_fuchsia] + when :b_cyan; ANSI_C[:b_cyan] + else ANSI_C[:red] + end + c[:off]= ANSI_C[:off] + #ansi_color + @line.to_s + ansi_color_off + ' ' + @file.gsub(/([^\/]+$)/,"#{ansi_color}\\1#{ansi_color_off}") + c + end + def set(color=nil) + c=ansi(color) + file,path=File.basename(@file),File.dirname(@file) + c[:on] + @line + c[:off] + ' ' + path + '/' "#{c[:on]}#{file}#{c[:off]}" + end + def set_(color=nil) + c=ansi(color) + c[:on] + @line + c[:off] + ' ' + + @file.gsub(/([^\/]+$)/,"#{c[:on]}\\1#{c[:off]}") + end + end +end +__END__ +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:red) +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:green) +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:inv_red) +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:red).set +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).set +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:inv_red).set -- cgit v1.2.3 From 9729605b3202aa4c808be01fe65faf88fd353df4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 6 Feb 2013 21:20:53 -0500 Subject: v4: utils, SiSU_Utils::Path.new.base_markup provides base markup directory * base markup directory contains sisu markup files, any language sub-directories (with sisu markup files) and sisu resource configuration sub-directory, if any (./_sisu) (identifies when needed in runtime) --- lib/sisu/v4/sysenv.rb | 5 +++-- lib/sisu/v4/utils.rb | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v4/sysenv.rb b/lib/sisu/v4/sysenv.rb index c5a1cebb..2ac8897f 100644 --- a/lib/sisu/v4/sysenv.rb +++ b/lib/sisu/v4/sysenv.rb @@ -60,6 +60,7 @@ @@lang_info=nil module SiSU_Env require_relative 'constants' # constants.rb + require_relative 'utils' # utils.rb require 'fileutils' include FileUtils::Verbose require 'singleton' @@ -213,7 +214,7 @@ module SiSU_Env } @@default_dir=DEFAULT_DIR m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m - @@pwd=@pwd=(/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(Dir.pwd)[1] + @@pwd=@pwd=SiSU_Utils::Path.new.base_markup stub_pwd=@pwd[m,1] attr_accessor :user,:home,:hostname,:pwd,:host,:arch,:rbver,:dir_arch,:dir_sitearch,:dir_bin,:locale,:webserv_path,:webserv_host_cgi,:webserv_port_cgi,:default_dir,:rc_path,:ad_path def initialize @@ -3926,7 +3927,7 @@ WOK class InfoDb < InfoEnv @@rc=nil def initialize - @@pwd=@pwd=(/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(Dir.pwd)[1] + @@pwd=@pwd=SiSU_Utils::Path.new.base_markup @env=SiSU_Env::InfoEnv.new pt=Pathname.new(@pwd) r=Px[:lng_lst_rgx] diff --git a/lib/sisu/v4/utils.rb b/lib/sisu/v4/utils.rb index 7567d26a..040e06b6 100644 --- a/lib/sisu/v4/utils.rb +++ b/lib/sisu/v4/utils.rb @@ -99,6 +99,17 @@ module SiSU_Utils @file.gsub(/([^\/]+$)/,"#{c[:on]}\\1#{c[:off]}") end end + class Path + def initialize(dir=Dir.pwd) + @dir=dir + end + def base_markup + (/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(Dir.pwd)[1] + end + def bmd + base_markup + end + end end __END__ puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:red) -- cgit v1.2.3 From 83a88c716a3577de0667f49cce77699790eb3686 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 6 Feb 2013 21:21:41 -0500 Subject: v4: sysenv, webserv dir (output dir), ensure is determined from base markup dir * where relative path provided (remove possibility of path expansion being done from a language sub-directory), fix --- lib/sisu/v4/sysenv.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/sisu/v4/sysenv.rb b/lib/sisu/v4/sysenv.rb index 2ac8897f..728f4fc4 100644 --- a/lib/sisu/v4/sysenv.rb +++ b/lib/sisu/v4/sysenv.rb @@ -1941,7 +1941,11 @@ WOK man_path=if @@man_path.nil? man_path=if defined? @rc['webserv']['path'] \ and @rc['webserv']['path'] =~/\S\S+/ + pwd=Dir.pwd + Dir.chdir(SiSU_Utils::Path.new.base_markup) man_path=@@man_path=File.expand_path(@rc['webserv']['path']) + Dir.chdir(pwd) + man_path else defaults[:webserv_path] end else @@man_path -- cgit v1.2.3 From 1803ceb1a0cfa7fad679794ded0305a170dcf722 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 6 Feb 2013 21:44:36 -0500 Subject: v4: texpdf, cosmetic code --- lib/sisu/v4/texpdf.rb | 44 +++++++++++---------- lib/sisu/v4/texpdf_format.rb | 94 ++++++++++++++++++++++---------------------- 2 files changed, 71 insertions(+), 67 deletions(-) (limited to 'lib') 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 - < Date: Wed, 6 Feb 2013 22:28:34 -0500 Subject: v4: pdf (texpdf, options, hub, urls) orientation discrete, individually callable --- lib/sisu/v4/hub.rb | 8 +- lib/sisu/v4/options.rb | 115 +++++++++++--------- lib/sisu/v4/texpdf.rb | 278 ++++++++++++++++++++++++++++++------------------- lib/sisu/v4/urls.rb | 12 ++- 4 files changed, 257 insertions(+), 156 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v4/hub.rb b/lib/sisu/v4/hub.rb index 0cfa0d6e..ccae2b9f 100644 --- a/lib/sisu/v4/hub.rb +++ b/lib/sisu/v4/hub.rb @@ -337,7 +337,11 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on require_relative 'xml_dom' # -X xml_dom.rb SiSU_XML_DOM::Source.new(@opt).read end - if @opt.act[:pdf][:set]==:on #% --pdf, -p latex/ texpdf + if @opt.act[:pdf][:set]==:on \ + or @opt.act[:pdf_p][:set]==:on \ + or @opt.act[:pdf_l][:set]==:on + #% --pdf-l + #% --pdf, -p latex/ texpdf require_relative 'texpdf' # -p texpdf.rb SiSU_TeX::Source.new(@opt).read end @@ -651,6 +655,8 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on or @opt.act[:xml_sax][:set]==:on \ or @opt.act[:xml_dom][:set]==:on \ or @opt.act[:pdf][:set]==:on \ + or @opt.act[:pdf_p][:set]==:on \ + or @opt.act[:pdf_l][:set]==:on \ or @opt.act[:psql][:set]==:on \ or @opt.act[:sqlite][:set]==:on \ or @opt.act[:sqlite_discreet][:set]==:on \ 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 } diff --git a/lib/sisu/v4/texpdf.rb b/lib/sisu/v4/texpdf.rb index 20998e6c..34d4f69c 100644 --- a/lib/sisu/v4/texpdf.rb +++ b/lib/sisu/v4/texpdf.rb @@ -109,8 +109,12 @@ module SiSU_TeX SiSU_Screen::Ansi.new(@opt.cmd,'LaTeX/PDF',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_title_hi unless @opt.cmd =~/q/ if @opt.cmd =~/[MVv]/ path=@env.url.output_tell - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}pdf").flow - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@opt.fns} #{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}pdf").flow + if @md.opt.act[:pdf_l][:set]==:on + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}pdf").flow + end + if @md.opt.act[:pdf_p][:set]==:on + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@opt.fns} #{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}pdf").flow + end end @md=@particulars.md $flag=@md.opt.cmd #introduced to pass 0 for no object citation numbers... to texpdf_format @@ -157,27 +161,35 @@ module SiSU_TeX def latex_do(texfilename,papersize) @texfilename=texfilename @@n_lpdf=@@n_lpdf+1 - SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} portrait ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/ tex_fn_base=@texfilename.gsub(/\.tex$/,'') - cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.tex",'',@md.opt.cmd) tell=SiSU_Screen::Ansi.new(@md.opt.cmd) - tell.grey_open if @md.opt.cmd =~/[MVv]/ - if "#{tex_fn_base}" =~/\w+/ \ - and "#{papersize}" =~/\w+/ - 2.times { |i| cmd.latex2pdf(@md,papersize) } #comment out to skip processing of latex portrait - end - tell.p_off if @md.opt.cmd =~/[MVv]/ - SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} landscape ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/ - cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.landscape.tex",'',@md.opt.cmd) - tell.grey_open if @md.opt.cmd =~/[MVv]/ - if "#{tex_fn_base}" =~/\w+/ \ - and "#{papersize}" =~/\w+/ - 2.times { |i| cmd.latex2pdf(@md,papersize) } #comment out to skip processing of latex landscape - end - tell.p_off if @md.opt.cmd =~/[MVv]/ + if @md.opt.act[:pdf_p][:set]==:on + SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} portrait ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/ + cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.tex",'',@md.opt.cmd) + tell.grey_open if @md.opt.cmd =~/[MVv]/ + if "#{tex_fn_base}" =~/\w+/ \ + and "#{papersize}" =~/\w+/ + 2.times { |i| cmd.latex2pdf(@md,papersize) } #comment out to skip processing of latex portrait + end + tell.p_off if @md.opt.cmd =~/[MVv]/ + end + if @md.opt.act[:pdf_l][:set]==:on + SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} landscape ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/ + cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.landscape.tex",'',@md.opt.cmd) + tell.grey_open if @md.opt.cmd =~/[MVv]/ + if "#{tex_fn_base}" =~/\w+/ \ + and "#{papersize}" =~/\w+/ + 2.times { |i| cmd.latex2pdf(@md,papersize) } #comment out to skip processing of latex landscape + end + tell.p_off if @md.opt.cmd =~/[MVv]/ + end pwd=Dir.pwd - portrait_pdf="#{pwd}/#{tex_fn_base}.pdf" - landscape_pdf="#{pwd}/#{tex_fn_base}.landscape.pdf" + if @md.opt.act[:pdf_p][:set]==:on + portrait_pdf="#{pwd}/#{tex_fn_base}.pdf" + end + if @md.opt.act[:pdf_l][:set]==:on + landscape_pdf="#{pwd}/#{tex_fn_base}.landscape.pdf" + end case papersize when /a4/; pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 when /a5/; pdf_p=@f.pdf_p_a5; pdf_l=@f.pdf_l_a5 @@ -187,15 +199,19 @@ module SiSU_TeX else pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 end FileUtils::mkdir_p(@md.file.output_path.pdf.dir) unless FileTest.directory?(@md.file.output_path.pdf.dir) - if FileTest.file?(portrait_pdf) - FileUtils::cp(portrait_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_p}") - FileUtils::rm(portrait_pdf) - else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.opt.cmd.inspect =~/M/ + if @md.opt.act[:pdf_p][:set]==:on + if FileTest.file?(portrait_pdf) + FileUtils::cp(portrait_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_p}") + FileUtils::rm(portrait_pdf) + else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.opt.cmd.inspect =~/M/ + end end - if FileTest.file?(landscape_pdf) - FileUtils::cp(landscape_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_l}") - FileUtils::rm(landscape_pdf) - else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.opt.cmd.inspect =~/M/ + if @md.opt.act[:pdf_l][:set]==:on + if FileTest.file?(landscape_pdf) + FileUtils::cp(landscape_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_l}") + FileUtils::rm(landscape_pdf) + else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.opt.cmd.inspect =~/M/ + end end SiSU_Screen::Ansi.new(@md.opt.cmd,@@n_lpdf,'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)').generic_number if @md.opt.cmd =~/[MVv]/ end @@ -214,13 +230,18 @@ module SiSU_TeX Dir.chdir(@env.processing_path.tex) texfile=@md.fns.gsub(/$/,".#{ps}.tex"). gsub(/~/,'-') - if File.exist?(texfile) \ - and File.size(texfile) > 0 - @tex_f_no+=1 - #p "#{__FILE__}:#{__LINE__} texpdf generation disabled" if @md.opt.cmd.inspect =~/M/ #%% disable temporarily, re-enable + if @md.opt.act[:pdf_p][:set]==:on \ + or @md.opt.act[:pdf_l][:set]==:on latex_do(texfile,ps) - else - puts "\tzero file size #{@env.processing_path.tex}/#{texfile}" + if @md.opt.act[:pdf_p][:set]==:on + if File.exist?(texfile) \ + and File.size(texfile) > 0 + #@tex_f_no+=1 + else + puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:fuchsia) + puts "\tzero file size #{@env.processing_path.tex}/#{texfile}" + end + end end end end @@ -234,32 +255,34 @@ module SiSU_TeX when /legal/; pdf_p=@f.pdf_p_legal; pdf_l=@f.pdf_l_legal else pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{pdf_p}") - mklnk=if @md.file.output_dir_structure.by_language_code? \ - or @md.file.output_dir_structure.by_filetype? - "#{@md.fnb}.portrait.pdf" - else 'portrait.pdf' + if @md.opt.act[:pdf_p][:set]==:on + if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{pdf_p}") + mklnk=((@md.file.output_dir_structure.by_language_code?) \ + || (@md.file.output_dir_structure.by_filetype?)) \ + ? "#{@md.fnb}.portrait.pdf" + : 'portrait.pdf' + if FileTest.directory?(@md.file.output_path.pdf.dir) + pwd=Dir.pwd + Dir.chdir(@md.file.output_path.pdf.dir) + FileUtils::rm_f(mklnk) + FileUtils::ln_s(pdf_p, mklnk) + Dir.chdir(pwd) + end end - if FileTest.directory?(@md.file.output_path.pdf.dir) - pwd=Dir.pwd + end + if @md.opt.act[:pdf_l][:set]==:on + if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{pdf_l}") + mklnk=((@md.file.output_dir_structure.by_language_code?) \ + || (@md.file.output_dir_structure.by_filetype?)) \ + ? "#{@md.fnb}.landscape.pdf" + : 'landscape.pdf' + pwd_set=Dir.pwd Dir.chdir(@md.file.output_path.pdf.dir) FileUtils::rm_f(mklnk) - FileUtils::ln_s(pdf_p, mklnk) - Dir.chdir(pwd) + FileUtils::ln_s(pdf_l, mklnk) + Dir.chdir(pwd_set) end end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{pdf_l}") - mklnk=if @md.file.output_dir_structure.by_language_code? \ - or @md.file.output_dir_structure.by_filetype? - "#{@md.fnb}.landscape.pdf" - else 'landscape.pdf' - end - pwd_set=Dir.pwd - Dir.chdir(@md.file.output_path.pdf.dir) - FileUtils::rm_f(mklnk) - FileUtils::ln_s(pdf_l, mklnk) - Dir.chdir(pwd_set) - end else SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped").warn end @@ -303,7 +326,18 @@ module SiSU_TeX data=@data @@tex_footnote_array=[] @@rights=nil - SiSU_Screen::Ansi.new(@md.opt.cmd,"pdfTex portrait & landscape").txt_grey if @md.opt.cmd=~/[MVvz]/ + txt_gen=if @md.opt.act[:pdf_l][:set]==:on \ + and @md.opt.act[:pdf_p][:set]==:on + 'pdfTex portrait & landscape' + elsif @md.opt.act[:pdf_l][:set]==:on + 'pdfTex landscape' + elsif @md.opt.act[:pdf_p][:set]==:on + 'pdfTex portrait' + else + puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:fuchsia) + 'error: neither landscape nor portrait' + end + SiSU_Screen::Ansi.new(@md.opt.cmd,txt_gen).txt_grey if @md.opt.cmd=~/[MVvz]/ if defined? @md.rights.all \ and not @md.rights.all.empty? rght=@md.rights #.author.dup #dup is necessary, else contents of :rights changed @@ -671,12 +705,16 @@ module SiSU_TeX home=@vz.txt_home.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex title=@md.title.full.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex @md.papersize_array.each do |ps| - txt_obj={ txt: "#{home}: - #{title}", paper_size: ps, orientation: 'portrait' } - orient_portrait=SiSU_TeX_Pdf::FormatHead.new(@md,txt_obj) - txt_obj={ txt: "#{home}: - #{title}", paper_size: ps, orientation: 'landscape' } - orient_landscape=SiSU_TeX_Pdf::FormatHead.new(@md,txt_obj) - @@tex_head[ps][:p]=orient_portrait.document_head_with_orientation(@codeblock_box) - @@tex_head[ps][:l]=orient_landscape.document_head_with_orientation(@codeblock_box) + if @md.opt.act[:pdf_p][:set]==:on + txt_obj={ txt: "#{home}: - #{title}", paper_size: ps, orientation: 'portrait' } + orient_portrait=SiSU_TeX_Pdf::FormatHead.new(@md,txt_obj) + @@tex_head[ps][:p]=orient_portrait.document_head_with_orientation(@codeblock_box) + end + if @md.opt.act[:pdf_l][:set]==:on + txt_obj={ txt: "#{home}: - #{title}", paper_size: ps, orientation: 'landscape' } + orient_landscape=SiSU_TeX_Pdf::FormatHead.new(@md,txt_obj) + @@tex_head[ps][:l]=orient_landscape.document_head_with_orientation(@codeblock_box) + end end @tex_file <<<<-WOK #{@tex_ml.header}#{@tex_ml.footer} @@ -715,8 +753,12 @@ module SiSU_TeX @copymark='' #check and remove as now is superflous x={} txt_obj={ title: @md.title.full } - x[:l]=SiSU_TeX_Pdf::FormatTextObject.new(@md,txt_obj).title_landscape - x[:p]=SiSU_TeX_Pdf::FormatTextObject.new(@md,txt_obj).title_portrait + if @md.opt.act[:pdf_l][:set]==:on + x[:l]=SiSU_TeX_Pdf::FormatTextObject.new(@md,txt_obj).title_landscape + end + if @md.opt.act[:pdf_p][:set]==:on + x[:p]=SiSU_TeX_Pdf::FormatTextObject.new(@md,txt_obj).title_portrait + end @tex_file << x x=nil if defined? @md.creator.author \ @@ -901,59 +943,77 @@ module SiSU_TeX def output_morph_hash(o) ps,h,fn=o[:ps],o[:h],o[:filename] if h[ps] \ - and (h[ps][:p] and h[ps][:l]) - if h[ps][:p] - h[ps][:p]=h[ps][:p].gsub(/[ ]+$/m,''). - gsub(/\n\n\n+/m,"\n\n") - end - if h[ps][:l] - h[ps][:l]=h[ps][:l].gsub(/[ ]+$/m,''). - gsub(/\n\n\n+/m,"\n\n") - end - #h[ps][:p].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[ps][:p] - #h[ps][:l].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[ps][:l] - if h[ps][:p] !~/\A\s*\Z/ - fn[:portrait].puts h[ps][:p],"\n" - end - if h[ps][:l] !~/\A\s*\Z/ - fn[:landscape].puts h[ps][:l],"\n" - end - elsif (h[:p] and h[:l]) - if h[:p] - h[:p]=h[:p].gsub(/[ ]+$/m,''). - gsub(/\n\n\n+/m,"\n\n") + and (h[ps][:p] or h[ps][:l]) + if @md.opt.act[:pdf_p][:set]==:on + if h[ps][:p] + h[ps][:p]=h[ps][:p].gsub(/[ ]+$/m,''). + gsub(/\n\n\n+/m,"\n\n") + end + if h[ps][:p] !~/\A\s*\Z/ + fn[:portrait].puts h[ps][:p],"\n" + end end - if h[:l] - h[:l]=h[:l].gsub(/[ ]+$/m,''). - gsub(/\n\n\n+/m,"\n\n") + if @md.opt.act[:pdf_l][:set]==:on + if h[ps][:l] + h[ps][:l]=h[ps][:l].gsub(/[ ]+$/m,''). + gsub(/\n\n\n+/m,"\n\n") + end + if h[ps][:l] !~/\A\s*\Z/ + fn[:landscape].puts h[ps][:l],"\n" + end end - #h[:p].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[:p] - #h[:l].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[:l] - if h[:p] !~/\A\s*\Z/ - fn[:portrait].puts h[:p],"\n" + elsif (h[:p] or h[:l]) + if @md.opt.act[:pdf_p][:set]==:on + if h[:p] + h[:p]=h[:p].gsub(/[ ]+$/m,''). + gsub(/\n\n\n+/m,"\n\n") + end + if h[:p] !~/\A\s*\Z/ + fn[:portrait].puts h[:p],"\n" + end end - if h[:l] !~/\A\s*\Z/ - fn[:landscape].puts h[:l],"\n" + if @md.opt.act[:pdf_l][:set]==:on + if h[:l] + h[:l]=h[:l].gsub(/[ ]+$/m,''). + gsub(/\n\n\n+/m,"\n\n") + end + if h[:l] !~/\A\s*\Z/ + fn[:landscape].puts h[:l],"\n" + end end else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/ end end def output(array) @array=array=array.flatten.compact - fns_l=@md.fns.gsub(/~/,'-') #this is a sorry fix, but necessary as it appears latex programs like not ~ + fns=@md.fns.gsub(/~/,'-') #this is a sorry fix, but necessary as it appears latex programs like not ~ @md.papersize_array.each do |ps| + texfile_landscape=(@md.opt.act[:pdf_l][:set]==:on) \ + ? (File.new("#{@env.processing_path.tex}/#{fns}.#{ps}.landscape.tex",'w+')) + : nil + texfile_portrait=(@md.opt.act[:pdf_p][:set]==:on) \ + ? (File.new("#{@env.processing_path.tex}/#{fns}.#{ps}.tex",'w+')) + : nil file={ - landscape: File.new("#{@env.processing_path.tex}/#{fns_l}.#{ps}.landscape.tex",'w+'), - portrait: File.new("#{@env.processing_path.tex}/#{fns_l}.#{ps}.tex",'w+') + landscape: texfile_landscape, + portrait: texfile_portrait } - file[:portrait] << @@tex_head[ps][:p] - file[:landscape] << @@tex_head[ps][:l] + if @md.opt.act[:pdf_p][:set]==:on + file[:portrait] << @@tex_head[ps][:p] + end + if @md.opt.act[:pdf_l][:set]==:on + file[:landscape] << @@tex_head[ps][:l] + end array.each do |morph| if morph.is_a?(String) #morph.gsub!(/^\s+/,'') if morph !~/\A\s*\Z/ - file[:portrait].puts morph,"\n" - file[:landscape].puts morph,"\n" + if @md.opt.act[:pdf_p][:set]==:on + file[:portrait].puts morph,"\n" + end + if @md.opt.act[:pdf_l][:set]==:on + file[:landscape].puts morph,"\n" + end end elsif morph.class.inspect =~ /SiSU_DAL_DocumentStructure/ \ and morph.tmp \ @@ -965,8 +1025,12 @@ module SiSU_TeX end if (morph.tmp !~/\A\s*\Z/) \ || morph.is==:code - file[:portrait].puts morph.tmp,"\n" - file[:landscape].puts morph.tmp,"\n" + if @md.opt.act[:pdf_p][:set]==:on + file[:portrait].puts morph.tmp,"\n" + end + if @md.opt.act[:pdf_l][:set]==:on + file[:landscape].puts morph.tmp,"\n" + end end elsif morph.is_a?(Hash) #inserted headers and the like, only h={ ps: ps, h: morph, filename: file } @@ -977,8 +1041,12 @@ module SiSU_TeX end end array=@array - file[:portrait].close - file[:landscape].close + if @md.opt.act[:pdf_p][:set]==:on + file[:portrait].close + end + if @md.opt.act[:pdf_l][:set]==:on + file[:landscape].close + end end @@tex_head={ 'a4'=> { p: nil, l: nil }, diff --git a/lib/sisu/v4/urls.rb b/lib/sisu/v4/urls.rb index 5e6bcc8a..e3671dcd 100644 --- a/lib/sisu/v4/urls.rb +++ b/lib/sisu/v4/urls.rb @@ -355,11 +355,17 @@ module SiSU_Urls end end if x=~/--pdf\b/ \ - and @opt.act[:pdf][:set]==:on + and (@opt.act[:pdf][:set]==:on \ + or @opt.act[:pdf_p][:set]==:on \ + or @opt.act[:pdf_l][:set]==:on) if x =~/portrait/ - show.pdf.portrait(x) + if @opt.act[:pdf_p][:set]==:on + show.pdf.portrait(x) + end else - show.pdf.landscape(x) + if @opt.act[:pdf_l][:set]==:on + show.pdf.landscape(x) + end end end if x=~/--sisupod\b/ \ -- cgit v1.2.3 From bf57f03babb2375adc9a225f4d95799c37d81d55 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 6 Feb 2013 23:10:58 -0500 Subject: v4: options, param, pdf papersize, command-line options to override sisurc --- lib/sisu/v4/options.rb | 57 +++++++++++++++++++++++++++++++++++++++++++++++++- lib/sisu/v4/param.rb | 26 ++++++++++------------- 2 files changed, 67 insertions(+), 16 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3 From 75dc380f544c55d38765a7679c464e6c71125fb6 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 7 Feb 2013 18:10:21 -0500 Subject: v4: options, for pdf, concentrate & simplify matching of orientation & papersize --- lib/sisu/v4/options.rb | 89 +++++++++++++++++++++++++++++--------------------- 1 file changed, 51 insertions(+), 38 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v4/options.rb b/lib/sisu/v4/options.rb index 8f07e0c4..3dca5253 100644 --- a/lib/sisu/v4/options.rb +++ b/lib/sisu/v4/options.rb @@ -462,6 +462,37 @@ module SiSU_Commandline end def opt_cmd_and_mod_adjust(c,m) cmd,mod,files=@cmd,@mod,@files + if not m.empty? \ + and m.inspect =~/"--pdf-/ + ps,psa='',[] + mod << '--pdf' + m.each do |m| + if m =~ /^--pdf-(?:(?:l|landscape)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:l|landscape))$/ + mod << '--landscape' + end + if m =~ /^--pdf-(?:(?:p|portrait)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:p|portrait))$/ + mod << '--portrait' + end + if m =~ /^--pdf(?:-(?:a4|letter|a5|b5|legal)(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))(?:-(?:a4|letter|a5|b5|legal)))$/ + if m =~ /^--pdf(?:-a4(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a4)$/ + mod << '--papersize-a4' + end + if m =~ /^--pdf(?:-a5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a5)$/ + mod << '--papersize-a5' + end + if m =~ /^--pdf(?:-b5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-b5)$/ + mod << '--papersize-b5' + end + if m =~ /^--pdf(?:-letter(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-letter)$/ + mod << '--papersize-letter' + end + if m =~ /^--pdf(?:-legal(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-legal)$/ + mod << '--papersize-legal' + end + end + end + mod=mod.uniq + end unless m.empty? m.each do |m| case m @@ -477,13 +508,9 @@ module SiSU_Commandline 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' @@ -788,73 +815,59 @@ module SiSU_Commandline || mod.inspect =~/"--images"/) \ ? { bool: true, set: :on } : { bool: false, set: :na } - act[:pdf]=if (cmd =~/p/ \ - || mod.inspect =~/"--pdf"|"--pdf-(?:a4|a5|b5|letter|legal)"/) + if (cmd =~/p/ \ + || mod.inspect =~/"--pdf"/) if mod.inspect =~/"--portrait"/ - act[:pdf_p]={ bool: true, set: :on } + act[:pdf]= { bool: false, set: :na } act[:pdf_l]={ bool: false, set: :na } - { bool: false, set: :na } + act[:pdf_p]={ bool: true, set: :on } elsif mod.inspect =~/"--landscape"/ + act[:pdf]= { bool: false, set: :na } 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]= { bool: true, set: :on } act[:pdf_l]={ bool: true, set: :on } - { bool: true, set: :on } + act[:pdf_p]={ bool: true, set: :on } 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 } + act[:pdf]= { bool: false, set: :na } + act[:pdf_p]= { bool: false, set: :na } + act[:pdf_l]= { bool: false, set: :na } + act[:pdf_a4]= { bool: false, set: :na } + act[:pdf_a5]= { bool: false, set: :na } + act[:pdf_b5]= { bool: false, set: :na } + act[:pdf_letter]={ bool: false, set: :na } + act[:pdf_legal]= { 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"/ \ + act[:pdf_a4]=if 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"/ \ + act[:pdf_a5]=if 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"/ \ + act[:pdf_b5]=if 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"/ \ + act[:pdf_letter]=if 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"/ \ + act[:pdf_legal]=if mod.inspect =~/"--legal"|"--papersize-legal"/ \ or mod.inspect =~/"--papersize=\S*legal\b\S*"/ { bool: true, set: :on } else -- cgit v1.2.3