Class: SiSU_Info_Env::InfoEnv
Overview
Direct Known Subclasses
SiSU_CSS::CSS_Select, SiSU_Clear::Clear, SiSU_Create_File::CreateFile, SiSU_Create_Site::CreateSite, SiSU_Env::InfoEnv, SiSU_File_Map::FileMap, SiSU_Info_Db::InfoDb, SiSU_Info_File::InfoFile, SiSU_Info_Port::InfoPort, SiSU_Info_Program::InfoProgram, SiSU_Info_Set::InfoSettings, SiSU_Info_Version::InfoVersion
Instance Attribute Summary collapse
#ad, #fnv, #fnz
Instance Method Summary
collapse
-
#ao ⇒ Object
-
#arch ⇒ Object
-
#asciidoc_ocn? ⇒ Boolean
-
#bin ⇒ Object
-
#build ⇒ Object
-
#cgi ⇒ Object
-
#cgi_sample_search_form_name(opt = nil) ⇒ Object
-
#cjk ⇒ Object
-
#cjk_ja ⇒ Object
-
#cjk_ko ⇒ Object
-
#cjk_zh ⇒ Object
‘IPAGothic’ # ‘IPAMincho’ # ‘TakaoMincho’ # ‘VL Gothic’.
-
#composite_file ⇒ Object
-
#concord_max ⇒ Object
-
#console_web_browser ⇒ Object
-
#console_www_browser ⇒ Object
-
#current_document ⇒ Object
-
#defaults ⇒ Object
multiple default directories.
-
#digest(opt = nil) ⇒ Object
-
#digest_conf? ⇒ Boolean
-
#dir_url ⇒ Object
-
#docbook_viewer ⇒ Object
-
#encoding ⇒ Object
-
#epub ⇒ Object
-
#epub_bld ⇒ Object
-
#epub_cp_images(md) ⇒ Object
-
#epub_viewer ⇒ Object
-
#feed ⇒ Object
-
#feed_home ⇒ Object
-
#fictionbook_viewer ⇒ Object
-
#file_encoding ⇒ Object
‘pinfo -f’ ‘info’ ‘tkinfo’.
-
#font ⇒ Object
-
#git ⇒ Object
-
#host ⇒ Object
-
#html ⇒ Object
-
#html_minitoc? ⇒ Boolean
-
#html_navigation? ⇒ Boolean
-
#html_navigation_bar? ⇒ Boolean
-
#html_quick_ref? ⇒ Boolean
-
#html_right_pane? ⇒ Boolean
-
#html_scroll_1 ⇒ Object
-
#html_scroll_2 ⇒ Object
-
#html_search_form? ⇒ Boolean
decide later, as is configured here (in sisurc) and can be turned off on command line.
-
#html_seg_1 ⇒ Object
-
#html_seg_2 ⇒ Object
-
#html_seg_title_banner? ⇒ Boolean
-
#html_top_band? ⇒ Boolean
-
#i18n ⇒ Object
-
#image_external ⇒ Object
-
#image_source(md = nil) ⇒ Object
image repository source directory.
-
#image_source_include(md = nil) ⇒ Object
image repository source directory.
-
#image_source_include_local ⇒ Object
-
#image_source_include_remote ⇒ Object
-
#image_source_sisu_includes(md = nil) ⇒ Object
-
#images ⇒ Object
-
#images_epub ⇒ Object
-
#images_external ⇒ Object
-
#images_local ⇒ Object
def images ‘../_sisu/image’ end.
-
#initialize(fns = '', md = nil) ⇒ InfoEnv
constructor
A new instance of InfoEnv.
-
#landscape ⇒ Object
-
#lang_filename(l) ⇒ Object
def multilingual x=(defined? @rc[‘multilingual’] \ && @rc[‘multilingual’] ==true) \ ? true : false end def bundle x=(defined? @rc[‘bundle’] \ && @rc[‘bundle’] ==true) \ ? true : false end.
-
#language ⇒ Object
-
#language_default_set ⇒ Object
set directory (default) language.
-
#length ⇒ Object
-
#links_to_manifest? ⇒ Boolean
-
#listed?(test) ⇒ Boolean
-
#local ⇒ Object
-
#locale ⇒ Object
-
#localhost ⇒ Object
-
#lout ⇒ Object
-
#main ⇒ Object
you may wish to check selected font against available fonts: fc-list :outline -f “%familyn” fc-list :lang=ja.
-
#make ⇒ Object
-
#man ⇒ Object
-
#manifest? ⇒ Boolean
-
#manifest_minitoc? ⇒ Boolean
-
#manpage ⇒ Object
-
#manpage_generator ⇒ Object
-
#manpage_viewer ⇒ Object
-
#markdown_ocn? ⇒ Boolean
-
#markup_emphasis ⇒ Object
-
#metadata? ⇒ Boolean
-
#minitoc? ⇒ Boolean
-
#mono ⇒ Object
-
#ocn? ⇒ Boolean
-
#odf ⇒ Object
-
#odf_pth ⇒ Object
-
#odf_viewer ⇒ Object
-
#odt ⇒ Object
-
#odt_bld ⇒ Object
-
#odt_ocn? ⇒ Boolean
-
#omit_list ⇒ Object
-
#orgmode_ocn? ⇒ Boolean
-
#output ⇒ Object
web/webserv output directory…
-
#output_tell ⇒ Object
-
#papersize ⇒ Object
paper settings, default overidden in param if set within document.
-
#path ⇒ Object
-
#path_rel_links ⇒ Object
-
#paths ⇒ Object
-
#pattern ⇒ Object
-
#pdf ⇒ Object
-
#pdf_viewer ⇒ Object
-
#pdflatex ⇒ Object
-
#php ⇒ Object
-
#plaintext_ocn? ⇒ Boolean
-
#plaintext_wrap ⇒ Object
-
#po ⇒ Object
-
#port ⇒ Object
-
#portrait ⇒ Object
-
#postgresql ⇒ Object
-
#pot ⇒ Object
-
#processing_base_tmp ⇒ Object
-
#processing_path ⇒ Object
-
#processing_sisupod(opt = nil) ⇒ Object
processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc).
-
#program ⇒ Object
-
#promo? ⇒ Boolean
-
#pwd ⇒ Object
-
#rbver ⇒ Object
-
#read_source_file(fns) ⇒ Object
-
#read_source_file_array(fns) ⇒ Object
-
#read_source_file_string(fns) ⇒ Object
-
#remote ⇒ Object
-
#rexml ⇒ Object
should be part of ruby 1.8 but apparently not always.
-
#rmagick ⇒ Object
-
#root ⇒ Object
-
#root_dir ⇒ Object
-
#rst_ocn? ⇒ Boolean
-
#sample_data ⇒ Object
sample data repository source directory.
-
#sample_search_form_title(organised_by = :language) ⇒ Object
-
#sans ⇒ Object
-
#scripts ⇒ Object
used previously only to include tla version info.
-
#search? ⇒ Boolean
-
#search_action ⇒ Object
-
#search_fixed? ⇒ Boolean
-
#search_form(action = nil, db = nil) ⇒ Object
-
#search_form? ⇒ Boolean
decide later, as is configured here (in sisurc) and can be turned off on command line.
-
#search_form_static(action = nil, db = nil) ⇒ Object
-
#segsubtoc? ⇒ Boolean
-
#serif ⇒ Object
-
#share ⇒ Object
shared data repository source directory.
-
#sisupod_gen(fns_pod) ⇒ Object
-
#sisupod_gen_v2(fns_pod) ⇒ Object
-
#sisupod_gen_v3(fns_pod) ⇒ Object
-
#sisupod_v2 ⇒ Object
-
#sisupod_v3(opt) ⇒ Object
-
#sisupod_v4(opt) ⇒ Object
-
#sisurc_path ⇒ Object
-
#sitearch ⇒ Object
-
#size(pt = nil) ⇒ Object
-
#source_file_path ⇒ Object
-
#source_file_processing_array(fns) ⇒ Object
-
#source_file_with_path ⇒ Object
-
#sql ⇒ Object
-
#sqlite ⇒ Object
-
#src_pod ⇒ Object
-
#src_txt ⇒ Object
-
#stub_dir ⇒ Object
-
#stub_dir_orig ⇒ Object
ends up with lang, if lang dir.
-
#stub_epub ⇒ Object
-
#stub_md_harvest ⇒ Object
-
#stub_pod ⇒ Object
-
#style ⇒ Object
-
#tex ⇒ Object
-
#texi ⇒ Object
-
#texinfo ⇒ Object
‘nroff -man’ #‘groff -man -Tascii’.
-
#texpdf ⇒ Object
-
#texpdf_hyperlinks(cli) ⇒ Object
-
#text_editor ⇒ Object
-
#textile_ocn? ⇒ Boolean
-
#tidy ⇒ Object
-
#tmp_root_dir ⇒ Object
-
#toc? ⇒ Boolean
-
#tune ⇒ Object
-
#txt ⇒ Object
-
#type ⇒ Object
-
#url ⇒ Object
-
#usr_dir? ⇒ Boolean
-
#wc ⇒ Object
-
#web_browser ⇒ Object
-
#webrick ⇒ Object
-
#webrick_port ⇒ Object
-
#webserv ⇒ Object
web url for local webserv (localhost, or hostname).
-
#webserv_base ⇒ Object
web url for local webserv (localhost, or hostname).
-
#webserv_base_cgi(opt = nil) ⇒ Object
web url for local webserv (localhost, or hostname).
-
#webserv_cgi(opt = nil) ⇒ Object
web url for local webserv (localhost, or hostname).
-
#webserv_dir ⇒ Object
fixed/hard path to /www web/presentation directory, on Debian /var/www subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name).
-
#webserv_files_from_db(opt = nil) ⇒ Object
-
#webserv_host_base(opt = nil) ⇒ Object
-
#webserv_image ⇒ Object
web/presentation directory, subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name).
-
#webserv_map_pwd ⇒ Object
-
#webserv_stub_ensure ⇒ Object
-
#widget ⇒ Object
-
#widget_static ⇒ Object
-
#www_browser ⇒ Object
-
#xml_docbook_ocn? ⇒ Boolean
-
#xml_editor ⇒ Object
-
#xml_fictionbook_ocn? ⇒ Boolean
-
#xml_scaffold_ocn? ⇒ Boolean
-
#xml_viewer ⇒ Object
-
#yamlrc ⇒ Object
#by?, #by_filename?, #by_filetype?, #by_language_code?, #default_language?, #document_language_versions_found, #dump?, #lang, #mono_multi_lingual?, #multilingual?, #output_dir_structure, #published_manifests?, #redirect?
Constructor Details
#initialize(fns = '', md = nil) ⇒ InfoEnv
Returns a new instance of InfoEnv.
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
# File 'lib/sisu/se_info_env.rb', line 79
def initialize(fns='',md=nil)
super() @init=SiSU_Env::GetInit.new @fns,@md=fns,md
@env=SiSU_Env::EnvCall.new(fns) if fns fnb=if @md \
and defined? @md.fnb
@md.fnb
elsif defined? @env.fnb \
and @env.fnb
@env.fnb
elsif @fns.is_a?(String) \
and not @fns.empty?
m=/(.+)?\.(?:(?:-|ssm\.)?sst|ssm)$/m
@fns[m,1] if not @fns.empty?
end
if fnb; @@fb ||=fnb
end
@sys=SiSU_Info_Sys::InfoSystem.instance
@fnb ||=@@fb @fixed_websev_root='' @pwd=@@pwd=Dir.pwd
@base_markup_dir_stub=SiSU_Utils::Path.new.base_markup_stub
@stub_src= @base_markup_dir_stub + '/src'
@stub_pod= @base_markup_dir_stub + '/pod'
@stub_epub= @base_markup_dir_stub + '/epub'
m=/.+\/(?:src\/)?(\S+)/m @stub_pwd=@@pwd[m,1] || '' pt=Pathname.new(Dir.pwd)
stub=if output_dir_structure.by_language_code?
r=Px[:lng_lst_rgx]
stub=if Dir.pwd =~/.+?\/([^\/]+)(?:\/(#{r})$)/
lng=pt.split[-1].to_s
lng_part='/' + lng
base=pt.split[0].split[-1].to_s
else
lng_part='/' + language_default_set
base=pt.split[-1].to_s
end
base + lng_part
elsif output_dir_structure.by_filetype?
pt.split[-1].to_s
elsif output_dir_structure.by_filename?
''
else
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
warn('set output type, by: language, filetype or filename')
end
@stub_set_manifest=stub + '/manifest'
end
|
Instance Attribute Details
#base_markup_dir_stub ⇒ Object
Returns the value of attribute base_markup_dir_stub.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def base_markup_dir_stub
@base_markup_dir_stub
end
|
#env ⇒ Object
Returns the value of attribute env.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def env
@env
end
|
#etc ⇒ Object
Returns the value of attribute etc.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def etc
@etc
end
|
#filename ⇒ Object
Returns the value of attribute filename.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def filename
@filename
end
|
#flv ⇒ Object
Returns the value of attribute flv.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def flv
@flv
end
|
#fnb ⇒ Object
Returns the value of attribute fnb.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def fnb
@fnb
end
|
#fnn ⇒ Object
Returns the value of attribute fnn.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def fnn
@fnn
end
|
#fnt ⇒ Object
Returns the value of attribute fnt.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def fnt
@fnt
end
|
#home ⇒ Object
Returns the value of attribute home.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def home
@home
end
|
#hostname ⇒ Object
Returns the value of attribute hostname.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def hostname
@hostname
end
|
#processing ⇒ Object
processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc)
1373
1374
1375
|
# File 'lib/sisu/se_info_env.rb', line 1373
def processing
@processing
end
|
#processing_git ⇒ Object
Returns the value of attribute processing_git.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def processing_git
@processing_git
end
|
#rc ⇒ Object
Returns the value of attribute rc.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def rc
@rc
end
|
#stub_pwd ⇒ Object
188
189
190
|
# File 'lib/sisu/se_info_env.rb', line 188
def stub_pwd
@stub_pwd
end
|
#stub_src ⇒ Object
Returns the value of attribute stub_src.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def stub_src
@stub_src
end
|
#sys ⇒ Object
Returns the value of attribute sys.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def sys
@sys
end
|
#user ⇒ Object
Returns the value of attribute user.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def user
@user
end
|
#webserv_host_cgi ⇒ Object
Returns the value of attribute webserv_host_cgi.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def webserv_host_cgi
@webserv_host_cgi
end
|
#webserv_path ⇒ Object
testing, check need, remove
1129
1130
1131
|
# File 'lib/sisu/se_info_env.rb', line 1129
def webserv_path
@webserv_path
end
|
#webserv_port_cgi(opt = nil) ⇒ Object
Returns the value of attribute webserv_port_cgi.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def webserv_port_cgi
@webserv_port_cgi
end
|
#www ⇒ Object
Returns the value of attribute www.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def www
@www
end
|
#yamlrc_dir ⇒ Object
Returns the value of attribute yamlrc_dir.
76
77
78
|
# File 'lib/sisu/se_info_env.rb', line 76
def yamlrc_dir
@yamlrc_dir
end
|
Instance Method Details
#ao ⇒ Object
1403
1404
1405
1406
1407
1408
1409
1410
1411
|
# File 'lib/sisu/se_info_env.rb', line 1403
def ao
pth=if defined? @rc['processing']['dal'] \
and @rc['processing']['dal'].is_a?(String)
"#{processing}/#{@rc['processing']['dal']}"
else "#{processing}/#{defaults[:processing_ao]}"
end
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
|
#arch ⇒ Object
138
139
140
|
# File 'lib/sisu/se_info_env.rb', line 138
def arch
@sys.arch
end
|
#asciidoc_ocn? ⇒ Boolean
551
552
553
554
555
556
|
# File 'lib/sisu/se_info_env.rb', line 551
def asciidoc_ocn?
((defined? @rc['asciidoc']['ocn']) \
&& @rc['asciidoc']['ocn']==true) \
? @rc['asciidoc']['ocn']
: false
end
|
#bin ⇒ Object
1096
1097
1098
|
# File 'lib/sisu/se_info_env.rb', line 1096
def bin
@sys.dir_bin
end
|
#build ⇒ Object
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
|
# File 'lib/sisu/se_info_env.rb', line 353
def build
def omit_list
@off_list ||=if defined? @rc['omit_list'] \
and @rc['omit_list'].is_a?(String)
@rc['omit_list']
elsif defined? @rc['omit']['list'] \
and @rc['omit']['list'].is_a?(String)
@rc['omit']['list']
else
nil
end
end
def listed?(test) listed=if omit_list
x=(omit_list.scan(/\b#{test}\b/)).join
test==x \
? true
: false
else
false
end
listed
end
def ocn?
if (defined? @rc['omit']['ocn'] \
and not @rc['omit']['ocn'].nil?) \
or listed?('ocn')
:off
else
:na
end
end
def toc?
if (defined? @rc['omit']['toc'] \
and not @rc['omit']['toc'].nil?) \
or listed?('toc')
:off
else
:na
end
end
def manifest?
if (defined? @rc['omit']['manifest'] \
and not @rc['omit']['manifest'].nil?) \
or listed?('manifest')
:off
else
:na
end
end
def links_to_manifest?
if (defined? @rc['omit']['links_to_manifest'] \
and not @rc['omit']['links_to_manifest'].nil?) \
or (listed?('links_to_manifest') \
|| listed?('manifest_links'))
:off
else
:na
end
end
def metadata?
if (defined? @rc['omit']['metadata'] \
and not @rc['omit']['metadata'].nil?) \
or listed?('metadata')
:off
else
:na
end
end
def minitoc?
if (defined? @rc['omit']['minitoc'] \
and not @rc['omit']['minitoc'].nil?) \
or (listed?('minitoc'))
:off
else
:na
end
end
def manifest_minitoc?
if (defined? @rc['omit']['manifest_minitoc'] \
and not @rc['omit']['manifest_minitoc'].nil?) \
or listed?('manifest_minitoc')
:off
else
:na
end
end
def html_minitoc?
if (defined? @rc['omit']['html_minitoc'] \
and not @rc['omit']['html_minitoc'].nil?) \
or (listed?('html_minitoc') \
|| listed?('minitoc'))
:off
else
:na
end
end
def html_navigation?
if (defined? @rc['omit']['html_navigation'] \
and not @rc['omit']['html_navigation'].nil?) \
or listed?('html_navigation')
:off
else
:na
end
end
def html_navigation_bar?
if (defined? @rc['omit']['html_navigation_bar'] \
and not @rc['omit']['html_navigation_bar'].nil?) \
or listed?('html_navigation_bar')
:off
else
:na
end
end
def segsubtoc?
if (defined? @rc['omit']['segsubtoc'] \
and not @rc['omit']['segsubtoc'].nil?) \
or listed?('segsubtoc')
:off
else
:na
end
end
def html_right_pane?
if (defined? @rc['omit']['html_right_pane'] \
and not @rc['omit']['html_right_pane'].nil?) \
or listed?('html_right_pane')
:off
else
:na
end
end
def html_top_band?
if (defined? @rc['omit']['html_top_band'] \
and not @rc['omit']['html_top_band'].nil?) \
or listed?('html_top_band')
:off
else
:na
end
end
def search_form? if (defined? @rc['omit']['search_form'] \
and not @rc['omit']['search_form'].nil?) \
or listed?('search_form')
:off
else
:na
end
end
def html_search_form? if (defined? @rc['omit']['html_search_form'] \
and not @rc['omit']['html_search_form'].nil?) \
or listed?('html_search_form')
:off
else
:na
end
end
self
end
|
#cgi ⇒ Object
1203
1204
1205
1206
1207
|
# File 'lib/sisu/se_info_env.rb', line 1203
def cgi
(defined? @rc['webserv']['cgi']) \
? "#{@rc['webserv']['cgi']}"
: (defaults[:webserv_cgi])
end
|
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
|
# File 'lib/sisu/se_info_env.rb', line 1745
def cgi_sample_search_form_name(opt=nil)
if opt.selections.str \
=~/--(?:cgi-)?search-form-name[=-]["']?(\S+?\.cgi)/
$1
elsif not opt.selections.str =~/--db[=-]["']?sqlite/ \
and defined? @rc['search'] \
and defined? @rc['search']['sisu'] \
and defined? @rc['search']['sisu']['action'] \
and @rc['search']['sisu']['action'] =~/https?:\/\/\S+?\.cgi/
/(?:https?:\/\/\S+?)\/([^\/]+?\.cgi)$/.
match(@rc['search']['sisu']['action'])[1]
else
(opt.selections.str =~/--db[=-]["']?sqlite/) \
? "#{Db[:name_prefix_db]}sqlite.cgi" \
: "#{Db[:name_prefix_db]}pg.cgi"
end
end
|
#cjk ⇒ Object
958
959
960
961
962
963
|
# File 'lib/sisu/se_info_env.rb', line 958
def cjk
(defined? @rc['default']['texpdf_fontface_cjk']) \
&& (@rc['default']['texpdf_fontface_cjk']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_cjk']
: 'IPAGothic' end
|
#cjk_ja ⇒ Object
970
971
972
973
974
975
|
# File 'lib/sisu/se_info_env.rb', line 970
def cjk_ja
(defined? @rc['default']['texpdf_fontface_cjk_ja']) \
&& (@rc['default']['texpdf_fontface_cjk_ja']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_cjk_ja']
: 'IPAGothic'
end
|
#cjk_ko ⇒ Object
976
977
978
979
980
981
|
# File 'lib/sisu/se_info_env.rb', line 976
def cjk_ko
(defined? @rc['default']['texpdf_fontface_cjk_ko']) \
&& (@rc['default']['texpdf_fontface_cjk_ko']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_cjk_ko']
: 'IPAGothic'
end
|
#cjk_zh ⇒ Object
‘IPAGothic’ # ‘IPAMincho’ # ‘TakaoMincho’ # ‘VL Gothic’
964
965
966
967
968
969
|
# File 'lib/sisu/se_info_env.rb', line 964
def cjk_zh
(defined? @rc['default']['texpdf_fontface_cjk_zh']) \
&& (@rc['default']['texpdf_fontface_cjk_zh']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_cjk_zh']
: 'IPAGothic'
end
|
#composite_file ⇒ Object
1421
1422
1423
1424
1425
|
# File 'lib/sisu/se_info_env.rb', line 1421
def composite_file
pth=processing_path.ao FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
|
#concord_max ⇒ Object
147
148
149
150
151
152
|
# File 'lib/sisu/se_info_env.rb', line 147
def concord_max
((defined? @rc['processing']['concord_max']) \
&& @rc['processing']['concord_max']) \
? @rc['processing']['concord_max']
: (defaults[:concord_max])
end
|
#console_web_browser ⇒ Object
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
|
# File 'lib/sisu/se_info_env.rb', line 1956
def console_web_browser
if defined? @rc['program_select']['console_www_browser'] \
and @rc['program_select']['console_www_browser'] =~/\S\S+/
@rc['program_select']['console_www_browser']
elsif defined? @rc['program_select']['console_web_browser'] \
and @rc['program_select']['console_web_browser'] =~/\S\S+/
@rc['program_select']['console_web_browser']
else 'console-www-browser' end
end
|
#console_www_browser ⇒ Object
1966
1967
1968
|
# File 'lib/sisu/se_info_env.rb', line 1966
def console_www_browser
web_browser
end
|
#current_document ⇒ Object
184
185
186
187
|
# File 'lib/sisu/se_info_env.rb', line 184
def current_document
@@current_document||=Dir.pwd
@@current_document
end
|
#defaults ⇒ Object
multiple default directories
324
325
326
|
# File 'lib/sisu/se_info_env.rb', line 324
def defaults @default_dir ||=@sys.default_dir end
|
#digest(opt = nil) ⇒ Object
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
|
# File 'lib/sisu/se_info_env.rb', line 1900
def digest(opt=nil)
@opt=opt
def type
if @opt
case @opt.act[:hash_digest_algo]
when :sha512 then :sha512
when :sha256 then :sha256
when :md5 then :md5
else digest_conf?
end
else digest_conf?
end
end
def length
case digest(@opt).type
when :sha512 then 128
when :sha256 then 64
when :md5 then 32
else 64
end
end
def pattern
"[0-9a-f]{#{digest(@opt).length}}" end
self
end
|
#digest_conf? ⇒ Boolean
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
|
# File 'lib/sisu/se_info_env.rb', line 1888
def digest_conf?
if defined? @rc['default']['digest'] \
and @rc['default']['digest'] != nil
case @rc['default']['digest']
when /^sha(?:5|512)?$/ then :sha512
when /^sha(?:2|256)?$/ then :sha256
when /^md5$/ then :md5
else :sha256
end
else :sha256
end
end
|
#dir_url ⇒ Object
1565
1566
1567
|
# File 'lib/sisu/se_info_env.rb', line 1565
def dir_url
"file://#{path.webserv}/#{stub_pwd}"
end
|
#docbook_viewer ⇒ Object
1981
1982
1983
1984
1985
1986
|
# File 'lib/sisu/se_info_env.rb', line 1981
def docbook_viewer
((defined? @rc['program_select']['xml_viewer']) \
&& @rc['program_select']['xml_viewer'] =~/\S\S+/) \
? @rc['program_select']['xml_viewer']
: text_editor
end
|
#encoding ⇒ Object
1271
1272
1273
1274
1275
|
# File 'lib/sisu/se_info_env.rb', line 1271
def encoding
pth="#{processing}/#{defaults[:processing_encoding]}"
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
|
#epub ⇒ Object
1471
1472
1473
|
# File 'lib/sisu/se_info_env.rb', line 1471
def epub
"#{processing}/epub/#{@fnb}"
end
|
#epub_bld ⇒ Object
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
|
# File 'lib/sisu/se_info_env.rb', line 1474
def epub_bld FileUtils::rm_rf(processing_path.epub) \
if FileTest.directory?(processing_path.epub)
FileUtils::mkdir_p(processing_path.epub) \
unless FileTest.directory?(processing_path.epub)
FileUtils::mkdir_p("#{processing_path.epub}/META-INF") \
unless FileTest.directory?("#{processing_path.epub}/META-INF")
FileUtils::mkdir_p("#{processing_path.epub}/#{Ep[:d_oebps]}/image") \
unless FileTest.directory?("#{processing_path.epub}/#{Ep[:d_oebps]}/image")
FileUtils::mkdir_p("#{processing_path.epub}/#{Ep[:d_oebps]}/css") \
unless FileTest.directory?("#{processing_path.epub}/#{Ep[:d_oebps]}/css")
processing_path.epub
end
|
#epub_cp_images(md) ⇒ Object
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
|
# File 'lib/sisu/se_info_env.rb', line 1487
def epub_cp_images(md)
pth="#{processing_path.epub}/#{Ep[:d_oebps]}/image"
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
src=(md.opt.sisu_install_type? == :full_path_to_sisu_bin_in_sisu_dir_tree) \
? "#{md.opt.sisu_data_dir?}/image"
: "#{md.opt.sisu_data_dir?}/sisu/image"
images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png]
images.each do |i| if FileTest.file?("#{src}/#{i}")
FileUtils::cp("#{src}/#{i}","#{pth}/#{i}") \
unless FileTest.file?("#{pth}/#{i}")
else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]}
end
end
pth
end
|
#epub_viewer ⇒ Object
1969
1970
1971
1972
1973
1974
|
# File 'lib/sisu/se_info_env.rb', line 1969
def epub_viewer
((defined? @rc['program_select']['epub_viewer']) \
&& @rc['program_select']['epub_viewer'] =~/\S\S+/) \
? @rc['program_select']['epub_viewer']
: 'ebook-viewer' end
|
#feed ⇒ Object
1190
1191
1192
1193
1194
|
# File 'lib/sisu/se_info_env.rb', line 1190
def feed
(defined? @rc['webserv']['feed']) \
? ("#{public_output}/#{@rc['webserv']['feed']}")
: (defaults[:webserv_feed])
end
|
#feed_home ⇒ Object
1195
1196
1197
|
# File 'lib/sisu/se_info_env.rb', line 1195
def feed_home
"#{public_output}/#{@rc['webserv']['feed_home']}"
end
|
#fictionbook_viewer ⇒ Object
1987
1988
1989
1990
1991
1992
|
# File 'lib/sisu/se_info_env.rb', line 1987
def fictionbook_viewer
((defined? @rc['program_select']['xml_viewer']) \
&& @rc['program_select']['xml_viewer'] =~/\S\S+/) \
? @rc['program_select']['xml_viewer']
: text_editor
end
|
#file_encoding ⇒ Object
‘pinfo -f’ ‘info’ ‘tkinfo’
2017
2018
2019
2020
2021
|
# File 'lib/sisu/se_info_env.rb', line 2017
def file_encoding
is=(defined? @rc['program_set']['file_encoding']) \
? @rc['program_set']['encoding'] : ''
(is.nil? || is==true) ? 'encoding' : is
end
|
#font ⇒ Object
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
|
# File 'lib/sisu/se_info_env.rb', line 920
def font
def size(pt=nil)
if pt && pt != :na
pt
elsif defined? @rc['default']['fontsize'] \
&& @rc['default']['fontsize']=~/\d{1,2}/
@rc['default']['fontsize']
else :na
end
end
def texpdf
def main
(defined? @rc['default']['texpdf_fontface']) \
&& (@rc['default']['texpdf_fontface']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface']
: 'Liberation Sans'
end
def sans (defined? @rc['default']['texpdf_fontface_sans']) \
&& (@rc['default']['texpdf_fontface_sans']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_sans']
: 'Liberation Sans'
end
def serif (defined? @rc['default']['texpdf_fontface_serif']) \
&& (@rc['default']['texpdf_font_serif']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_serif']
: 'Liberation Serif'
end
def mono
(defined? @rc['default']['texpdf_fontface_mono']) \
&& (@rc['default']['texpdf_fontface_mono']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_mono']
: 'Liberation Mono'
end
def cjk
(defined? @rc['default']['texpdf_fontface_cjk']) \
&& (@rc['default']['texpdf_fontface_cjk']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_cjk']
: 'IPAGothic' end
def cjk_zh
(defined? @rc['default']['texpdf_fontface_cjk_zh']) \
&& (@rc['default']['texpdf_fontface_cjk_zh']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_cjk_zh']
: 'IPAGothic'
end
def cjk_ja
(defined? @rc['default']['texpdf_fontface_cjk_ja']) \
&& (@rc['default']['texpdf_fontface_cjk_ja']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_cjk_ja']
: 'IPAGothic'
end
def cjk_ko
(defined? @rc['default']['texpdf_fontface_cjk_ko']) \
&& (@rc['default']['texpdf_fontface_cjk_ko']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_cjk_ko']
: 'IPAGothic'
end
def size(pt=nil)
if pt && pt != :na
pt
elsif (defined? @rc['default']['texpdf_fontsize']) \
&& (@rc['default']['texpdf_fontsize']=~/\d{1,2}/)
@rc['default']['texpdf_fontsize']
elsif (defined? @rc['default']['fontsize']) \
&& (@rc['default']['fontsize']=~/\d{1,2}/)
@rc['default']['fontsize']
else
:na
end
end
self
end
self
end
|
#git ⇒ Object
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
|
# File 'lib/sisu/se_info_env.rb', line 1426
def git
pth=if defined? @rc['git']['dir'] \
and @rc['git']['dir'].is_a?(String)
(@rc['git']['dir'] =~/^(?:~|home)$/) \
? home + '/' + Gt[:git]
: @rc['git']['dir'] + '/' + Gt[:git]
else defaults[:processing_git]
end
unless FileTest.directory?(pth)
FileUtils::mkdir_p(pth)
File.chmod(0700,pth)
end
pth
end
|
#host ⇒ Object
135
136
137
|
# File 'lib/sisu/se_info_env.rb', line 135
def host
@sys.host
end
|
#html ⇒ Object
1590
1591
1592
|
# File 'lib/sisu/se_info_env.rb', line 1590
def html
"#{root}/html"
end
|
#html_minitoc? ⇒ Boolean
339
340
341
342
343
344
345
|
# File 'lib/sisu/se_info_env.rb', line 339
def html_minitoc?
if defined? @rc['html']['minitoc'] \
and @rc['html']['minitoc'].is_a?(String)
@rc['html']['minitoc']
else false
end
end
|
#html_navigation? ⇒ Boolean
450
451
452
453
454
455
456
457
458
|
# File 'lib/sisu/se_info_env.rb', line 450
def html_navigation?
if (defined? @rc['omit']['html_navigation'] \
and not @rc['omit']['html_navigation'].nil?) \
or listed?('html_navigation')
:off
else
:na
end
end
|
#html_navigation_bar? ⇒ Boolean
459
460
461
462
463
464
465
466
467
|
# File 'lib/sisu/se_info_env.rb', line 459
def html_navigation_bar?
if (defined? @rc['omit']['html_navigation_bar'] \
and not @rc['omit']['html_navigation_bar'].nil?) \
or listed?('html_navigation_bar')
:off
else
:na
end
end
|
#html_quick_ref? ⇒ Boolean
333
334
335
336
337
338
|
# File 'lib/sisu/se_info_env.rb', line 333
def html_quick_ref?
((defined? @rc['html']['quick_ref']) \
&& @rc['html']['quick_ref']==true) \
? @rc['html']['quick_ref']
: false
end
|
#html_right_pane? ⇒ Boolean
477
478
479
480
481
482
483
484
485
|
# File 'lib/sisu/se_info_env.rb', line 477
def html_right_pane?
if (defined? @rc['omit']['html_right_pane'] \
and not @rc['omit']['html_right_pane'].nil?) \
or listed?('html_right_pane')
:off
else
:na
end
end
|
1018
1019
1020
1021
1022
1023
1024
1025
1026
|
# File 'lib/sisu/se_info_env.rb', line 1018
def html_scroll_1
if @env.output_dir_structure.by_language_code?
'../'
elsif @env.output_dir_structure.by_filetype?
'../'
else
'./'
end
end
|
1000
1001
1002
1003
1004
1005
1006
1007
1008
|
# File 'lib/sisu/se_info_env.rb', line 1000
def html_scroll_2
if @env.output_dir_structure.by_language_code?
'../../'
elsif @env.output_dir_structure.by_filetype?
'../'
else
'../'
end
end
|
decide later, as is configured here (in sisurc) and can be turned off on command line
504
505
506
507
508
509
510
511
512
|
# File 'lib/sisu/se_info_env.rb', line 504
def html_search_form? if (defined? @rc['omit']['html_search_form'] \
and not @rc['omit']['html_search_form'].nil?) \
or listed?('html_search_form')
:off
else
:na
end
end
|
#html_seg_1 ⇒ Object
1027
1028
1029
1030
1031
1032
1033
1034
1035
|
# File 'lib/sisu/se_info_env.rb', line 1027
def html_seg_1
if @env.output_dir_structure.by_language_code?
'../../'
elsif @env.output_dir_structure.by_filetype?
'../../'
else
'./'
end
end
|
#html_seg_2 ⇒ Object
1009
1010
1011
1012
1013
1014
1015
1016
1017
|
# File 'lib/sisu/se_info_env.rb', line 1009
def html_seg_2
if @env.output_dir_structure.by_language_code?
'../../../'
elsif @env.output_dir_structure.by_filetype?
'../../'
else
'../'
end
end
|
#html_seg_title_banner? ⇒ Boolean
327
328
329
330
331
332
|
# File 'lib/sisu/se_info_env.rb', line 327
def html_seg_title_banner?
((defined? @rc['html']['seg_title_banner']) \
&& @rc['html']['seg_title_banner']==true) \
? @rc['html']['seg_title_banner']
: false
end
|
#html_top_band? ⇒ Boolean
486
487
488
489
490
491
492
493
494
|
# File 'lib/sisu/se_info_env.rb', line 486
def html_top_band?
if (defined? @rc['omit']['html_top_band'] \
and not @rc['omit']['html_top_band'].nil?) \
or listed?('html_top_band')
:off
else
:na
end
end
|
#i18n ⇒ Object
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
|
# File 'lib/sisu/se_info_env.rb', line 2059
def i18n
def language m=/.+\/\S+?\~(\S+)/
pwd=Dir.pwd
conf=(defined? @rc['default']['language']) \
? @rc['default']['language'] : nil
l=if pwd=~ m then pwd[m,1] elsif conf then @rc['default']['language'] else defaults[:language] end SiSU_Env::StandardiseLanguage.new(l)
end
def lang_filename(l)
@lang={}
x=if output_dir_structure.by_language_code?
(( defined? @rc['default']['language_file']) \
&& @rc['default']['language_file'] != nil) \
? @rc['default']['language_file']
: 1
else 0
end
if (l != defaults[:language_code]) \
or (language.code != defaults[:language_code]) if x==1 then @lang[:pre],@lang[:mid],@lang[:post]="#{l}.",'',''
elsif x==2 then @lang[:pre],@lang[:mid],@lang[:post]='',".#{l}",''
elsif x==3 then @lang[:pre],@lang[:mid],@lang[:post]='','',".#{l}"
else @lang[:pre],@lang[:mid],@lang[:post]='','',''
end
else @lang[:pre],@lang[:mid],@lang[:post]='','',''
end
@lang
end
self
end
|
#image_external ⇒ Object
1255
1256
1257
|
# File 'lib/sisu/se_info_env.rb', line 1255
def image_external
"#{processing}/external_document/image"
end
|
#image_source(md = nil) ⇒ Object
image repository source directory
1229
1230
1231
1232
1233
1234
1235
1236
1237
|
# File 'lib/sisu/se_info_env.rb', line 1229
def image_source(md=nil) if defined? @rc['image']['path'] \
and defined? @rc['image']['public']
pth="#{@rc['image']['path']}"
"#{pth}/#{@rc['image']['public']}"
else
image_source_sisu_includes(md)
end
end
|
#image_source_include(md = nil) ⇒ Object
image repository source directory
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
|
# File 'lib/sisu/se_info_env.rb', line 1238
def image_source_include(md=nil) if defined? @rc['image']['path'] \
and defined? @rc['image']['public'] \
and FileTest.directory?(
"#{@rc['image']['path']}/#{@rc['image']['public']}"
)==true
"#{@rc['image']['path']}/#{@rc['image']['public']}"
elsif FileTest.directory?("#{@@pwd}/#{defaults[:image_stub]}")==true
"#{@@pwd}/#{defaults[:image_stub]}"
elsif FileTest.directory?(
"#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}"
)==true
"#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}"
else
image_source_sisu_includes(md)
end
end
|
#image_source_include_local ⇒ Object
1258
1259
1260
1261
1262
|
# File 'lib/sisu/se_info_env.rb', line 1258
def image_source_include_local
if FileTest.directory?(defaults[:image_local])
defaults[:image_local]
end
end
|
#image_source_include_remote ⇒ Object
1263
1264
1265
1266
1267
|
# File 'lib/sisu/se_info_env.rb', line 1263
def image_source_include_remote
if FileTest.directory?(image_external)
image_external
end
end
|
#image_source_sisu_includes(md = nil) ⇒ Object
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
|
# File 'lib/sisu/se_info_env.rb', line 1217
def image_source_sisu_includes(md=nil)
if md \
and (md.opt.sisu_install_type? == \
:full_path_to_sisu_bin_in_sisu_dir_tree) \
and FileTest.directory?(
"#{md.opt.sisu_data_dir?}/image"
)==true
"#{md.opt.sisu_data_dir?}/image"
else
"#{share}/image"
end
end
|
#images ⇒ Object
1789
1790
1791
|
# File 'lib/sisu/se_info_env.rb', line 1789
def images
"#{Xx[:html_relative2]}/_sisu/image"
end
|
#images_epub ⇒ Object
1836
1837
1838
|
# File 'lib/sisu/se_info_env.rb', line 1836
def images_epub
'./image'
end
|
#images_external ⇒ Object
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
|
# File 'lib/sisu/se_info_env.rb', line 1811
def images_external
if FileTest.directory?(image_external)
if @@image_flag
images=Dir.glob("#{image_external}/*.{png,jpg,gif}")
pth=path.webserv + '/' \
+ @stub_pwd
FileUtils::mkdir_p("#{pth}/_sisu/image_external") \
unless FileTest.directory?("#{pth}/_sisu/image_external")
images.each { |i| File.install(i,"#{pth}/#{i}") } \
unless images.length > 0
@@image_flag=false
end
"#{Xx[:html_relative2]}/_sisu/image_external"
else
if @@local_image==true
SiSU_Screen::Ansi.new(
@cmd,
'WARNING - image directory for external images or no such images:',
:image_external
).warn unless @md.opt.act[:quiet][:set]==:on
@@local_image=false
end
url.images_external
end
end
|
#images_local ⇒ Object
def images
'../_sisu/image'
end
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
|
# File 'lib/sisu/se_info_env.rb', line 1795
def images_local
if FileTest.directory?(path.image_source_include)
path.image_source_include
else
if @@local_image==true
cmd=@md.opt.selections.str ? @md.opt.selections.str : ''
SiSU_Screen::Ansi.new(
cmd,
"WARNING - no local image directory or images:",
defaults[:image_local]
).warn unless @md.opt.act[:quiet][:set]==:on
@@local_image=false
end
url.images
end
end
|
#landscape ⇒ Object
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
|
# File 'lib/sisu/se_info_env.rb', line 888
def landscape
if @cli != :na
@cli
elsif (defined? @rc['default']['pdf_hyperlinks_landscape']) \
&& (@rc['default']['pdf_hyperlinks_landscape']=~/color/)
:color
elsif (defined? @rc['default']['pdf_hyperlinks_landscape']) \
&& (@rc['default']['pdf_hyperlinks_landscape'] \
=~/(?:no-color|color-off|mono(?:chrome)?)/)
:mono
elsif @hyplnks != :na
@hyplnks
else :na
end
end
|
#lang_filename(l) ⇒ Object
def multilingual
x=(defined? @rc['output_structure']['multilingual'] \
&& @rc['output_structure']['multilingual'] ==true) \
? true : false
end def bundle
x=(defined? @rc['output_structure']['bundle'] \
&& @rc['output_structure']['bundle'] ==true) \
? true : false
end
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
|
# File 'lib/sisu/se_info_env.rb', line 2081
def lang_filename(l)
@lang={}
x=if output_dir_structure.by_language_code?
(( defined? @rc['default']['language_file']) \
&& @rc['default']['language_file'] != nil) \
? @rc['default']['language_file']
: 1
else 0
end
if (l != defaults[:language_code]) \
or (language.code != defaults[:language_code]) if x==1 then @lang[:pre],@lang[:mid],@lang[:post]="#{l}.",'',''
elsif x==2 then @lang[:pre],@lang[:mid],@lang[:post]='',".#{l}",''
elsif x==3 then @lang[:pre],@lang[:mid],@lang[:post]='','',".#{l}"
else @lang[:pre],@lang[:mid],@lang[:post]='','',''
end
else @lang[:pre],@lang[:mid],@lang[:post]='','',''
end
@lang
end
|
#language ⇒ Object
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
|
# File 'lib/sisu/se_info_env.rb', line 2060
def language m=/.+\/\S+?\~(\S+)/
pwd=Dir.pwd
conf=(defined? @rc['default']['language']) \
? @rc['default']['language'] : nil
l=if pwd=~ m then pwd[m,1] elsif conf then @rc['default']['language'] else defaults[:language] end SiSU_Env::StandardiseLanguage.new(l)
end
|
#language_default_set ⇒ Object
set directory (default) language
153
154
155
156
157
158
|
# File 'lib/sisu/se_info_env.rb', line 153
def language_default_set ((defined? @rc['default']['language']) \
&& @rc['default']['language'] =~/\S+/) \
? @rc['default']['language']
: 'en'
end
|
#length ⇒ Object
1913
1914
1915
1916
1917
1918
1919
1920
|
# File 'lib/sisu/se_info_env.rb', line 1913
def length
case digest(@opt).type
when :sha512 then 128
when :sha256 then 64
when :md5 then 32
else 64
end
end
|
#links_to_manifest? ⇒ Boolean
403
404
405
406
407
408
409
410
411
412
|
# File 'lib/sisu/se_info_env.rb', line 403
def links_to_manifest?
if (defined? @rc['omit']['links_to_manifest'] \
and not @rc['omit']['links_to_manifest'].nil?) \
or (listed?('links_to_manifest') \
|| listed?('manifest_links'))
:off
else
:na
end
end
|
#listed?(test) ⇒ Boolean
365
366
367
368
369
370
371
372
373
374
375
|
# File 'lib/sisu/se_info_env.rb', line 365
def listed?(test) listed=if omit_list
x=(omit_list.scan(/\b#{test}\b/)).join
test==x \
? true
: false
else
false
end
listed
end
|
#local ⇒ Object
1571
1572
1573
|
# File 'lib/sisu/se_info_env.rb', line 1571
def local
"http://#{hostname}/#{@stub_pwd}"
end
|
#locale ⇒ Object
144
145
146
|
# File 'lib/sisu/se_info_env.rb', line 144
def locale
@sys.locale
end
|
#localhost ⇒ Object
1568
1569
1570
|
# File 'lib/sisu/se_info_env.rb', line 1568
def localhost
"http://localhost/#{stub_pwd}"
end
|
#lout ⇒ Object
1527
1528
1529
1530
1531
1532
1533
1534
1535
|
# File 'lib/sisu/se_info_env.rb', line 1527
def lout
pth=if defined? @rc['processing']['lout'] \
and @rc['processing']['lout'].is_a?(String)
"#{processing}/#{@rc['processing']['lout']}"
else "#{processing}/#{defaults[:processing_lout]}"
end
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
|
#main ⇒ Object
you may wish to check selected font against available fonts: fc-list :outline -f “%familyn” fc-list :lang=ja
934
935
936
937
938
939
|
# File 'lib/sisu/se_info_env.rb', line 934
def main
(defined? @rc['default']['texpdf_fontface']) \
&& (@rc['default']['texpdf_fontface']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface']
: 'Liberation Sans'
end
|
#make ⇒ Object
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
|
# File 'lib/sisu/se_info_env.rb', line 1342
def make
unless FileTest.directory?(root_dir)
FileUtils::mkdir_p(root_dir)
File.chmod(0777,root_dir)
end
if usr_dir?
processing_path_usr="#{root_dir}/#{user}"
FileUtils::mkdir_p(processing_path_usr) \
unless FileTest.directory?(processing_path_usr)
File.chmod(0700,processing_path_usr)
end
sisupod_processing_path=paths[:sisupod]
FileUtils::mkdir_p(sisupod_processing_path) \
unless FileTest.directory?(sisupod_processing_path)
sisupod_processing_path_lng=if defined? @opt.lng
sisupod_processing_path \
+ '/' + Gt[:doc] \
+ '/' + @opt.lng
else
sisupod_processing_path \
+ '/' + Gt[:doc]
end
unless FileTest.directory?(sisupod_processing_path_lng)
FileUtils::mkdir_p(sisupod_processing_path_lng)
File.chmod(0700,sisupod_processing_path_lng)
end
sisupod_processing_path
end
|
#man ⇒ Object
1124
1125
1126
1127
1128
|
# File 'lib/sisu/se_info_env.rb', line 1124
def man (defined? @rc['webserv']['man']) \
? "#{webserv}/#{@rc['webserv']['man']}"
: defaults[:webserv_man]
end
|
#manifest? ⇒ Boolean
394
395
396
397
398
399
400
401
402
|
# File 'lib/sisu/se_info_env.rb', line 394
def manifest?
if (defined? @rc['omit']['manifest'] \
and not @rc['omit']['manifest'].nil?) \
or listed?('manifest')
:off
else
:na
end
end
|
#manifest_minitoc? ⇒ Boolean
346
347
348
349
350
351
352
|
# File 'lib/sisu/se_info_env.rb', line 346
def manifest_minitoc?
if defined? @rc['manifest']['minitoc'] \
and @rc['manifest']['minitoc'].is_a?(String)
@rc['manifest']['minitoc']
else false
end
end
|
#manpage ⇒ Object
1524
1525
1526
|
# File 'lib/sisu/se_info_env.rb', line 1524
def manpage
"#{path.output}/man"
end
|
#manpage_generator ⇒ Object
2005
2006
2007
2008
2009
2010
|
# File 'lib/sisu/se_info_env.rb', line 2005
def manpage_generator
((defined? @rc['program_select']['man']) \
&& @rc['program_select']['man'] =~/\S\S+/) \
? @rc['program_select']['man']
: 'nroff -man' end
|
#manpage_viewer ⇒ Object
2002
2003
2004
|
# File 'lib/sisu/se_info_env.rb', line 2002
def manpage_viewer
'man'
end
|
#markdown_ocn? ⇒ Boolean
557
558
559
560
561
562
|
# File 'lib/sisu/se_info_env.rb', line 557
def markdown_ocn?
((defined? @rc['markdown']['ocn']) \
&& @rc['markdown']['ocn']==true) \
? @rc['markdown']['ocn']
: false
end
|
#markup_emphasis ⇒ Object
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
# File 'lib/sisu/se_info_env.rb', line 159
def markup_emphasis
if defined? @rc['default']['emphasis'] \
and @rc['default']['emphasis'] \
and @rc['default']['emphasis']=~/bold/
'bold'
elsif defined? @rc['default']['emphasis'] \
and @rc['default']['emphasis'] \
and @rc['default']['emphasis']=~/italic/
'italics'
elsif defined? @rc['default']['emphasis'] \
and @rc['default']['emphasis'] \
and @rc['default']['emphasis']=~/underscore/
'underscore'
else 'bold'
end
end
|
413
414
415
416
417
418
419
420
421
|
# File 'lib/sisu/se_info_env.rb', line 413
def metadata?
if (defined? @rc['omit']['metadata'] \
and not @rc['omit']['metadata'].nil?) \
or listed?('metadata')
:off
else
:na
end
end
|
#minitoc? ⇒ Boolean
422
423
424
425
426
427
428
429
430
|
# File 'lib/sisu/se_info_env.rb', line 422
def minitoc?
if (defined? @rc['omit']['minitoc'] \
and not @rc['omit']['minitoc'].nil?) \
or (listed?('minitoc'))
:off
else
:na
end
end
|
#mono ⇒ Object
952
953
954
955
956
957
|
# File 'lib/sisu/se_info_env.rb', line 952
def mono
(defined? @rc['default']['texpdf_fontface_mono']) \
&& (@rc['default']['texpdf_fontface_mono']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_mono']
: 'Liberation Mono'
end
|
#ocn? ⇒ Boolean
376
377
378
379
380
381
382
383
384
|
# File 'lib/sisu/se_info_env.rb', line 376
def ocn?
if (defined? @rc['omit']['ocn'] \
and not @rc['omit']['ocn'].nil?) \
or listed?('ocn')
:off
else
:na
end
end
|
#odf ⇒ Object
1444
1445
1446
|
# File 'lib/sisu/se_info_env.rb', line 1444
def odf
odt
end
|
#odf_pth ⇒ Object
1440
1441
1442
1443
|
# File 'lib/sisu/se_info_env.rb', line 1440
def odf_pth
pth="#{processing}/odf/#{@fns}"
pth
end
|
#odf_viewer ⇒ Object
1996
1997
1998
1999
2000
2001
|
# File 'lib/sisu/se_info_env.rb', line 1996
def odf_viewer
((defined? @rc['program_select']['odf_viewer']) \
&& @rc['program_select']['odf_viewer'] =~/\S\S+/) \
? @rc['program_select']['odf_viewer']
: 'lowriter' end
|
#odt ⇒ Object
1447
1448
1449
1450
1451
|
# File 'lib/sisu/se_info_env.rb', line 1447
def odt
pth=odf_pth + '/odt'
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
|
#odt_bld ⇒ Object
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
|
# File 'lib/sisu/se_info_env.rb', line 1457
def odt_bld
FileUtils::rm_rf(processing_path.odt)
FileUtils::mkdir_p(processing_path.odt) \
unless FileTest.directory?(processing_path.odt)
FileUtils::mkdir_p("#{processing_path.odt}/Configurations2") \
unless FileTest.directory?("#{processing_path.odt}/Configurations2")
FileUtils::mkdir_p("#{processing_path.odt}/META-INF") \
unless FileTest.directory?("#{processing_path.odt}/META-INF")
FileUtils::mkdir_p("#{processing_path.odt}/Pictures") \
unless FileTest.directory?("#{processing_path.odt}/Pictures")
FileUtils::mkdir_p("#{processing_path.odt}/Thumbnails") \
unless FileTest.directory?("#{processing_path.odt}/Thumbnails")
processing_path.odt
end
|
#odt_ocn? ⇒ Boolean
515
516
517
518
519
520
|
# File 'lib/sisu/se_info_env.rb', line 515
def odt_ocn?
((defined? @rc['odt']['ocn']) \
&& @rc['odt']['ocn']==false) \
? @rc['odt']['ocn']
: true
end
|
#omit_list ⇒ Object
354
355
356
357
358
359
360
361
362
363
364
|
# File 'lib/sisu/se_info_env.rb', line 354
def omit_list
@off_list ||=if defined? @rc['omit_list'] \
and @rc['omit_list'].is_a?(String)
@rc['omit_list']
elsif defined? @rc['omit']['list'] \
and @rc['omit']['list'].is_a?(String)
@rc['omit']['list']
else
nil
end
end
|
#orgmode_ocn? ⇒ Boolean
569
570
571
572
573
574
|
# File 'lib/sisu/se_info_env.rb', line 569
def orgmode_ocn?
((defined? @rc['orgmode']['ocn']) \
&& @rc['orgmode']['ocn']==true) \
? @rc['orgmode']['ocn']
: false
end
|
#output ⇒ Object
web/webserv output directory… subdirectory into which further subdirectories are made based on file names
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
|
# File 'lib/sisu/se_info_env.rb', line 1180
def output r=Px[:lng_lst_rgx]
u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/
base_stub=@sys.pwd.gsub(u,'\1')
if Dir.pwd =~/\/#{Gt[:sisupod]}\/[^\/]+\/#{Gt[:pod]}\/#{Gt[:doc]}/
"#{path.webserv}/#{Gt[:doc]}"
else
"#{path.webserv}/#{base_stub}"
end
end
|
#output_tell ⇒ Object
1214
1215
1216
|
# File 'lib/sisu/se_info_env.rb', line 1214
def output_tell
url.webserv_map_pwd
end
|
#papersize ⇒ Object
paper settings, default overidden in param if set within document
2114
2115
2116
2117
2118
|
# File 'lib/sisu/se_info_env.rb', line 2114
def papersize (defined? @rc['default']['papersize']) \
? @rc['default']['papersize'].downcase
: (defaults[:papersize].downcase)
end
|
#path ⇒ Object
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
|
# File 'lib/sisu/se_info_env.rb', line 1062
def path def home
@sys.home
end
def sisurc_path
SiSU_Get_Init::GetInit.new.sisu_yaml.rc_path
end
def pwd
@sys.pwd
end
def stub_pwd
@stub_pwd
end
def base_markup_dir_stub
@base_markup_dir_stub
end
def stub_epub
@stub_epub
end
def stub_src
@stub_src
end
def stub_pod
@stub_pod
end
def etc
defaults[:sisu_etc] end
def arch
@sys.dir_arch
end
def sitearch
@sys.dir_sitearch
end
def bin
@sys.dir_bin
end
def share defaults[:sisu_share]
end
def style
if @md \
&& ((@md.opt.opt_act[:dump][:bool] \
&& @md.opt.opt_act[:dump][:inst]) \
|| (@md.opt.opt_act[:redirect][:bool] \
&& @md.opt.opt_act[:redirect][:inst]))
'css'
else
defaults[:stylesheet_stub]
end
end
def sample_data defaults[:sample_data_path]
end
def rc
@init.rc_path
end
def yamlrc
GetInit.new.sisu_yaml.rc_path
end
def man (defined? @rc['webserv']['man']) \
? "#{webserv}/#{@rc['webserv']['man']}"
: defaults[:webserv_man]
end
def webserv_path webserv
end
def webserv 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
end
man_path_head=man_path.gsub(/(\S+)\/[^\/\s]+$/,'\1')
unless FileTest.directory?(man_path)
FileUtils::mkdir_p(man_path) if File.writable?("#{man_path_head}/.")
end
@webserv_path=if defined? man_path \
and File.writable?("#{man_path}/.")
man_path elsif FileTest.directory?(defaults[:webserv_path]) \
and File.writable?("#{defaults[:webserv_path]}/.") defaults[:webserv_path]
else unless FileTest.directory?(defaults[:output_local])
FileUtils::mkdir_p(defaults[:output_local])
end
defaults[:output_local]
end
end
def webserv_stub_ensure
FileUtils::mkdir_p(path.webserv) unless FileTest.directory?(path.webserv)
FileUtils::mkdir_p("#{path.webserv}/#{@base_markup_dir_stub}") \
unless FileTest.directory?("#{path.webserv}/#{@base_markup_dir_stub}")
end
def webserv_map_pwd "#{path.webserv}/#{base_markup_dir_stub}"
end
def webserv_dir defaults[:webserv_dir]
end
def webserv_image images=if defined? @rc['webserv']['images']
@rc['webserv']['images']
else defaults[:images]
end
"#{path.webserv}/#{images}"
end
def output r=Px[:lng_lst_rgx]
u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/
base_stub=@sys.pwd.gsub(u,'\1')
if Dir.pwd =~/\/#{Gt[:sisupod]}\/[^\/]+\/#{Gt[:pod]}\/#{Gt[:doc]}/
"#{path.webserv}/#{Gt[:doc]}"
else
"#{path.webserv}/#{base_stub}"
end
end
def feed
(defined? @rc['webserv']['feed']) \
? ("#{public_output}/#{@rc['webserv']['feed']}")
: (defaults[:webserv_feed])
end
def feed_home
"#{public_output}/#{@rc['webserv']['feed_home']}"
end
def scripts if defined? @rc['project']['path']
"#{home}/#{@rc['project']['path']}"
end
end
def cgi
(defined? @rc['webserv']['cgi']) \
? "#{@rc['webserv']['cgi']}"
: (defaults[:webserv_cgi])
end
def php
(defined? @rc['webserv']['php']) \
? "#{public_output}/#{@rc['webserv']['php']}"
: (defaults[:webserv_php])
end
def output_tell
url.webserv_map_pwd
end
def image_source_sisu_includes(md=nil)
if md \
and (md.opt.sisu_install_type? == \
:full_path_to_sisu_bin_in_sisu_dir_tree) \
and FileTest.directory?(
"#{md.opt.sisu_data_dir?}/image"
)==true
"#{md.opt.sisu_data_dir?}/image"
else
"#{share}/image"
end
end
def image_source(md=nil) if defined? @rc['image']['path'] \
and defined? @rc['image']['public']
pth="#{@rc['image']['path']}"
"#{pth}/#{@rc['image']['public']}"
else
image_source_sisu_includes(md)
end
end
def image_source_include(md=nil) if defined? @rc['image']['path'] \
and defined? @rc['image']['public'] \
and FileTest.directory?(
"#{@rc['image']['path']}/#{@rc['image']['public']}"
)==true
"#{@rc['image']['path']}/#{@rc['image']['public']}"
elsif FileTest.directory?("#{@@pwd}/#{defaults[:image_stub]}")==true
"#{@@pwd}/#{defaults[:image_stub]}"
elsif FileTest.directory?(
"#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}"
)==true
"#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}"
else
image_source_sisu_includes(md)
end
end
def image_external
"#{processing}/external_document/image"
end
def image_source_include_local
if FileTest.directory?(defaults[:image_local])
defaults[:image_local]
end
end
def image_source_include_remote
if FileTest.directory?(image_external)
image_external
end
end
self
end
|
#path_rel_links ⇒ Object
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
|
# File 'lib/sisu/se_info_env.rb', line 999
def path_rel_links
def html_scroll_2
if @env.output_dir_structure.by_language_code?
'../../'
elsif @env.output_dir_structure.by_filetype?
'../'
else
'../'
end
end
def html_seg_2
if @env.output_dir_structure.by_language_code?
'../../../'
elsif @env.output_dir_structure.by_filetype?
'../../'
else
'../'
end
end
def html_scroll_1
if @env.output_dir_structure.by_language_code?
'../'
elsif @env.output_dir_structure.by_filetype?
'../'
else
'./'
end
end
def html_seg_1
if @env.output_dir_structure.by_language_code?
'../../'
elsif @env.output_dir_structure.by_filetype?
'../../'
else
'./'
end
end
self
end
|
#paths ⇒ Object
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
|
# File 'lib/sisu/se_info_env.rb', line 1330
def paths
processing_path_usr="#{root_dir}/#{user}"
processing_path_fnb=processing_path_usr \
+ '/' + Gt[:pods] \
+ '/' + @opt.fng
processing_path_sisupod=processing_path_fnb \
+ '/' + Gt[:sisupod]
{
fnb: processing_path_fnb,
sisupod: processing_path_sisupod,
}
end
|
#pattern ⇒ Object
1921
1922
1923
|
# File 'lib/sisu/se_info_env.rb', line 1921
def pattern
"[0-9a-f]{#{digest(@opt).length}}" end
|
#pdf ⇒ Object
1599
1600
1601
|
# File 'lib/sisu/se_info_env.rb', line 1599
def pdf
"#{root}/pdf"
end
|
#pdf_viewer ⇒ Object
1937
1938
1939
1940
1941
1942
|
# File 'lib/sisu/se_info_env.rb', line 1937
def pdf_viewer
((defined? @rc['program_select']['pdf_viewer']) \
&& @rc['program_select']['pdf_viewer'] =~/\S\S+/) \
? @rc['program_select']['pdf_viewer']
: 'pdf-viewer' end
|
#pdflatex ⇒ Object
2042
2043
2044
2045
2046
|
# File 'lib/sisu/se_info_env.rb', line 2042
def pdflatex
is=(defined? @rc['program_set']['pdflatex']) ? \
@rc['program_set']['pdflatex'] : ''
(is.nil? || is==true) ? 'pdflatex' : is
end
|
#php ⇒ Object
1208
1209
1210
1211
1212
|
# File 'lib/sisu/se_info_env.rb', line 1208
def php
(defined? @rc['webserv']['php']) \
? "#{public_output}/#{@rc['webserv']['php']}"
: (defaults[:webserv_php])
end
|
#plaintext_ocn? ⇒ Boolean
539
540
541
542
543
544
|
# File 'lib/sisu/se_info_env.rb', line 539
def plaintext_ocn?
((defined? @rc['plaintext']['ocn']) \
&& @rc['plaintext']['ocn']==false) \
? @rc['plaintext']['ocn']
: true
end
|
#plaintext_wrap ⇒ Object
175
176
177
178
179
180
181
182
183
|
# File 'lib/sisu/se_info_env.rb', line 175
def plaintext_wrap
((defined? @rc['default']['text_wrap']) \
&& (@rc['default']['text_wrap']) \
&& (@rc['default']['text_wrap'].to_s=~/\d\d+/) \
&& (@rc['default']['text_wrap'].to_i > 19) \
&& (@rc['default']['text_wrap'].to_i < 201)) \
? @rc['default']['text_wrap'].to_i
: 78
end
|
#po ⇒ Object
1611
1612
1613
|
# File 'lib/sisu/se_info_env.rb', line 1611
def po
"#{root}/po4a/po"
end
|
#port ⇒ Object
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
|
# File 'lib/sisu/se_info_env.rb', line 1841
def port
def webrick_port
if @md \
and @md.opt.act[:sample_search_form][:set]==:on \
and @md.opt.selections.str=~/port=(\d+)/
$1
else
if defined? @rc['webserv_cgi']['port']
if @rc['webserv_cgi']['port'].nil? \
and (defined? @md.opt.selections \
and @md.opt.selections.str=~/webrick/)
defaults[:webserv_port_cgi]
elsif not @rc['webserv_cgi']['port'].nil?
@rc['webserv_cgi']['port']
else defaults[:webserv_port_cgi]
end
else defaults[:webserv_port_cgi]
end
end
end
def webserv_port_cgi(opt=nil)
port=if opt \
and opt.act[:sample_search_form][:set]==:on \
and opt.selections.str=~/port[=-](\d+)/
$1
else
port=if defined? @rc['webserv_cgi']['port']
if @rc['webserv_cgi']['port'].nil? \
and (defined? opt.selections \
and opt.selections.str=~/webrick/)
defaults[:webserv_port_cgi]
elsif not @rc['webserv_cgi']['port'].nil?
@rc['webserv_cgi']['port']
else nil
end
else
if (defined? opt.selections \
and opt.selections.str=~/webrick/)
defaults[:webserv_port_cgi]
else nil
end
end
end
port.to_s
end
self
end
|
#portrait ⇒ Object
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
|
# File 'lib/sisu/se_info_env.rb', line 903
def portrait
if @cli != :na
@cli
elsif (defined? @rc['default']['pdf_hyperlinks_portrait']) \
&& (@rc['default']['pdf_hyperlinks_portrait']=~/color/)
:color
elsif (defined? @rc['default']['pdf_hyperlinks_portrait']) \
&& (@rc['default']['pdf_hyperlinks_portrait'] \
=~/(?:no-color|color-off|mono(?:chrome)?)/)
:mono
elsif @hyplnks != :na
@hyprlnks
else :na
end
end
|
#postgresql ⇒ Object
1550
1551
1552
1553
1554
1555
1556
1557
1558
|
# File 'lib/sisu/se_info_env.rb', line 1550
def postgresql
pth=if defined? @rc['processing']['postgresql'] \
and @rc['processing']['postgresql'].is_a?(String)
"#{processing}/#{@rc['processing']['postgresql']}"
else "#{processing}/#{defaults[:processing_postgresql]}"
end
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
|
#pot ⇒ Object
1608
1609
1610
|
# File 'lib/sisu/se_info_env.rb', line 1608
def pot
"#{root}/po4a/pot"
end
|
#processing_base_tmp ⇒ Object
1276
1277
1278
|
# File 'lib/sisu/se_info_env.rb', line 1276
def processing_base_tmp
defaults[:processing_path_tmp_base]
end
|
#processing_path ⇒ Object
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
|
# File 'lib/sisu/se_info_env.rb', line 1270
def processing_path
def encoding
pth="#{processing}/#{defaults[:processing_encoding]}"
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
def processing_base_tmp
defaults[:processing_path_tmp_base]
end
def tmp_root_dir
defaults[:processing_dir_tmp_root]
end
def root_dir
proposed_path_base=if defined? @rc['processing']['path'] \
and not @rc['processing']['path'].nil? \
and not @rc['processing']['path'].empty?
x=if @rc['processing']['path'] =~/^(?:~|home)$/
home else @rc['processing']['path']
end
else nil
end
proposed_dir=if defined? @rc['processing']['dir'] \
and not @rc['processing']['dir'].nil? \
and not @rc['processing']['dir'].empty?
@rc['processing']['dir']
else defaults[:processing_dir]
end
v=SiSU_Env::InfoVersion.instance.get_version
v_dev=(DEVELOPER[:maintenance]==:true) \
? "_#{v.version}"
: ''
path=if proposed_path_base \
and FileTest.directory?(proposed_path_base) \
and File.writable?("#{proposed_path_base}/.")
x=proposed_dir \
? "#{proposed_path_base}/#{proposed_dir}"
: "#{proposed_path_base}/#{defaults[:processing_dir]}"
else defaults[:processing_dir_tmp_root]
end
path = path + v_dev
end
def usr_dir?
case root_dir
when /^\/home/ then false
else true
end
end
def stub_dir
(usr_dir?) \
? ("#{root_dir}/#{user}/#{stub_pwd}")
: ("#{root_dir}/#{stub_pwd}") end
def stub_dir_orig (usr_dir?) \
? ("#{root_dir}/#{user}/#{stub_pwd}")
: ("#{root_dir}/#{stub_pwd}") end
def processing_sisupod(opt=nil) @opt=opt
def paths
processing_path_usr="#{root_dir}/#{user}"
processing_path_fnb=processing_path_usr \
+ '/' + Gt[:pods] \
+ '/' + @opt.fng
processing_path_sisupod=processing_path_fnb \
+ '/' + Gt[:sisupod]
{
fnb: processing_path_fnb,
sisupod: processing_path_sisupod,
}
end
def make
unless FileTest.directory?(root_dir)
FileUtils::mkdir_p(root_dir)
File.chmod(0777,root_dir)
end
if usr_dir?
processing_path_usr="#{root_dir}/#{user}"
FileUtils::mkdir_p(processing_path_usr) \
unless FileTest.directory?(processing_path_usr)
File.chmod(0700,processing_path_usr)
end
sisupod_processing_path=paths[:sisupod]
FileUtils::mkdir_p(sisupod_processing_path) \
unless FileTest.directory?(sisupod_processing_path)
sisupod_processing_path_lng=if defined? @opt.lng
sisupod_processing_path \
+ '/' + Gt[:doc] \
+ '/' + @opt.lng
else
sisupod_processing_path \
+ '/' + Gt[:doc]
end
unless FileTest.directory?(sisupod_processing_path_lng)
FileUtils::mkdir_p(sisupod_processing_path_lng)
File.chmod(0700,sisupod_processing_path_lng)
end
sisupod_processing_path
end
self
end
def processing unless FileTest.directory?(root_dir)
FileUtils::mkdir_p(root_dir)
File.chmod(0777,root_dir)
end
if usr_dir?
processing_path_usr="#{root_dir}/#{user}"
FileUtils::mkdir_p(processing_path_usr) \
unless FileTest.directory?(processing_path_usr)
File.chmod(0700,processing_path_usr)
end
FileUtils::mkdir_p(stub_dir) \
unless FileTest.directory?(stub_dir)
File.chmod(0700,stub_dir)
path_processing=[
stub_dir,
defaults[:processing_path],
defaults[:processing_path_home]
]
processing=nil
path_processing.each do |v| processing=v
unless FileTest.directory?(processing)
FileUtils::mkdir_p(processing)
File.chmod(0700,processing)
end
break
end
processing
end
def ao
pth=if defined? @rc['processing']['dal'] \
and @rc['processing']['dal'].is_a?(String)
"#{processing}/#{@rc['processing']['dal']}"
else "#{processing}/#{defaults[:processing_ao]}"
end
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
def tune
pth=if defined? @rc['processing']['tune'] \
and @rc['processing']['tune'].is_a?(String)
"#{processing}/#{@rc['processing']['tune']}"
else "#{processing}/#{defaults[:processing_tune]}"
end
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
def composite_file
pth=processing_path.ao FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
def git
pth=if defined? @rc['git']['dir'] \
and @rc['git']['dir'].is_a?(String)
(@rc['git']['dir'] =~/^(?:~|home)$/) \
? home + '/' + Gt[:git]
: @rc['git']['dir'] + '/' + Gt[:git]
else defaults[:processing_git]
end
unless FileTest.directory?(pth)
FileUtils::mkdir_p(pth)
File.chmod(0700,pth)
end
pth
end
def odf_pth
pth="#{processing}/odf/#{@fns}"
pth
end
def odf
odt
end
def odt
pth=odf_pth + '/odt'
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
def odf
pth="#{processing}/odf"
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
def odt_bld
FileUtils::rm_rf(processing_path.odt)
FileUtils::mkdir_p(processing_path.odt) \
unless FileTest.directory?(processing_path.odt)
FileUtils::mkdir_p("#{processing_path.odt}/Configurations2") \
unless FileTest.directory?("#{processing_path.odt}/Configurations2")
FileUtils::mkdir_p("#{processing_path.odt}/META-INF") \
unless FileTest.directory?("#{processing_path.odt}/META-INF")
FileUtils::mkdir_p("#{processing_path.odt}/Pictures") \
unless FileTest.directory?("#{processing_path.odt}/Pictures")
FileUtils::mkdir_p("#{processing_path.odt}/Thumbnails") \
unless FileTest.directory?("#{processing_path.odt}/Thumbnails")
processing_path.odt
end
def epub
"#{processing}/epub/#{@fnb}"
end
def epub_bld FileUtils::rm_rf(processing_path.epub) \
if FileTest.directory?(processing_path.epub)
FileUtils::mkdir_p(processing_path.epub) \
unless FileTest.directory?(processing_path.epub)
FileUtils::mkdir_p("#{processing_path.epub}/META-INF") \
unless FileTest.directory?("#{processing_path.epub}/META-INF")
FileUtils::mkdir_p("#{processing_path.epub}/#{Ep[:d_oebps]}/image") \
unless FileTest.directory?("#{processing_path.epub}/#{Ep[:d_oebps]}/image")
FileUtils::mkdir_p("#{processing_path.epub}/#{Ep[:d_oebps]}/css") \
unless FileTest.directory?("#{processing_path.epub}/#{Ep[:d_oebps]}/css")
processing_path.epub
end
def epub_cp_images(md)
pth="#{processing_path.epub}/#{Ep[:d_oebps]}/image"
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
src=(md.opt.sisu_install_type? == :full_path_to_sisu_bin_in_sisu_dir_tree) \
? "#{md.opt.sisu_data_dir?}/image"
: "#{md.opt.sisu_data_dir?}/sisu/image"
images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png]
images.each do |i| if FileTest.file?("#{src}/#{i}")
FileUtils::cp("#{src}/#{i}","#{pth}/#{i}") \
unless FileTest.file?("#{pth}/#{i}")
else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]}
end
end
pth
end
def tex
pth=if defined? @rc['processing']['latex'] \
and @rc['processing']['latex'].is_a?(String)
"#{processing}/#{@rc['processing']['latex']}"
else "#{processing}/#{defaults[:processing_latex]}"
end
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
def texi
pth=if defined? @rc['processing']['texinfo'] \
and @rc['processing']['texinfo'].is_a?(String)
"#{processing}/#{@rc['processing']['texinfo']}"
else "#{processing}/#{defaults[:processing_texinfo]}"
end
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
def texinfo "#{processing}/#{defaults[:processing_texinfo]}"
end
def manpage
"#{path.output}/man"
end
def lout
pth=if defined? @rc['processing']['lout'] \
and @rc['processing']['lout'].is_a?(String)
"#{processing}/#{@rc['processing']['lout']}"
else "#{processing}/#{defaults[:processing_lout]}"
end
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
def sql
pth="#{processing}/sql"
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
def sqlite
pth=if defined? @rc['processing']['sqlite'] \
and @rc['processing']['sqlite'].is_a?(String)
"#{processing}/#{@rc['processing']['sqlite']}"
else "#{processing}/#{defaults[:processing_sqlite]}"
end
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
def postgresql
pth=if defined? @rc['processing']['postgresql'] \
and @rc['processing']['postgresql'].is_a?(String)
"#{processing}/#{@rc['processing']['postgresql']}"
else "#{processing}/#{defaults[:processing_postgresql]}"
end
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
self
end
|
#processing_sisupod(opt = nil) ⇒ Object
processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc)
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
|
# File 'lib/sisu/se_info_env.rb', line 1328
def processing_sisupod(opt=nil) @opt=opt
def paths
processing_path_usr="#{root_dir}/#{user}"
processing_path_fnb=processing_path_usr \
+ '/' + Gt[:pods] \
+ '/' + @opt.fng
processing_path_sisupod=processing_path_fnb \
+ '/' + Gt[:sisupod]
{
fnb: processing_path_fnb,
sisupod: processing_path_sisupod,
}
end
def make
unless FileTest.directory?(root_dir)
FileUtils::mkdir_p(root_dir)
File.chmod(0777,root_dir)
end
if usr_dir?
processing_path_usr="#{root_dir}/#{user}"
FileUtils::mkdir_p(processing_path_usr) \
unless FileTest.directory?(processing_path_usr)
File.chmod(0700,processing_path_usr)
end
sisupod_processing_path=paths[:sisupod]
FileUtils::mkdir_p(sisupod_processing_path) \
unless FileTest.directory?(sisupod_processing_path)
sisupod_processing_path_lng=if defined? @opt.lng
sisupod_processing_path \
+ '/' + Gt[:doc] \
+ '/' + @opt.lng
else
sisupod_processing_path \
+ '/' + Gt[:doc]
end
unless FileTest.directory?(sisupod_processing_path_lng)
FileUtils::mkdir_p(sisupod_processing_path_lng)
File.chmod(0700,sisupod_processing_path_lng)
end
sisupod_processing_path
end
self
end
|
#program ⇒ Object
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
|
# File 'lib/sisu/se_info_env.rb', line 1926
def program
def text_editor
if defined? @rc['program_select']['editor'] \
and @rc['program_select']['editor'] =~/\S\S+/
@rc['program_select']['editor']
elsif defined? @rc['program_select']['text_editor'] \
and @rc['program_select']['text_editor'] =~/\S\S+/
@rc['program_select']['text_editor']
else 'editor' end
end
def pdf_viewer
((defined? @rc['program_select']['pdf_viewer']) \
&& @rc['program_select']['pdf_viewer'] =~/\S\S+/) \
? @rc['program_select']['pdf_viewer']
: 'pdf-viewer' end
def web_browser
if defined? @rc['program_select']['www_browser'] \
and @rc['program_select']['www_browser'] =~/\S\S+/
@rc['program_select']['www_browser']
elsif defined? @rc['program_select']['web_browser'] \
and @rc['program_select']['web_browser'] =~/\S\S+/
@rc['program_select']['web_browser']
else 'x-www-browser' end
end
def www_browser
web_browser
end
def console_web_browser
if defined? @rc['program_select']['console_www_browser'] \
and @rc['program_select']['console_www_browser'] =~/\S\S+/
@rc['program_select']['console_www_browser']
elsif defined? @rc['program_select']['console_web_browser'] \
and @rc['program_select']['console_web_browser'] =~/\S\S+/
@rc['program_select']['console_web_browser']
else 'console-www-browser' end
end
def console_www_browser
web_browser
end
def epub_viewer
((defined? @rc['program_select']['epub_viewer']) \
&& @rc['program_select']['epub_viewer'] =~/\S\S+/) \
? @rc['program_select']['epub_viewer']
: 'ebook-viewer' end
def xml_viewer
((defined? @rc['program_select']['xml_viewer']) \
&& @rc['program_select']['xml_viewer'] =~/\S\S+/) \
? @rc['program_select']['xml_viewer']
: text_editor
end
def docbook_viewer
((defined? @rc['program_select']['xml_viewer']) \
&& @rc['program_select']['xml_viewer'] =~/\S\S+/) \
? @rc['program_select']['xml_viewer']
: text_editor
end
def fictionbook_viewer
((defined? @rc['program_select']['xml_viewer']) \
&& @rc['program_select']['xml_viewer'] =~/\S\S+/) \
? @rc['program_select']['xml_viewer']
: text_editor
end
def xml_editor
xml_viewer
end
def odf_viewer
((defined? @rc['program_select']['odf_viewer']) \
&& @rc['program_select']['odf_viewer'] =~/\S\S+/) \
? @rc['program_select']['odf_viewer']
: 'lowriter' end
def manpage_viewer
'man'
end
def manpage_generator
((defined? @rc['program_select']['man']) \
&& @rc['program_select']['man'] =~/\S\S+/) \
? @rc['program_select']['man']
: 'nroff -man' end
def texinfo
((defined? @rc['program_select']['info_viewer']) \
&& @rc['program_select']['info_viewer'] =~/\S\S+/) \
? @rc['program_select']['info_viewer']
: 'pinfo -f' end
def file_encoding
is=(defined? @rc['program_set']['file_encoding']) \
? @rc['program_set']['encoding'] : ''
(is.nil? || is==true) ? 'encoding' : is
end
def wc is=(defined? @rc['program_set']['wc']) \
? @rc['program_set']['wc'] : ''
(is.nil? || is==true) ? 'wc' : is
end
def tidy
is=(defined? @rc['program_set']['tidy']) \
? @rc['program_set']['tidy'] : nil
(is.nil? || is==true) ? 'tidy' : is
end
def rmagick
is=(defined? @rc['program_set']['rmagick']) \
? @rc['program_set']['rmagick'] : nil
(is.nil? || is==true) ? 'rmagick' : is
end
def rexml is=(defined? @rc['program_set']['rexml']) ? \
@rc['program_set']['rexml'] : ''
(is.nil? || is==true) ? 'rexml' : is
end
def pdflatex
is=(defined? @rc['program_set']['pdflatex']) ? \
@rc['program_set']['pdflatex'] : ''
(is.nil? || is==true) ? 'pdflatex' : is
end
def postgresql
is=(defined? @rc['program_set']['postgresql']) ? \
@rc['program_set']['postgresql'] : ''
(is.nil? || is==true) ? 'postgresql' : is
end
def sqlite
is=(defined? @rc['program_set']['sqlite']) ? \
@rc['program_set']['sqlite'] : ''
(is.nil? || is==true) ? 'sqlite' : is
end
self
end
|
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
|
# File 'lib/sisu/se_info_env.rb', line 585
def promo?
@flag[:ad]=if @md.flag_promo \
&& @ad[:flag_promo]
@flag[:md]=true
true
elsif defined? @html_bits.widget_promo \
and not @html_bits.widget_promo.nil? \
and @html_bits.widget_promo.is_a?(Array) \
and @html_bits.widget_promo.length > 0
@flag[:sk]=true
true
elsif defined? @rc['html']['promo'] \
and not @rc['html']['promo'].nil? \
and @rc['html']['promo'].length > 0
@flag[:rc]=true
true
else false
end
@flag
end
|
#pwd ⇒ Object
1069
1070
1071
|
# File 'lib/sisu/se_info_env.rb', line 1069
def pwd
@sys.pwd
end
|
#rbver ⇒ Object
141
142
143
|
# File 'lib/sisu/se_info_env.rb', line 141
def rbver
@sys.rbver
end
|
#read_source_file(fns) ⇒ Object
1047
1048
1049
|
# File 'lib/sisu/se_info_env.rb', line 1047
def read_source_file(fns)
read_source_file_array(fns)
end
|
#read_source_file_array(fns) ⇒ Object
1038
1039
1040
1041
1042
1043
1044
1045
1046
|
# File 'lib/sisu/se_info_env.rb', line 1038
def read_source_file_array(fns)
(fns !~/\.ssm.sst$/) \
? (IO.readlines(fns, mode: 'r:utf-8', cr_newline: true))
: (IO.readlines(
"#{processing_path.composite_file}/#{fns}",
mode: 'r:utf-8',
cr_newline: true
))
end
|
#read_source_file_string(fns) ⇒ Object
1050
1051
1052
1053
1054
1055
1056
1057
1058
|
# File 'lib/sisu/se_info_env.rb', line 1050
def read_source_file_string(fns)
(fns !~/\.ssm.sst$/) \
? (IO.read(fns, mode: 'r:utf-8', cr_newline: true))
: (IO.read(
"#{processing_path.composite_file}/#{fns}",
mode: 'r:utf-8',
cr_newline: true
))
end
|
#remote ⇒ Object
1584
1585
1586
|
# File 'lib/sisu/se_info_env.rb', line 1584
def remote
root
end
|
#rexml ⇒ Object
should be part of ruby 1.8 but apparently not always
2037
2038
2039
2040
2041
|
# File 'lib/sisu/se_info_env.rb', line 2037
def rexml is=(defined? @rc['program_set']['rexml']) ? \
@rc['program_set']['rexml'] : ''
(is.nil? || is==true) ? 'rexml' : is
end
|
#rmagick ⇒ Object
2032
2033
2034
2035
2036
|
# File 'lib/sisu/se_info_env.rb', line 2032
def rmagick
is=(defined? @rc['program_set']['rmagick']) \
? @rc['program_set']['rmagick'] : nil
(is.nil? || is==true) ? 'rmagick' : is
end
|
#root ⇒ Object
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
|
# File 'lib/sisu/se_info_env.rb', line 1574
def root
if defined? @rc['webserv']['url_root'] \
and @rc['webserv']['url_root'] =~/https?:\/\//
"#{@rc['webserv']['url_root']}/#{@stub_pwd}"
elsif defined? @rc['webserv']['url_root'] \
and @rc['webserv']['url_root'] =~/localhost/
"http://localhost/#{@stub_pwd}"
else "file://#{path.output}"
end
end
|
#root_dir ⇒ Object
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
|
# File 'lib/sisu/se_info_env.rb', line 1282
def root_dir
proposed_path_base=if defined? @rc['processing']['path'] \
and not @rc['processing']['path'].nil? \
and not @rc['processing']['path'].empty?
x=if @rc['processing']['path'] =~/^(?:~|home)$/
home else @rc['processing']['path']
end
else nil
end
proposed_dir=if defined? @rc['processing']['dir'] \
and not @rc['processing']['dir'].nil? \
and not @rc['processing']['dir'].empty?
@rc['processing']['dir']
else defaults[:processing_dir]
end
v=SiSU_Env::InfoVersion.instance.get_version
v_dev=(DEVELOPER[:maintenance]==:true) \
? "_#{v.version}"
: ''
path=if proposed_path_base \
and FileTest.directory?(proposed_path_base) \
and File.writable?("#{proposed_path_base}/.")
x=proposed_dir \
? "#{proposed_path_base}/#{proposed_dir}"
: "#{proposed_path_base}/#{defaults[:processing_dir]}"
else defaults[:processing_dir_tmp_root]
end
path = path + v_dev
end
|
#rst_ocn? ⇒ Boolean
563
564
565
566
567
568
|
# File 'lib/sisu/se_info_env.rb', line 563
def rst_ocn?
((defined? @rc['rst']['ocn']) \
&& @rc['rst']['ocn']==true) \
? @rc['rst']['ocn']
: false
end
|
#sample_data ⇒ Object
sample data repository source directory
1115
1116
1117
|
# File 'lib/sisu/se_info_env.rb', line 1115
def sample_data defaults[:sample_data_path]
end
|
1762
1763
1764
1765
1766
1767
1768
1769
|
# File 'lib/sisu/se_info_env.rb', line 1762
def sample_search_form_title(organised_by=:language)
title=if defined? @rc['search']['sisu']['title'] \
and @rc['search']['sisu']['title'] =~/\S+/
@rc['search']['sisu']['title']
else %{SiSU (generated sample) search form}
end
title=title + " (content organised by #{organised_by})"
end
|
#sans ⇒ Object
940
941
942
943
944
945
|
# File 'lib/sisu/se_info_env.rb', line 940
def sans (defined? @rc['default']['texpdf_fontface_sans']) \
&& (@rc['default']['texpdf_fontface_sans']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_sans']
: 'Liberation Sans'
end
|
#scripts ⇒ Object
used previously only to include tla version info
1198
1199
1200
1201
1202
|
# File 'lib/sisu/se_info_env.rb', line 1198
def scripts if defined? @rc['project']['path']
"#{home}/#{@rc['project']['path']}"
end
end
|
#search? ⇒ Boolean
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
|
# File 'lib/sisu/se_info_env.rb', line 605
def search?
searches=['sisu']
flag=false
if defined? @rc['search']
searches.each do |type|
flag=if defined? @rc['search'][type] \
and defined? @rc['search'][type]['action'] \
and @rc['search'][type]['flag']==true \
and @rc['search'][type]['action'] =~/https?:\/\//
flag=if promo?[:ad]
false
elsif defined? @html_bits.widget_search \
and @html_bits.widget_search==true
true
elsif defined? @rc['search'][type]['flag'] \
and @rc['search'][type]['flag']==true
true
else false
end
else false
end
end
else false
end
flag
end
|
#search_action ⇒ Object
753
754
755
756
757
|
# File 'lib/sisu/se_info_env.rb', line 753
def search_action if search?
else ''
end
end
|
#search_fixed? ⇒ Boolean
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
|
# File 'lib/sisu/se_info_env.rb', line 631
def search_fixed?
searches=['sisu','hyperestraier']
flag=if defined? @rc['search']
searches.each do |type|
if defined? @rc['search'][type] \
and defined? @rc['search'][type]['action'] \
and @rc['search'][type]['action'] =~/https?:\/\// \
and defined? @rc['search'][type]['db'] \
and @rc['search'][type]['db'] =~/\S+/
flag=if promo?[:ad]
false
elsif defined? @html_bits.widget_search \
and @html_bits.widget_search==true
true
elsif defined? @rc['search'][type]['flag'] \
and @rc['search'][type]['flag']==true
true
else false
end
else false
end
end
else false
end
end
|
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
|
# File 'lib/sisu/se_info_env.rb', line 656
def search_form(type='sisusearch',action=nil,db=nil,table=false)
rc=SiSU_Env::GetInit.new.sisu_yaml.rc
create_form_sisu=if action \
and db \
and action =~/https?:\/\// \
and db =~/\S+/
true
elsif widget.search?
db=if rc['search']['sisu']['flag']==true \
and rc['search']['sisu']['db']=~/\S+/
(rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \
? rc['search']['sisu']['db']
: "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}"
else nil
end
action=rc['search']['sisu']['action']
true
elsif defined? rc['search']['sisu']['flag'] \
and defined? rc['search']['sisu']['action'] \
and rc['search']['sisu']['flag']==true \
and rc['search']['sisu']['action'] =~/https?:\/\//
true
else false
end
if table
table_open='<td align="center" bgcolor="#ffffff">'
table_close='</td>'
else
table_open=''
table_close='<br />'
end
form=if create_form_sisu \
and type=~/sisusearch/ \
and defined? rc['search']['sisu'] \
and defined? rc['search']['sisu']['action']
<<WOK
<!-- SiSU Search -->
#{table_open}
<a name="search"></a>
<form method="get" action="#{rc['search']['sisu']['action']}" target="_top">
<font size="2">
<input type="text" name="s1" size="24" maxlength="255" />
<input type="hidden" name="db" value="#{db}" />
<input type="hidden" name="ltd" value="1000" />
<input type="hidden" name="off" value="0" />
<input type="hidden" name="doc" value="#{@md.fnb}" /><br />
<input type="submit" name="search" value="search doc" />
<input type="submit" name="search" value="search db" />
</font></form>
#{table_close}
<!-- SiSU Search -->
WOK
else ''
end
form
end
|
decide later, as is configured here (in sisurc) and can be turned off on command line
495
496
497
498
499
500
501
502
503
|
# File 'lib/sisu/se_info_env.rb', line 495
def search_form? if (defined? @rc['omit']['search_form'] \
and not @rc['omit']['search_form'].nil?) \
or listed?('search_form')
:off
else
:na
end
end
|
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
|
# File 'lib/sisu/se_info_env.rb', line 712
def search_form_static(action=nil,db=nil)
rc=SiSU_Env::GetInit.new.sisu_yaml.rc
create_form=if rc['search']['sisu']['flag']==true \
and action \
and db \
and action =~/https?:\/\// \
and db =~/\S+/
true
elsif widget.search_fixed?
db=if rc['search']['sisu']['flag']==true \
and rc['search']['sisu']['db']=~/\S+/
(rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \
? rc['search']['sisu']['db']
: "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}"
else nil
end
action=rc['search']['sisu']['action']
true
else false
end
if create_form
%{<td align="center" bgcolor="#ffffff">
<!-- SiSU Search -->
<a name="search"></a>
<form method="get" action="#{rc['search']['sisu']['action']}" target="_top">
<font size="2">
<input type="text" name="s1" size="24" maxlength="255" />
<br />
<input type="hidden" name="db" value="#{db}" />
<input type="hidden" name="ltd" value="1000" />
<input type="hidden" name="off" value="0" />
<input type="hidden" name="doc" value="#{@md.fnb}" />
<input type="submit" name="search" value="search doc" />
<input type="submit" name="search" value="search db" />
</font>
</form>
<!-- SiSU Search -->
</td> }
else ''
end
end
|
#segsubtoc? ⇒ Boolean
468
469
470
471
472
473
474
475
476
|
# File 'lib/sisu/se_info_env.rb', line 468
def segsubtoc?
if (defined? @rc['omit']['segsubtoc'] \
and not @rc['omit']['segsubtoc'].nil?) \
or listed?('segsubtoc')
:off
else
:na
end
end
|
#serif ⇒ Object
946
947
948
949
950
951
|
# File 'lib/sisu/se_info_env.rb', line 946
def serif (defined? @rc['default']['texpdf_fontface_serif']) \
&& (@rc['default']['texpdf_font_serif']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_serif']
: 'Liberation Serif'
end
|
#share ⇒ Object
shared data repository source directory
1099
1100
1101
1102
1103
|
# File 'lib/sisu/se_info_env.rb', line 1099
def share defaults[:sisu_share]
end
|
#sisupod_gen(fns_pod) ⇒ Object
2119
2120
2121
|
# File 'lib/sisu/se_info_env.rb', line 2119
def sisupod_gen(fns_pod)
sisupod_gen_v3(fns_pod)
end
|
#sisupod_gen_v2(fns_pod) ⇒ Object
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
|
# File 'lib/sisu/se_info_env.rb', line 2157
def sisupod_gen_v2(fns_pod)
sisupod_processing_path=
processing_path.processing + '/' + Gt[:sisupod]
if FileTest.directory?(sisupod_processing_path) \
or FileTest.file?(sisupod_processing_path)
FileUtils::rm_rf(sisupod_processing_path)
end
unless FileTest.directory?(sisupod_processing_path)
FileUtils::mkdir_p(sisupod_processing_path)
end
(FileTest.file?(fns_pod)) \
? system("unzip -q #{fns_pod} -d #{processing_path.processing}")
: (SiSU_Screen::Ansi.new(
'',
"*WARN* file not found: #{fns_pod}"
).warn unless @md.opt.act[:quiet][:set]==:on)
sisupod_processing_path
end
|
#sisupod_gen_v3(fns_pod) ⇒ Object
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
|
# File 'lib/sisu/se_info_env.rb', line 2122
def sisupod_gen_v3(fns_pod)
pwd=Dir.pwd
sisupod_processing_path=
processing_path.processing + '/' + Gt[:sisupod]
if FileTest.directory?(sisupod_processing_path) \
or FileTest.file?(sisupod_processing_path)
FileUtils::rm_rf(sisupod_processing_path)
end
unless FileTest.directory?(sisupod_processing_path)
FileUtils::mkdir_p(sisupod_processing_path)
end
f_pod=if FileTest.file?("#{Dir.pwd}/#{fns_pod}")
"#{Dir.pwd}/#{fns_pod}"
elsif FileTest.file?(fns_pod)
fns_pod
end
if f_pod \
&& FileTest.file?(f_pod)
(SiSU_Env::SystemCall.new.program_found?('tree')) \
? 'tree ' + processing_path.processing + '/' + Gt[:sisupod]
: ''
if FileTest.directory?(processing_path.processing)
Dir.chdir(processing_path.processing)
system(%{tar xJf #{f_pod}})
Dir.chdir(pwd)
end
else
SiSU_Screen::Ansi.new(
'',
'*WARN* file not found: ' + fns_pod
).warn unless @md.opt.act[:quiet][:set]==:on
end
sisupod_processing_path
end
|
#sisupod_v2 ⇒ Object
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
|
# File 'lib/sisu/se_info_env.rb', line 301
def sisupod_v2
sisupod_processing_path="#{processing_path.processing}/#{Gt[:sisupod]}"
if FileTest.directory?(sisupod_processing_path) \
or FileTest.file?(sisupod_processing_path)
FileUtils::rm_rf(sisupod_processing_path)
end
paths=[]
paths=[
"#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/doc",
"#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/dir",
"#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/site",
"#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/image"
]
paths.each {|x| FileUtils::mkdir_p(x) unless FileTest.directory?(x) }
end
|
#sisupod_v3(opt) ⇒ Object
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
|
# File 'lib/sisu/se_info_env.rb', line 250
def sisupod_v3(opt)
spp="#{processing_path.processing}/#{Gt[:sisupod]}"
sppc="#{spp}/doc/_sisu"
lng_dirs=[]
if FileTest.directory?(spp) \
or FileTest.file?(spp)
FileUtils::rm_rf(spp)
end
paths=[]
flv=SiSU_Env::EnvCall.new(opt.fns).
document_language_versions_found
flv[:f].each {|l| lng_dirs << l[:l] }
lng_dirs.uniq.each do |lng|
paths << "#{spp}/doc/#{lng}"
end
paths \
<< "#{spp}/image" \
<< "#{sppc}/skin/doc" \
<< "#{sppc}/skin/dir" \
<< "#{sppc}/skin/site"
paths.each do |x|
unless FileTest.directory?(x)
FileUtils::mkdir_p(x)
end
end
if FileTest.directory?(sppc)
pwd=Dir.pwd
Dir.chdir(sppc)
FileUtils::ln_s('../../image', 'image')
Dir.chdir(pwd)
end
end
|
#sisupod_v4(opt) ⇒ Object
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
|
# File 'lib/sisu/se_info_env.rb', line 203
def sisupod_v4(opt)
spp="#{processing_path.processing}/#{Gt[:sisupod]}"
sppc="#{spp}/doc/_sisu"
lng_dirs=[]
if FileTest.directory?(spp) \
or FileTest.file?(spp)
FileUtils::rm_rf(spp)
end
paths=[]
flv=SiSU_Env::EnvCall.new(opt.fns).
document_language_versions_found
flv[:f].each {|l| lng_dirs << l[:l] }
lng_dirs.uniq.each do |lng|
paths << "#{spp}/doc/#{lng}"
end
paths \
<< "#{spp}/image"
paths.each do |x|
unless FileTest.directory?(x)
FileUtils::mkdir_p(x)
end
end
if FileTest.directory?(sppc)
pwd=Dir.pwd
Dir.chdir(sppc)
FileUtils::ln_s('../../image', 'image')
Dir.chdir(pwd)
end
end
|
#sitearch ⇒ Object
1093
1094
1095
|
# File 'lib/sisu/se_info_env.rb', line 1093
def sitearch
@sys.dir_sitearch
end
|
#size(pt = nil) ⇒ Object
921
922
923
924
925
926
927
928
929
|
# File 'lib/sisu/se_info_env.rb', line 921
def size(pt=nil)
if pt && pt != :na
pt
elsif defined? @rc['default']['fontsize'] \
&& @rc['default']['fontsize']=~/\d{1,2}/
@rc['default']['fontsize']
else :na
end
end
|
#source_file_path ⇒ Object
865
866
867
868
869
870
|
# File 'lib/sisu/se_info_env.rb', line 865
def source_file_path
file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst')
unless file =~/\.ssm\.sst$/; "#{Dir.pwd}"
else "#{processing_path.composite_file}"
end
end
|
#source_file_processing_array(fns) ⇒ Object
1059
1060
1061
|
# File 'lib/sisu/se_info_env.rb', line 1059
def source_file_processing_array(fns)
read_source_file_string(fns).split(/\s*\n\s*\n/m)
end
|
#source_file_with_path ⇒ Object
871
872
873
874
|
# File 'lib/sisu/se_info_env.rb', line 871
def source_file_with_path
file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst')
"#{source_file_path}/#{file}"
end
|
#sql ⇒ Object
1536
1537
1538
1539
1540
|
# File 'lib/sisu/se_info_env.rb', line 1536
def sql
pth="#{processing}/sql"
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
|
#sqlite ⇒ Object
1541
1542
1543
1544
1545
1546
1547
1548
1549
|
# File 'lib/sisu/se_info_env.rb', line 1541
def sqlite
pth=if defined? @rc['processing']['sqlite'] \
and @rc['processing']['sqlite'].is_a?(String)
"#{processing}/#{@rc['processing']['sqlite']}"
else "#{processing}/#{defaults[:processing_sqlite]}"
end
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
|
#src_pod ⇒ Object
1605
1606
1607
|
# File 'lib/sisu/se_info_env.rb', line 1605
def src_pod
"#{root}/pod"
end
|
#src_txt ⇒ Object
1602
1603
1604
|
# File 'lib/sisu/se_info_env.rb', line 1602
def src_txt
"#{root}/src"
end
|
#stub_dir ⇒ Object
1318
1319
1320
1321
1322
|
# File 'lib/sisu/se_info_env.rb', line 1318
def stub_dir
(usr_dir?) \
? ("#{root_dir}/#{user}/#{stub_pwd}")
: ("#{root_dir}/#{stub_pwd}") end
|
#stub_dir_orig ⇒ Object
ends up with lang, if lang dir
1323
1324
1325
1326
1327
|
# File 'lib/sisu/se_info_env.rb', line 1323
def stub_dir_orig (usr_dir?) \
? ("#{root_dir}/#{user}/#{stub_pwd}")
: ("#{root_dir}/#{stub_pwd}") end
|
#stub_epub ⇒ Object
1078
1079
1080
|
# File 'lib/sisu/se_info_env.rb', line 1078
def stub_epub
@stub_epub
end
|
#stub_md_harvest ⇒ Object
194
195
196
|
# File 'lib/sisu/se_info_env.rb', line 194
def stub_md_harvest @stub_set_manifest
end
|
#stub_pod ⇒ Object
200
201
202
|
# File 'lib/sisu/se_info_env.rb', line 200
def stub_pod
@stub_pod
end
|
#style ⇒ Object
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
|
# File 'lib/sisu/se_info_env.rb', line 1104
def style
if @md \
&& ((@md.opt.opt_act[:dump][:bool] \
&& @md.opt.opt_act[:dump][:inst]) \
|| (@md.opt.opt_act[:redirect][:bool] \
&& @md.opt.opt_act[:redirect][:inst]))
'css'
else
defaults[:stylesheet_stub]
end
end
|
#tex ⇒ Object
1503
1504
1505
1506
1507
1508
1509
1510
1511
|
# File 'lib/sisu/se_info_env.rb', line 1503
def tex
pth=if defined? @rc['processing']['latex'] \
and @rc['processing']['latex'].is_a?(String)
"#{processing}/#{@rc['processing']['latex']}"
else "#{processing}/#{defaults[:processing_latex]}"
end
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
|
#texi ⇒ Object
1512
1513
1514
1515
1516
1517
1518
1519
1520
|
# File 'lib/sisu/se_info_env.rb', line 1512
def texi
pth=if defined? @rc['processing']['texinfo'] \
and @rc['processing']['texinfo'].is_a?(String)
"#{processing}/#{@rc['processing']['texinfo']}"
else "#{processing}/#{defaults[:processing_texinfo]}"
end
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
|
#texinfo ⇒ Object
‘nroff -man’ #‘groff -man -Tascii’
1521
1522
1523
|
# File 'lib/sisu/se_info_env.rb', line 1521
def texinfo "#{processing}/#{defaults[:processing_texinfo]}"
end
|
#texpdf ⇒ Object
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
|
# File 'lib/sisu/se_info_env.rb', line 930
def texpdf
def main
(defined? @rc['default']['texpdf_fontface']) \
&& (@rc['default']['texpdf_fontface']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface']
: 'Liberation Sans'
end
def sans (defined? @rc['default']['texpdf_fontface_sans']) \
&& (@rc['default']['texpdf_fontface_sans']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_sans']
: 'Liberation Sans'
end
def serif (defined? @rc['default']['texpdf_fontface_serif']) \
&& (@rc['default']['texpdf_font_serif']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_serif']
: 'Liberation Serif'
end
def mono
(defined? @rc['default']['texpdf_fontface_mono']) \
&& (@rc['default']['texpdf_fontface_mono']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_mono']
: 'Liberation Mono'
end
def cjk
(defined? @rc['default']['texpdf_fontface_cjk']) \
&& (@rc['default']['texpdf_fontface_cjk']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_cjk']
: 'IPAGothic' end
def cjk_zh
(defined? @rc['default']['texpdf_fontface_cjk_zh']) \
&& (@rc['default']['texpdf_fontface_cjk_zh']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_cjk_zh']
: 'IPAGothic'
end
def cjk_ja
(defined? @rc['default']['texpdf_fontface_cjk_ja']) \
&& (@rc['default']['texpdf_fontface_cjk_ja']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_cjk_ja']
: 'IPAGothic'
end
def cjk_ko
(defined? @rc['default']['texpdf_fontface_cjk_ko']) \
&& (@rc['default']['texpdf_fontface_cjk_ko']=~/\S{3,}/) \
? @rc['default']['texpdf_fontface_cjk_ko']
: 'IPAGothic'
end
def size(pt=nil)
if pt && pt != :na
pt
elsif (defined? @rc['default']['texpdf_fontsize']) \
&& (@rc['default']['texpdf_fontsize']=~/\d{1,2}/)
@rc['default']['texpdf_fontsize']
elsif (defined? @rc['default']['fontsize']) \
&& (@rc['default']['fontsize']=~/\d{1,2}/)
@rc['default']['fontsize']
else
:na
end
end
self
end
|
#texpdf_hyperlinks(cli) ⇒ Object
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
|
# File 'lib/sisu/se_info_env.rb', line 875
def texpdf_hyperlinks(cli)
@cli=cli
@hyplnks=if cli != :na
cli
elsif (defined? @rc['default']['pdf_hyperlinks']) \
&& (@rc['default']['pdf_hyperlinks']=~/color/)
:color
elsif (defined? @rc['default']['pdf_hyperlinks']) \
&& (@rc['default']['pdf_hyperlinks'] \
=~/(?:no-color|color-off|mono(?:chrome)?)/)
:mono
else :na
end
def landscape
if @cli != :na
@cli
elsif (defined? @rc['default']['pdf_hyperlinks_landscape']) \
&& (@rc['default']['pdf_hyperlinks_landscape']=~/color/)
:color
elsif (defined? @rc['default']['pdf_hyperlinks_landscape']) \
&& (@rc['default']['pdf_hyperlinks_landscape'] \
=~/(?:no-color|color-off|mono(?:chrome)?)/)
:mono
elsif @hyplnks != :na
@hyplnks
else :na
end
end
def portrait
if @cli != :na
@cli
elsif (defined? @rc['default']['pdf_hyperlinks_portrait']) \
&& (@rc['default']['pdf_hyperlinks_portrait']=~/color/)
:color
elsif (defined? @rc['default']['pdf_hyperlinks_portrait']) \
&& (@rc['default']['pdf_hyperlinks_portrait'] \
=~/(?:no-color|color-off|mono(?:chrome)?)/)
:mono
elsif @hyplnks != :na
@hyprlnks
else :na
end
end
self
end
|
#text_editor ⇒ Object
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
|
# File 'lib/sisu/se_info_env.rb', line 1927
def text_editor
if defined? @rc['program_select']['editor'] \
and @rc['program_select']['editor'] =~/\S\S+/
@rc['program_select']['editor']
elsif defined? @rc['program_select']['text_editor'] \
and @rc['program_select']['text_editor'] =~/\S\S+/
@rc['program_select']['text_editor']
else 'editor' end
end
|
#textile_ocn? ⇒ Boolean
545
546
547
548
549
550
|
# File 'lib/sisu/se_info_env.rb', line 545
def textile_ocn?
((defined? @rc['textile']['ocn']) \
&& @rc['textile']['ocn']==true) \
? @rc['textile']['ocn']
: false
end
|
#tidy ⇒ Object
2027
2028
2029
2030
2031
|
# File 'lib/sisu/se_info_env.rb', line 2027
def tidy
is=(defined? @rc['program_set']['tidy']) \
? @rc['program_set']['tidy'] : nil
(is.nil? || is==true) ? 'tidy' : is
end
|
#tmp_root_dir ⇒ Object
1279
1280
1281
|
# File 'lib/sisu/se_info_env.rb', line 1279
def tmp_root_dir
defaults[:processing_dir_tmp_root]
end
|
#toc? ⇒ Boolean
385
386
387
388
389
390
391
392
393
|
# File 'lib/sisu/se_info_env.rb', line 385
def toc?
if (defined? @rc['omit']['toc'] \
and not @rc['omit']['toc'].nil?) \
or listed?('toc')
:off
else
:na
end
end
|
#tune ⇒ Object
1412
1413
1414
1415
1416
1417
1418
1419
1420
|
# File 'lib/sisu/se_info_env.rb', line 1412
def tune
pth=if defined? @rc['processing']['tune'] \
and @rc['processing']['tune'].is_a?(String)
"#{processing}/#{@rc['processing']['tune']}"
else "#{processing}/#{defaults[:processing_tune]}"
end
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
|
#txt ⇒ Object
1587
1588
1589
|
# File 'lib/sisu/se_info_env.rb', line 1587
def txt
"#{root}/txt"
end
|
#type ⇒ Object
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
|
# File 'lib/sisu/se_info_env.rb', line 1902
def type
if @opt
case @opt.act[:hash_digest_algo]
when :sha512 then :sha512
when :sha256 then :sha256
when :md5 then :md5
else digest_conf?
end
else digest_conf?
end
end
|
#url ⇒ Object
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
|
# File 'lib/sisu/se_info_env.rb', line 1561
def url
def hostname
"http://#{@sys.hostname}"
end
def dir_url
"file://#{path.webserv}/#{stub_pwd}"
end
def localhost
"http://localhost/#{stub_pwd}"
end
def local
"http://#{hostname}/#{@stub_pwd}"
end
def root
if defined? @rc['webserv']['url_root'] \
and @rc['webserv']['url_root'] =~/https?:\/\//
"#{@rc['webserv']['url_root']}/#{@stub_pwd}"
elsif defined? @rc['webserv']['url_root'] \
and @rc['webserv']['url_root'] =~/localhost/
"http://localhost/#{@stub_pwd}"
else "file://#{path.output}"
end
end
def remote
root
end
def txt
"#{root}/txt"
end
def html
"#{root}/html"
end
def epub
"#{root}/epub"
end
def odt
"#{root}/odt"
end
def pdf
"#{root}/pdf"
end
def src_txt
"#{root}/src"
end
def src_pod
"#{root}/pod"
end
def pot
"#{root}/po4a/pot"
end
def po
"#{root}/po4a/po"
end
def webserv_host_base(opt=nil)
if defined? @rc['webserv']['host']
case @rc['webserv']['host']
when /https?:\/\// then @rc['webserv']['host']
when /\S+/ then "http://#{@rc['webserv']['host']}"
else defaults[:webserv_host_cgi]
end
else defaults[:webserv_host_cgi]
end
end
def webserv_cgi(opt=nil) http=if defined? @rc['webserv_cgi']['host'] \
and @rc['webserv_cgi']['host'].is_a?(String)
http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') if port.webserv_port_cgi
http + @rc['webserv_cgi']['host'] + ':' \
+ port.webserv_port_cgi + '/' \
+ @stub_pwd
else
http + @rc['webserv_cgi']['host'] + '/' \
+ @stub_pwd
end
else
http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://')
if port.webserv_port_cgi(opt)
http + webserv_host_base + ':' \
+ port.webserv_port_cgi(opt) + '/'\
+ @stub_pwd
else
http + webserv_host_base + '/' \
+ @stub_pwd
end
end
http=http.strip
end
def webserv_base_cgi(opt=nil) http_cgi=if opt.selections.str =~/--webserv-(?:cgi|db|search)[=-]["']?(\S+)["']+/
m=$1
(m=~/http\/\/:/) ? m : %{http://#{m}}
elsif defined? @rc['webserv_cgi']['host'] \
and @rc['webserv_cgi']['host'].is_a?(String)
http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://')
if port.webserv_port_cgi(opt)
http + @rc['webserv_cgi']['host'] + ':' \
+ port.webserv_port_cgi(opt).to_s
else
http + @rc['webserv_cgi']['host']
end
else
http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://')
if port.webserv_port_cgi(opt)
http + webserv_host_base + ':' \
+ port.webserv_port_cgi(opt).to_s
else http + webserv_host_base
end
end
http_cgi=http_cgi.strip
end
def webrick if defined? @rc['webserv_cgi']['host'] \
and @rc['webserv_cgi']['host'].is_a?(String)
http=if @rc['webserv_cgi']['host'] =~/http:\/\//
'http://'
elsif @rc['webserv_cgi']['host'] =~/https:\/\//
'https://'
else defaults
end
http + @rc['webserv_cgi']['host']
elsif webserv_host_base \
and webserv_host_base.is_a?(String)
webserv_host_base
else
'localhost'
end
end
def webserv if defined? @rc['webserv']['url_root'] \
and @rc['webserv']['url_root'] =~/http/
@rc['webserv']['url_root']
elsif path.webserv_dir \
and path.webserv =~ /#{path.webserv_dir}/ path.webserv + '/' \
+ @base_markup_dir_stub.
gsub(/#{path.webserv_dir}/,
"#{url.hostname}/#{@stub_pwd}")
elsif defined? @rc['webserv']['webrick_url'] \
and @rc['webserv']['webrick_url']==false
'file://' + path.webserv
elsif port.webserv_port_cgi =~/\S+/
url.hostname + ':' + port.webserv_port_cgi
else
url.hostname
end
end
def webserv_base if path.webserv_dir \
and path.webserv =~ /#{path.webserv_dir}/ path.webserv + '/' \
+ @stub_pwd.
gsub(/#{path.webserv_dir}/,
"#{url.hostname}")
elsif defined? @rc['webserv']['webrick_url'] \
and @rc['webserv']['webrick_url']==false
"file://#{path.webserv}"
else "#{url.webrick_base}"
end
end
def webserv_files_from_db(opt=nil) if opt.selections.str =~/--webserv-output[=-]["']?(\S+)["']+/
m=$1
(m=~/(?:http|file\/)\/\/:/) ? m : %{http://#{m}}
else
show_output_on=if defined? @rc['webserv_cgi']['show_output_on']
@rc['webserv_cgi']['show_output_on']
elsif defined? @rc['webserv_cgi']['file_links']
@rc['webserv_cgi']['file_links']
else ''
end
m=case show_output_on
when /webserv_cgi/ then url.webserv_base_cgi(opt)
when /webserv/ then @rc['webserv']['url_root']
when /https?:\/\// then @rc['webserv_cgi']['file_links']
when /\S+/ then 'http://' + @rc['webserv_cgi']['file_links']
else webserv_base_cgi(opt)
end
end
end
def cgi_sample_search_form_name(opt=nil)
if opt.selections.str \
=~/--(?:cgi-)?search-form-name[=-]["']?(\S+?\.cgi)/
$1
elsif not opt.selections.str =~/--db[=-]["']?sqlite/ \
and defined? @rc['search'] \
and defined? @rc['search']['sisu'] \
and defined? @rc['search']['sisu']['action'] \
and @rc['search']['sisu']['action'] =~/https?:\/\/\S+?\.cgi/
/(?:https?:\/\/\S+?)\/([^\/]+?\.cgi)$/.
match(@rc['search']['sisu']['action'])[1]
else
(opt.selections.str =~/--db[=-]["']?sqlite/) \
? "#{Db[:name_prefix_db]}sqlite.cgi" \
: "#{Db[:name_prefix_db]}pg.cgi"
end
end
def sample_search_form_title(organised_by=:language)
title=if defined? @rc['search']['sisu']['title'] \
and @rc['search']['sisu']['title'] =~/\S+/
@rc['search']['sisu']['title']
else %{SiSU (generated sample) search form}
end
title=title + " (content organised by #{organised_by})"
end
def output_tell output_type=if defined? @rc['show_output_on'] \
and @rc['show_output_on'] \
=~/^(?:filesystem|webserv|(?:local|remote)(?:_webserv)?|webrick)/
@rc['show_output_on']
else 'filesystem'
end
case output_type
when /^filesystem(?:_url)?/ then url.dir_url
when /^remote(?:_webserv)?/ then url.remote
when /^(?:webserv|local_webserv)/ then url.local
when /^local(:\d+)/ then url.hostname + $1 + '/' + stub_pwd
when /^localhost(:\d+)/ then url.localhost + $1 + '/' + stub_pwd
when /^localhost/ then url.localhost
when /^webrick/ then url.webrick
when /^path/ then url.webserv_map_pwd
else url.webserv_map_pwd
end
end
def images
"#{Xx[:html_relative2]}/_sisu/image"
end
def images_local
if FileTest.directory?(path.image_source_include)
path.image_source_include
else
if @@local_image==true
cmd=@md.opt.selections.str ? @md.opt.selections.str : ''
SiSU_Screen::Ansi.new(
cmd,
"WARNING - no local image directory or images:",
defaults[:image_local]
).warn unless @md.opt.act[:quiet][:set]==:on
@@local_image=false
end
url.images
end
end
def images_external
if FileTest.directory?(image_external)
if @@image_flag
images=Dir.glob("#{image_external}/*.{png,jpg,gif}")
pth=path.webserv + '/' \
+ @stub_pwd
FileUtils::mkdir_p("#{pth}/_sisu/image_external") \
unless FileTest.directory?("#{pth}/_sisu/image_external")
images.each { |i| File.install(i,"#{pth}/#{i}") } \
unless images.length > 0
@@image_flag=false
end
"#{Xx[:html_relative2]}/_sisu/image_external"
else
if @@local_image==true
SiSU_Screen::Ansi.new(
@cmd,
'WARNING - image directory for external images or no such images:',
:image_external
).warn unless @md.opt.act[:quiet][:set]==:on
@@local_image=false
end
url.images_external
end
end
def images_epub
'./image'
end
self
end
|
#usr_dir? ⇒ Boolean
1312
1313
1314
1315
1316
1317
|
# File 'lib/sisu/se_info_env.rb', line 1312
def usr_dir?
case root_dir
when /^\/home/ then false
else true
end
end
|
#wc ⇒ Object
2022
2023
2024
2025
2026
|
# File 'lib/sisu/se_info_env.rb', line 2022
def wc is=(defined? @rc['program_set']['wc']) \
? @rc['program_set']['wc'] : ''
(is.nil? || is==true) ? 'wc' : is
end
|
#web_browser ⇒ Object
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
|
# File 'lib/sisu/se_info_env.rb', line 1943
def web_browser
if defined? @rc['program_select']['www_browser'] \
and @rc['program_select']['www_browser'] =~/\S\S+/
@rc['program_select']['www_browser']
elsif defined? @rc['program_select']['web_browser'] \
and @rc['program_select']['web_browser'] =~/\S\S+/
@rc['program_select']['web_browser']
else 'x-www-browser' end
end
|
#webrick ⇒ Object
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
|
# File 'lib/sisu/se_info_env.rb', line 1673
def webrick if defined? @rc['webserv_cgi']['host'] \
and @rc['webserv_cgi']['host'].is_a?(String)
http=if @rc['webserv_cgi']['host'] =~/http:\/\//
'http://'
elsif @rc['webserv_cgi']['host'] =~/https:\/\//
'https://'
else defaults
end
http + @rc['webserv_cgi']['host']
elsif webserv_host_base \
and webserv_host_base.is_a?(String)
webserv_host_base
else
'localhost'
end
end
|
#webrick_port ⇒ Object
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
|
# File 'lib/sisu/se_info_env.rb', line 1842
def webrick_port
if @md \
and @md.opt.act[:sample_search_form][:set]==:on \
and @md.opt.selections.str=~/port=(\d+)/
$1
else
if defined? @rc['webserv_cgi']['port']
if @rc['webserv_cgi']['port'].nil? \
and (defined? @md.opt.selections \
and @md.opt.selections.str=~/webrick/)
defaults[:webserv_port_cgi]
elsif not @rc['webserv_cgi']['port'].nil?
@rc['webserv_cgi']['port']
else defaults[:webserv_port_cgi]
end
else defaults[:webserv_port_cgi]
end
end
end
|
#webserv ⇒ Object
web url for local webserv (localhost, or hostname)
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
|
# File 'lib/sisu/se_info_env.rb', line 1132
def webserv 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
end
man_path_head=man_path.gsub(/(\S+)\/[^\/\s]+$/,'\1')
unless FileTest.directory?(man_path)
FileUtils::mkdir_p(man_path) if File.writable?("#{man_path_head}/.")
end
@webserv_path=if defined? man_path \
and File.writable?("#{man_path}/.")
man_path elsif FileTest.directory?(defaults[:webserv_path]) \
and File.writable?("#{defaults[:webserv_path]}/.") defaults[:webserv_path]
else unless FileTest.directory?(defaults[:output_local])
FileUtils::mkdir_p(defaults[:output_local])
end
defaults[:output_local]
end
end
|
#webserv_base ⇒ Object
web url for local webserv (localhost, or hostname)
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
|
# File 'lib/sisu/se_info_env.rb', line 1711
def webserv_base if path.webserv_dir \
and path.webserv =~ /#{path.webserv_dir}/ path.webserv + '/' \
+ @stub_pwd.
gsub(/#{path.webserv_dir}/,
"#{url.hostname}")
elsif defined? @rc['webserv']['webrick_url'] \
and @rc['webserv']['webrick_url']==false
"file://#{path.webserv}"
else "#{url.webrick_base}"
end
end
|
#webserv_base_cgi(opt = nil) ⇒ Object
web url for local webserv (localhost, or hostname)
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
|
# File 'lib/sisu/se_info_env.rb', line 1649
def webserv_base_cgi(opt=nil) http_cgi=if opt.selections.str =~/--webserv-(?:cgi|db|search)[=-]["']?(\S+)["']+/
m=$1
(m=~/http\/\/:/) ? m : %{http://#{m}}
elsif defined? @rc['webserv_cgi']['host'] \
and @rc['webserv_cgi']['host'].is_a?(String)
http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://')
if port.webserv_port_cgi(opt)
http + @rc['webserv_cgi']['host'] + ':' \
+ port.webserv_port_cgi(opt).to_s
else
http + @rc['webserv_cgi']['host']
end
else
http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://')
if port.webserv_port_cgi(opt)
http + webserv_host_base + ':' \
+ port.webserv_port_cgi(opt).to_s
else http + webserv_host_base
end
end
http_cgi=http_cgi.strip
end
|
#webserv_cgi(opt = nil) ⇒ Object
web url for local webserv (localhost, or hostname)
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
|
# File 'lib/sisu/se_info_env.rb', line 1624
def webserv_cgi(opt=nil) http=if defined? @rc['webserv_cgi']['host'] \
and @rc['webserv_cgi']['host'].is_a?(String)
http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') if port.webserv_port_cgi
http + @rc['webserv_cgi']['host'] + ':' \
+ port.webserv_port_cgi + '/' \
+ @stub_pwd
else
http + @rc['webserv_cgi']['host'] + '/' \
+ @stub_pwd
end
else
http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://')
if port.webserv_port_cgi(opt)
http + webserv_host_base + ':' \
+ port.webserv_port_cgi(opt) + '/'\
+ @stub_pwd
else
http + webserv_host_base + '/' \
+ @stub_pwd
end
end
http=http.strip
end
|
#webserv_dir ⇒ Object
fixed/hard path to /www web/presentation directory, on Debian /var/www subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name)
1170
1171
1172
|
# File 'lib/sisu/se_info_env.rb', line 1170
def webserv_dir defaults[:webserv_dir]
end
|
#webserv_files_from_db(opt = nil) ⇒ Object
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
|
# File 'lib/sisu/se_info_env.rb', line 1724
def webserv_files_from_db(opt=nil) if opt.selections.str =~/--webserv-output[=-]["']?(\S+)["']+/
m=$1
(m=~/(?:http|file\/)\/\/:/) ? m : %{http://#{m}}
else
show_output_on=if defined? @rc['webserv_cgi']['show_output_on']
@rc['webserv_cgi']['show_output_on']
elsif defined? @rc['webserv_cgi']['file_links']
@rc['webserv_cgi']['file_links']
else ''
end
m=case show_output_on
when /webserv_cgi/ then url.webserv_base_cgi(opt)
when /webserv/ then @rc['webserv']['url_root']
when /https?:\/\// then @rc['webserv_cgi']['file_links']
when /\S+/ then 'http://' + @rc['webserv_cgi']['file_links']
else webserv_base_cgi(opt)
end
end
end
|
#webserv_host_base(opt = nil) ⇒ Object
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
|
# File 'lib/sisu/se_info_env.rb', line 1614
def webserv_host_base(opt=nil)
if defined? @rc['webserv']['host']
case @rc['webserv']['host']
when /https?:\/\// then @rc['webserv']['host']
when /\S+/ then "http://#{@rc['webserv']['host']}"
else defaults[:webserv_host_cgi]
end
else defaults[:webserv_host_cgi]
end
end
|
#webserv_image ⇒ Object
web/presentation directory, subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name)
1173
1174
1175
1176
1177
1178
1179
|
# File 'lib/sisu/se_info_env.rb', line 1173
def webserv_image images=if defined? @rc['webserv']['images']
@rc['webserv']['images']
else defaults[:images]
end
"#{path.webserv}/#{images}"
end
|
#webserv_map_pwd ⇒ Object
1167
1168
1169
|
# File 'lib/sisu/se_info_env.rb', line 1167
def webserv_map_pwd "#{path.webserv}/#{base_markup_dir_stub}"
end
|
#webserv_stub_ensure ⇒ Object
1162
1163
1164
1165
1166
|
# File 'lib/sisu/se_info_env.rb', line 1162
def webserv_stub_ensure
FileUtils::mkdir_p(path.webserv) unless FileTest.directory?(path.webserv)
FileUtils::mkdir_p("#{path.webserv}/#{@base_markup_dir_stub}") \
unless FileTest.directory?("#{path.webserv}/#{@base_markup_dir_stub}")
end
|
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
|
# File 'lib/sisu/se_info_env.rb', line 575
def widget @rc=SiSU_Env::GetInit.new.sisu_yaml.rc
@ad=SiSU_Env::GetInit.new.ads
@html_bits=SiSU_Proj_HTML::Bits.new
@flag={
ad: false,
md: false,
sk: false,
rc: false
}
def promo?
@flag[:ad]=if @md.flag_promo \
&& @ad[:flag_promo]
@flag[:md]=true
true
elsif defined? @html_bits.widget_promo \
and not @html_bits.widget_promo.nil? \
and @html_bits.widget_promo.is_a?(Array) \
and @html_bits.widget_promo.length > 0
@flag[:sk]=true
true
elsif defined? @rc['html']['promo'] \
and not @rc['html']['promo'].nil? \
and @rc['html']['promo'].length > 0
@flag[:rc]=true
true
else false
end
@flag
end
def search?
searches=['sisu']
flag=false
if defined? @rc['search']
searches.each do |type|
flag=if defined? @rc['search'][type] \
and defined? @rc['search'][type]['action'] \
and @rc['search'][type]['flag']==true \
and @rc['search'][type]['action'] =~/https?:\/\//
flag=if promo?[:ad]
false
elsif defined? @html_bits.widget_search \
and @html_bits.widget_search==true
true
elsif defined? @rc['search'][type]['flag'] \
and @rc['search'][type]['flag']==true
true
else false
end
else false
end
end
else false
end
flag
end
def search_fixed?
searches=['sisu','hyperestraier']
flag=if defined? @rc['search']
searches.each do |type|
if defined? @rc['search'][type] \
and defined? @rc['search'][type]['action'] \
and @rc['search'][type]['action'] =~/https?:\/\// \
and defined? @rc['search'][type]['db'] \
and @rc['search'][type]['db'] =~/\S+/
flag=if promo?[:ad]
false
elsif defined? @html_bits.widget_search \
and @html_bits.widget_search==true
true
elsif defined? @rc['search'][type]['flag'] \
and @rc['search'][type]['flag']==true
true
else false
end
else false
end
end
else false
end
end
def search_form(type='sisusearch',action=nil,db=nil,table=false)
rc=SiSU_Env::GetInit.new.sisu_yaml.rc
create_form_sisu=if action \
and db \
and action =~/https?:\/\// \
and db =~/\S+/
true
elsif widget.search?
db=if rc['search']['sisu']['flag']==true \
and rc['search']['sisu']['db']=~/\S+/
(rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \
? rc['search']['sisu']['db']
: "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}"
else nil
end
action=rc['search']['sisu']['action']
true
elsif defined? rc['search']['sisu']['flag'] \
and defined? rc['search']['sisu']['action'] \
and rc['search']['sisu']['flag']==true \
and rc['search']['sisu']['action'] =~/https?:\/\//
true
else false
end
if table
table_open='<td align="center" bgcolor="#ffffff">'
table_close='</td>'
else
table_open=''
table_close='<br />'
end
form=if create_form_sisu \
and type=~/sisusearch/ \
and defined? rc['search']['sisu'] \
and defined? rc['search']['sisu']['action']
<<WOK
<!-- SiSU Search -->
#{table_open}
<a name="search"></a>
<form method="get" action="#{rc['search']['sisu']['action']}" target="_top">
<font size="2">
<input type="text" name="s1" size="24" maxlength="255" />
<input type="hidden" name="db" value="#{db}" />
<input type="hidden" name="ltd" value="1000" />
<input type="hidden" name="off" value="0" />
<input type="hidden" name="doc" value="#{@md.fnb}" /><br />
<input type="submit" name="search" value="search doc" />
<input type="submit" name="search" value="search db" />
</font></form>
#{table_close}
<!-- SiSU Search -->
WOK
else ''
end
form
end
def search_form_static(action=nil,db=nil)
rc=SiSU_Env::GetInit.new.sisu_yaml.rc
create_form=if rc['search']['sisu']['flag']==true \
and action \
and db \
and action =~/https?:\/\// \
and db =~/\S+/
true
elsif widget.search_fixed?
db=if rc['search']['sisu']['flag']==true \
and rc['search']['sisu']['db']=~/\S+/
(rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \
? rc['search']['sisu']['db']
: "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}"
else nil
end
action=rc['search']['sisu']['action']
true
else false
end
if create_form
%{<td align="center" bgcolor="#ffffff">
<!-- SiSU Search -->
<a name="search"></a>
<form method="get" action="#{rc['search']['sisu']['action']}" target="_top">
<font size="2">
<input type="text" name="s1" size="24" maxlength="255" />
<br />
<input type="hidden" name="db" value="#{db}" />
<input type="hidden" name="ltd" value="1000" />
<input type="hidden" name="off" value="0" />
<input type="hidden" name="doc" value="#{@md.fnb}" />
<input type="submit" name="search" value="search doc" />
<input type="submit" name="search" value="search db" />
</font>
</form>
<!-- SiSU Search -->
</td> }
else ''
end
end
def search_action if search?
else ''
end
end
self
end
|
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
|
# File 'lib/sisu/se_info_env.rb', line 760
def widget_static
@rc=SiSU_Env::GetInit.new.sisu_yaml.rc
@html_bits=SiSU_Proj_HTML::Bits.new
@flag={ ad: false, md: false, sk: false, rc: false }
def search?
flag=if defined? @rc['search'] \
and defined? @rc['search']['sisu'] \
and defined? @rc['search']['sisu']['action'] \
and @rc['search']['sisu']['action'] =~/https?:\/\// \
and defined? @rc['search']['sisu']['db'] \
and @rc['search']['sisu']['db'] =~/\S+/
flag=if defined? @html_bits.widget_search \
and @html_bits.widget_search==true
true
elsif defined? @rc['search']['sisu']['flag'] \
and @rc['search']['sisu']['flag']==true
true
else
false
end
else
false
end
end
def search_fixed?
flag=if defined? @rc['search'] \
and defined? @rc['search']['sisu'] \
and defined? @rc['search']['sisu']['action'] \
and @rc['search']['sisu']['action'] =~/https?:\/\// \
and defined? @rc['search']['sisu']['db'] \
and @rc['search']['sisu']['db'] =~/\S+/ \
and defined? @rc['search']['sisu']['db'] \
and @rc['search']['sisu']['db'] =~/\S+/
flag=if defined? @html_bits.widget_search \
and @html_bits.widget_search==true
true
elsif defined? @rc['search']['sisu']['flag'] \
and @rc['search']['sisu']['flag']==true
true
else
false
end
else
false
end
end
def search_form(action=nil,db=nil)
rc=SiSU_Env::GetInit.new.sisu_yaml.rc
create_form=if defined? rc['search']['sisu']['flag'] \
and rc['search']['sisu']['flag']==true \
and action \
and db \
and action =~/https?:\/\// \
and db =~/\S+/
true
elsif widget_static.search? \
and rc['search']['sisu']['flag']==true
db=if rc['search']['sisu']['db']=~/\S+/
(rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \
? rc['search']['sisu']['db']
: "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}"
else nil
end
action=rc['search']['sisu']['action']
true
else false
end
if create_form \
and @fnb \
and @fnb=~/\S+/
%{<!-- SiSU Search -->
<a name="search"></a>
<form method="get" action="#{rc['search']['sisu']['action']}" target="_top">
<font size="2">
<input type="text" name="s1" size="24" maxlength="255" />
<br />
<input type="hidden" name="db" value="#{db}" />
<input type="hidden" name="doc" value="#{@fnb}" />
<input type="submit" name="search" value="search doc" />
<input type="submit" name="search" value="search db" />
</font>
</form>
<!-- SiSU Search --> }
elsif create_form
%{<!-- SiSU Search -->
<a name="search"></a>
<form method="get" action="#{rc['search']['sisu']['action']}" target="_top">
<font size="2">
<input type="text" name="s1" size="24" maxlength="255" />
<br />
<input type="hidden" name="db" value="#{db}" />
<input type="submit" name="search" value="search db" />
</font>
</form>
<!-- SiSU Search --> }
else ''
end
end
def search_action if search?
else ''
end
end
self
end
|
#www_browser ⇒ Object
1953
1954
1955
|
# File 'lib/sisu/se_info_env.rb', line 1953
def www_browser
web_browser
end
|
#xml_docbook_ocn? ⇒ Boolean
521
522
523
524
525
526
|
# File 'lib/sisu/se_info_env.rb', line 521
def xml_docbook_ocn?
((defined? @rc['xml_docbook']['ocn']) \
&& @rc['xml_docbook']['ocn']==false) \
? @rc['xml_docbook']['ocn']
: true
end
|
#xml_editor ⇒ Object
1993
1994
1995
|
# File 'lib/sisu/se_info_env.rb', line 1993
def xml_editor
xml_viewer
end
|
#xml_fictionbook_ocn? ⇒ Boolean
527
528
529
530
531
532
|
# File 'lib/sisu/se_info_env.rb', line 527
def xml_fictionbook_ocn?
((defined? @rc['xml_fictionbook']['ocn']) \
&& @rc['xml_fictionbook']['ocn']==false) \
? @rc['xml_fictionbook']['ocn']
: true
end
|
#xml_scaffold_ocn? ⇒ Boolean
533
534
535
536
537
538
|
# File 'lib/sisu/se_info_env.rb', line 533
def xml_scaffold_ocn?
((defined? @rc['xml_scaffold']['ocn']) \
&& @rc['xml_scaffold']['ocn']==false) \
? @rc['xml_scaffold']['ocn']
: true
end
|
#xml_viewer ⇒ Object
1975
1976
1977
1978
1979
1980
|
# File 'lib/sisu/se_info_env.rb', line 1975
def xml_viewer
((defined? @rc['program_select']['xml_viewer']) \
&& @rc['program_select']['xml_viewer'] =~/\S\S+/) \
? @rc['program_select']['xml_viewer']
: text_editor
end
|
#yamlrc ⇒ Object
1121
1122
1123
|
# File 'lib/sisu/se_info_env.rb', line 1121
def yamlrc
GetInit.new.sisu_yaml.rc_path
end
|