aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/sysenv.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3/sysenv.rb')
-rw-r--r--lib/sisu/v3/sysenv.rb50
1 files changed, 25 insertions, 25 deletions
diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb
index 30ff2e9b..80069f9d 100644
--- a/lib/sisu/v3/sysenv.rb
+++ b/lib/sisu/v3/sysenv.rb
@@ -154,8 +154,8 @@ module SiSU_Env
PROCESSING_ENCODING=:processing_encoding
PROCESSING_GIT=:processing_git
PAPERSIZE=:papersize
- LANGUAGE=:language
- LANGUAGE_CODE=:language_code
+ #LANGUAGE=:language
+ #LANGUAGE_CODE=:language_code
MULTILINGUAL=:multilingual
BUNDLE=:bundle
CONCORD_MAX=:concord_max
@@ -198,8 +198,8 @@ module SiSU_Env
PROCESSING_GIT => processing_git,
#TEXINFO_STUB => 'texinfo',
PAPERSIZE => 'A4', #A4, US_letter, book_b5, book_a5, US_legal
- LANGUAGE => 'English',
- LANGUAGE_CODE => 'en', #change, unecessary duplication though currently used
+ #LANGUAGE => 'English',
+ #LANGUAGE_CODE => 'en', #change, unecessary duplication though currently used
MULTILINGUAL => false,
BUNDLE => false,
CONCORD_MAX => 260000,
@@ -823,10 +823,9 @@ module SiSU_Env
class Standardise_language
require_relative 'i18n' # i18n.rb
def initialize(l='')
- @language=l
- if @language.empty?
- @language=Info_env.new.defaults[:language]
- end
+ @language=(l.nil? || l.empty?) \
+ ? Info_env.new.language_default_set
+ : l
@r=%{(?:#{Px[:lng_lst].join('|')})}
@lang_info=SiSU_i18n::Languages.new
end
@@ -907,19 +906,12 @@ module SiSU_Env
lng
end
def name
- #lang(@language)[:n].downcase
- #lang[@language][:n].downcase
- #language[:n].downcase
language[:n].downcase
end
def title
- #lang(@language)[:n]
- #lang[@language][:n]
language[:n]
end
def code
- #lang[@language][:c]
- #lang(@language)[:c]
language[:c]
end
def tex_name
@@ -986,12 +978,13 @@ module SiSU_Env
@stub_md= @stub_pwd + '/sisu_site_metadata'
pt=Pathname.new(Dir.pwd)
stub=if output_dir_structure.by_language_code?
- stub=if Dir.pwd =~/.+?\/([^\/]+)(?:\/(en|fr|es)$)/
+ r=Px[:lng_lst].join('|')
+ 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='/' + 'en' #fix default language
+ lng_part='/' + language_default_set
base=pt.split[-1].to_s
end
base + lng_part
@@ -1026,6 +1019,12 @@ module SiSU_Env
? @rc['processing']['concord_max'] \
: (defaults[:concord_max])
end
+ def language_default_set #set directory (default) language
+ ((defined? @rc['default']['language']) \
+ && @rc['default']['language'] =~/\S+/) \
+ ? @rc['default']['language'] \
+ : 'en'
+ end
def markup_emphasis
if defined? @rc['default']['emphasis'] \
and @rc['default']['emphasis'] \
@@ -1849,15 +1848,16 @@ WOK
"#{processing}/epub/#{@fnb}"
end
def epub_bld #(md)
+ rm_rf(processing_path.epub) if FileTest.directory?(processing_path.epub)
mkdir_p(processing_path.epub) unless FileTest.directory?(processing_path.epub)
mkdir_p("#{processing_path.epub}/META-INF") unless FileTest.directory?("#{processing_path.epub}/META-INF")
- mkdir_p("#{processing_path.epub}/OPS/image") unless FileTest.directory?("#{processing_path.epub}/OPS/image")
- mkdir_p("#{processing_path.epub}/OPS/css") unless FileTest.directory?("#{processing_path.epub}/OPS/css")
+ mkdir_p("#{processing_path.epub}/#{Ep[:d_oebps]}/image") unless FileTest.directory?("#{processing_path.epub}/#{Ep[:d_oebps]}/image")
+ mkdir_p("#{processing_path.epub}/#{Ep[:d_oebps]}/css") unless FileTest.directory?("#{processing_path.epub}/#{Ep[:d_oebps]}/css")
images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png]
processing_path.epub
end
def epub_cp_images(md)
- pth="#{processing_path.epub}/OPS/image"
+ pth="#{processing_path.epub}/#{Ep[:d_oebps]}/image"
mkdir_p(pth) unless FileTest.directory?(pth)
src="#{path.share}/image"
images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png]
@@ -4447,27 +4447,27 @@ WOK
def epub
@pth=@env.processing_path.epub
def xhtml_index
- filename_index="#{@pth}/OPS/index.xhtml"
+ filename_index="#{@pth}/#{Ep[:d_oebps]}/index.xhtml"
File.new(filename_index,'w+')
end
def xhtml_segtoc
- filename_segtoc="#{@pth}/OPS/toc.xhtml"
+ filename_segtoc="#{@pth}/#{Ep[:d_oebps]}/toc.xhtml"
File.new(filename_segtoc,'w+')
end
def mimetype #fixed application/epub+zip ~/grotto/theatre/dbld/builds/epub_sample/mimetype
File.new("#{@pth}/mimetype",'w')
end
def metadata #variable matadata ~/grotto/theatre/dbld/builds/epub_sample/metadata.opf
- File.new("#{@pth}/OPS/epb.opf",'w')
+ File.new("#{@pth}/#{Ep[:d_oebps]}/#{Ep[:f_opf]}",'w')
end
def toc_ncx #variable toc ~/grotto/theatre/dbld/builds/epub_sample/toc.ncx
- File.new("#{@pth}/OPS/epb.ncx",'w')
+ File.new("#{@pth}/#{Ep[:d_oebps]}/#{Ep[:f_ncx]}",'w')
end
def metainf_cont #variable content ~/grotto/theatre/dbld/builds/epub_sample/META-INF/container.xml
File.new("#{@pth}/META-INF/container.xml",'w')
end
def xhtml_css #fixed epub xhtml css
- File.new("#{@pth}/OPS/css/xhtml.css",'w')
+ File.new("#{@pth}/#{Ep[:d_oebps]}/css/xhtml.css",'w')
end
self
end