From f0da30bc88c63cc1fc6c1941523caaae7cacebb2 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 8 Aug 2011 23:47:06 -0400 Subject: v2 v3: removed objects.txt, cleaning --- lib/sisu/v2/objects.txt | 42 ------------------------------------------ lib/sisu/v3/objects.txt | 42 ------------------------------------------ 2 files changed, 84 deletions(-) delete mode 100644 lib/sisu/v2/objects.txt delete mode 100644 lib/sisu/v3/objects.txt (limited to 'lib') diff --git a/lib/sisu/v2/objects.txt b/lib/sisu/v2/objects.txt deleted file mode 100644 index 3169099a..00000000 --- a/lib/sisu/v2/objects.txt +++ /dev/null @@ -1,42 +0,0 @@ -shared_doc_objects.rb -needed: - tables code poem group etc. - ocn numbers - hash numbers - -#consider a hash of: -:metadata or :header or @md? #with has or array of metadata, decide on which, may be possible to use param & @md -:substance, :text or :body #array of hash objects - -:obj #actual substantive text or content of object, :obj preferred to :txt as may contain any of the items described in :type -:type #which may be one of: paragraph, heading? code, verse, grouped text, table, image/figure? -:ocn #object citation number -:lv or :heading? #level, document structure, heading level -:name #html segment name and location name -:index #contain book index information if provided -:hash? #consider, need hash for clean and marked up text, then also for each footnote contained within the object -:meta #array or hash? :header and :data, however see suggestion that :header or :meta should be separate from :body or :substance - -#paragraph operation -indent 1-9 #if exists want to know how much to indent by, 1-9 -heading #isn't this synonymous with level? -#keep bold, italic attributes within text? - -# :obj container for -heading? -paragraph -grouped text -code -alt -poem / verse -table -image / figure - -comment #retain comments? - -later investigate use of extroprot (instead of or as well as Marshall) -consider making easy to represent also as XML - -consider: - additional structure fields to represent document, xml dom, node, sax, pro readily available, can be extended further, con, additional (metaverse) parsing to create them initialy - xml or html txt field? pro readily available, con bigger objects, more memory diff --git a/lib/sisu/v3/objects.txt b/lib/sisu/v3/objects.txt deleted file mode 100644 index c94e02c4..00000000 --- a/lib/sisu/v3/objects.txt +++ /dev/null @@ -1,42 +0,0 @@ -shared_doc_objects.rb -needed: - tables code poem block group etc. - ocn numbers - hash numbers - -#consider a hash of: -:metadata or :header or @md? #with has or array of metadata, decide on which, may be possible to use param & @md -:substance, :text or :body #array of hash objects - -:obj #actual substantive text or content of object, :obj preferred to :txt as may contain any of the items described in :type -:type #which may be one of: paragraph, heading? code, verse, block text, table, image/figure? -:ocn #object citation number -:lv or :heading? #level, document structure, heading level -:name #html segment name and location name -:index #contain book index information if provided -:hash? #consider, need hash for clean and marked up text, then also for each footnote contained within the object -:meta #array or hash? :header and :data, however see suggestion that :header or :meta should be separate from :body or :substance - -#paragraph operation -indent 1-9 #if exists want to know how much to indent by, 1-9 -heading #isn't this synonymous with level? -#keep bold, italic attributes within text? - -# :obj container for -heading? -paragraph -block text -code -alt -poem / verse -table -image / figure - -comment #retain comments? - -later investigate use of extroprot (instead of or as well as Marshall) -consider making easy to represent also as XML - -consider: - additional structure fields to represent document, xml dom, node, sax, pro readily available, can be extended further, con, additional (metaverse) parsing to create them initialy - xml or html txt field? pro readily available, con bigger objects, more memory -- cgit v1.2.3 From bd2ba361e5a61ee4f1e24370b2e1bf24d10e7d41 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 8 Aug 2011 23:49:51 -0400 Subject: v3: options, default action on running "sisu3 [filename.sst]", fix --- lib/sisu/v3/options.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index b5771590..6626870f 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -177,8 +177,10 @@ module SiSU_commandline @lngs = q[:lngs] if @files.length > 0 \ and @cmd.empty? \ - and @mod.length==0 #% if no other action called on filename given, default is sisu -0 [filename(s)] configured as flag default - @cmd=shortcut.cf_0 + and @mod.length==0 #% if no other action called on filename given, default is sisu --v3 -0 [filename(s)] configured as flag default + shortcut=SiSU_Env::Info_processing_flag.new + @mod=['--v3'] + @cmd=shortcut.cf_0 + 'm' end SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown if @cmd =~/[vVM]/ end -- cgit v1.2.3 From eb474533a94f2c10d74d771c2b782e101ee11e4c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 8 Aug 2011 23:54:45 -0400 Subject: v3: options, sysenv, sisurc.yml, set/config default language (code) * in absence of setting 'en' assumed * 'en' previously fixed --- lib/sisu/v3/options.rb | 18 +++++++++++------- lib/sisu/v3/sysenv.rb | 33 ++++++++++++++++----------------- 2 files changed, 27 insertions(+), 24 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index 6626870f..5b179a57 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -62,11 +62,12 @@ module SiSU_commandline require_relative 'sysenv' # sysenv.rb @@base_path=nil class Options - attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:base_path,:base_stub,:paths,:lngs,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:what + attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:base_path,:base_stub,:paths,:lngs,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:lng_base,:what def initialize(a) - @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,@lng,@base_path,@base_stub='','','','','','','','','','','','' + @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,@lng,@lng_base,@base_path,@base_stub='','','','','','','','','','','','','' @f_pths,@files,@paths,@mod,@act=Array.new(5){[]} @env=SiSU_Env::Info_env.new + @lng_base=@env.language_default_set @dir_structure_by=SiSU_Env::Env_call.new.output_dir_structure.by? @@base_path ||=Dir.pwd @base_path=@@base_path @@ -134,7 +135,7 @@ module SiSU_commandline end end r=Px[:lng_lst].join('|') - r.gsub!(/\|en\|/,'|') + r.gsub!(/\|#{@lng_base}\|/,'|') @lang_regx=%r{(?:#{r})} z=if find_flag if f.length > 0 @@ -144,7 +145,7 @@ module SiSU_commandline end elsif a.inspect =~/"(?:-\S+?|--\S+?)"/ \ && a.inspect =~/"#{@lang_regx}\/?"/ \ - && a.inspect =~/"en\/\S+?\.ss[tm]"/ + && a.inspect =~/"#{@lng_base}\/\S+?\.ss[tm]"/ init_selected_lang_dirs(a) else b end @@ -154,7 +155,7 @@ module SiSU_commandline def init_selected_lang_dirs(a) @z=[] a.each do |y| - if y =~/^en\/(\S+?\.ss[tm])$/ + if y =~/^#{@lng_base}\/(\S+?\.ss[tm])$/ @fn=$1 @z << y elsif y =~/^#{@lang_regx}\/?$/ @@ -219,13 +220,13 @@ module SiSU_commandline l_p elsif x =~/~(#{r})\.ss[tm]/ $1 - else 'en' + else lng_base end lng_is =if l_p l_p elsif x =~/~(#{r})\.ss[tm]/ $1 - else 'en' + else lng_base end f_pths << { pth: pt.split[0].realpath.to_s, @@ -588,6 +589,9 @@ module SiSU_commandline def lng @lng end + def lng_base + @lng_base + end def fns @fns end diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 30ff2e9b..c265b010 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'] \ -- cgit v1.2.3 From c610cd64a0b754a5623b2a91c7fe3220f7933ef9 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 8 Aug 2011 23:56:51 -0400 Subject: v3: po4a, make use of base directory (default) language setting * set original language, (instead of assuming English) (per directory or wider) --- lib/sisu/v3/po4a.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/po4a.rb b/lib/sisu/v3/po4a.rb index c87da346..a1f4991a 100644 --- a/lib/sisu/v3/po4a.rb +++ b/lib/sisu/v3/po4a.rb @@ -77,7 +77,7 @@ module SiSU_po4a r.gsub!(/\|en\|/,'|') @lang_regx=%r{(?:#{r})} if opt.fns =~/\S+?~#{@lang_regx}\.ss[mti]/ \ - and opt.f_pth[:lng]!='en' + and opt.f_pth[:lng]!=opt.lng_base @@opt_src_=false @@opt_trn=opt @@md_trn=SiSU_Param::Parameters.new(opt).get @@ -114,7 +114,7 @@ module SiSU_po4a SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{path}/#{md.fnb}/#{md.fn[:plain]}").flow if @opt.cmd =~/[MV]/ end if @opt.fns =~/\S+?~#{@lang_regx}\.ss[mti]/ \ - or @opt.f_pth[:lng] !='en' + or @opt.f_pth[:lng] !=opt.lng_base opt_lang_trn_fn=fn @dal_array_lang_translation=SiSU_DAL::Source.new(@opt,opt_lang_trn_fn).get # dal file drawn here opt_lang_src_fn=if fn =~/\S+?~\S{2}(?:_\S{2})?\.ss[mti]/ @@ -124,7 +124,7 @@ module SiSU_po4a transdir,srcdir=Dir.pwd,Dir.pwd if Dir.pwd.to_s =~/\/#{@lang_regx}$/ transdir=Dir.pwd - srcdir=transdir.gsub(/\/#{@lang_regx}$/,'/en') + srcdir=transdir.gsub(/\/#{@lang_regx}$/,"/#{opt.lng_base}") if FileTest.directory?(srcdir) Dir.chdir(srcdir) end @@ -924,7 +924,7 @@ GSUB @file=SiSU_Env::SiSU_file.new(md,fn) end def po4a #%pot output - file_pot=(@md.opt.f_pth[:lng] =='en') \ + file_pot=(@md.opt.f_pth[:lng] ==opt.lng_base) \ ? @file.write_file.pot \ : @file.write_file.po @sisu=[] @@ -955,7 +955,7 @@ GSUB require_relative 'git' # git.rb git=SiSU_Git::Source.new(@md.opt) git.create_file_structure_git unless FileTest.directory?(@file.output_path.pot_git.dir) - if @md.opt.f_pth[:lng] =='en' + if @md.opt.f_pth[:lng] ==opt.lng_base cp(@file.place_file.pot.dir, @file.output_path.pot_git.dir) else # naive, work on --> cp(@file.place_file.po.dir, @file.output_path.po_git.dir) #unless FileTest.file?(@file.place_file.po_git.dir) -- cgit v1.2.3 From a588b8f587a3af9ddfc06c1f0e71b51eb86890ba Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 9 Aug 2011 00:00:00 -0400 Subject: v3: prog_text_translation, add contents, remove some repetition --- lib/sisu/v3/prog_text_translation.rb | 49 ++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/prog_text_translation.rb b/lib/sisu/v3/prog_text_translation.rb index fca06e71..61fed18f 100644 --- a/lib/sisu/v3/prog_text_translation.rb +++ b/lib/sisu/v3/prog_text_translation.rb @@ -94,13 +94,9 @@ module SiSU_Translate else English.new(md,doc_lang,trans_str) end end - def filename @lang_class.filename end - def description - @lang_class.description - end def metadata @lang_class.metadata end @@ -146,6 +142,9 @@ module SiSU_Translate def digitized_by @lang_class.digitized_by end + def contents + @lang_class.contents + end def subject @lang_class.subject end @@ -161,9 +160,6 @@ module SiSU_Translate def rights @lang_class.rights end - def digitized_by - @lang_class.digitized_by - end def date @lang_class.date end @@ -323,9 +319,6 @@ module SiSU_Translate def filename 'filename' end - def description - 'description' - end def filetype_description 'filetype description' end @@ -368,6 +361,9 @@ module SiSU_Translate def digitized_by 'Digitized by' end + def contents + 'Contents' + end def subject #dc 'Subject' end @@ -538,9 +534,6 @@ module SiSU_Translate def filename 'nom de fichier' end - def description - 'description' - end def filetype_description description end @@ -583,6 +576,9 @@ module SiSU_Translate def digitized_by 'Numérisé par' end + def contents + 'Contents' #translate + end def subject #dc 'Sujet' end @@ -753,9 +749,6 @@ module SiSU_Translate def filename 'Dateiname' end - def description - 'Beschreibung' - end def filetype_description description end @@ -795,6 +788,9 @@ module SiSU_Translate def digitized_by 'digitalisiert von' end + def contents + 'Contents' #translate + end def subject 'Titel' end @@ -965,9 +961,6 @@ module SiSU_Translate def filename 'nombre del fichero' end - def description - 'descripción' - end def filetype_description description end @@ -1007,6 +1000,9 @@ module SiSU_Translate def digitized_by 'Digitalizado por' end + def contents + 'Contents' #translate + end def subject #dc 'Asunto' end @@ -1177,9 +1173,6 @@ module SiSU_Translate def filename 'nome del file' end - def description - 'descrizione' - end def filetype_description description end @@ -1219,6 +1212,9 @@ module SiSU_Translate def digitized_by 'Convertito in digitale da' end + def contents + 'Contents' #translate + end def subject #dc 'Oggetto' end @@ -1389,9 +1385,6 @@ module SiSU_Translate def filename 'tiedostonimi' end - def description - 'kuvaus' - end def filetype_description description end @@ -1431,6 +1424,9 @@ module SiSU_Translate def digitized_by 'Digitalisoinut' end + def contents + 'Contents' #translate + end def subject #dc 'aihe' end @@ -1597,6 +1593,9 @@ module SiSU_Translate class Portuguese < English end class Swedish < English + def contents + 'Innehåll' + end end class Danish < English end -- cgit v1.2.3 From 7c0a73469817e5882e376b0a435311599493123d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 9 Aug 2011 00:01:53 -0400 Subject: v3: texpdf, possibility to translate "Contents" for table of contents --- lib/sisu/v3/texpdf.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib') diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb index 9e223920..30775a3a 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -65,6 +65,7 @@ module SiSU_TeX require_relative 'texpdf_format' # texpdf_format.rb include SiSU_TeX_Pdf require_relative 'shared_metadata' # shared_metadata.rb + require_relative 'prog_text_translation' # prog_text_translation.rb @tex_file=@@tex_footnote_array=@@tex_col_w=[] @@tabular="{tabular}" @@column_instruct=@@squigle_close=@@tex_line_mode=@@tex_word_mode=@@line_mode='' @@ -287,6 +288,9 @@ module SiSU_TeX @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern @brace_url=SiSU_Viz::Skin.new.url_decoration vz=SiSU_Env::Get_init.instance.skin + l=SiSU_Env::Standardise_language.new(@md.opt.lng).language + @language=l[:n] + @translate=SiSU_Translate::Source.new(@md,@language) @skin_no_ocn=if defined? vz.ocn_display_off \ and vz.ocn_display_off==true true @@ -636,6 +640,7 @@ WOK x[:l] =< Date: Tue, 9 Aug 2011 00:02:54 -0400 Subject: v3: constants, re-arranged --- lib/sisu/v3/constants.rb | 290 +++++++++++++++++++++++++++-------------------- 1 file changed, 169 insertions(+), 121 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/constants.rb b/lib/sisu/v3/constants.rb index 918a581f..3357996b 100644 --- a/lib/sisu/v3/constants.rb +++ b/lib/sisu/v3/constants.rb @@ -57,130 +57,178 @@ ** Description: system environment, resource control and configuration details =end +#Ax,Xx,Mx,Rx,Hx,Dx,Px,Ep,Db,Gt,Tex=Array.new(11){{}} Sfx={ txt: '.txt', html: '.html', xhtml: '.xhtml', xml: '.xml', epub: '.epub', epub_xhtml: '.xhtml', odt: '.odt', pdf: '.pdf'} -Ax,Xx,Mx,Rx,Hx,Dx,Px,Db,Gt,Tex=Array.new(10){{}} -Ax[:tab]="\t" -Xx[:protect]='☞' -Xx[:segment]='Ф' -Xx[:html_relative2]='※※' #'※' '☼' -Xx[:html_relative1]='※' #'※' '☼' -Mx[:meta_o],Mx[:meta_c]='〔@','〕' -Mx[:lv_o_1],Mx[:lv_o_2],Mx[:lv_o_3],Mx[:lv_o_4],Mx[:lv_o_5],Mx[:lv_o_6],Mx[:lv_o_7],Mx[:lv_o_8],Mx[:lv_o_9]=1,2,3,4,5,6,7,8,9; -Mx[:lv_o],Mx[:lv_c]='〔','〕' -Mx[:en_a_o]='【'; Mx[:en_a_c]='】' #endnote Mx[:en_a_o]='~{'; Mx[:en_a_c]='}~' -Mx[:en_b_o]='〖'; Mx[:en_b_c]='〗' #endnote Mx[:en_b_o]='~['; Mx[:en_b_c]=']~' -Mx[:bl_o]='〔'; Mx[:bl_c]='〕' #block text mark -Mx[:gr_o]='〔'; Mx[:gr_c]='〕' #group text mark #REPLACE & RETIRE -Mx[:id_o]='〔'; Mx[:id_c]='〕' #object id mark -Mx[:tc_o]='『'; Mx[:tc_c]="』" #table row mark #Mx[:tc_c]="』\n" -Mx[:tc_p]='┆' #table col/misc mark -Mx[:pa_o]='〔'; Mx[:pa_c]='〕' #affects paragraph mark -Mx[:mk_o]='〔'; Mx[:mk_c]='〕' #generic mark -Mx[:gl_o]='〔'; Mx[:gl_c]='〕' #glyph -Mx[:fa_o]='〔'; Mx[:fa_o_c]='¤'; Mx[:fa_c_o]='¤'; Mx[:fa_c]='〕' -Mx[:fa_bold_o]= "#{Mx[:fa_o]}b#{Mx[:fa_o_c]}"; Mx[:fa_bold_c]= "#{Mx[:fa_c_o]}b#{Mx[:fa_c]}" -Mx[:fa_italics_o]= "#{Mx[:fa_o]}i#{Mx[:fa_o_c]}"; Mx[:fa_italics_c]= "#{Mx[:fa_c_o]}i#{Mx[:fa_c]}" -Mx[:fa_underscore_o]= "#{Mx[:fa_o]}u#{Mx[:fa_o_c]}"; Mx[:fa_underscore_c]= "#{Mx[:fa_c_o]}u#{Mx[:fa_c]}" -Mx[:fa_cite_o]= "#{Mx[:fa_o]}cite#{Mx[:fa_o_c]}"; Mx[:fa_cite_c]= "#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}" -Mx[:fa_insert_o]= "#{Mx[:fa_o]}ins#{Mx[:fa_o_c]}"; Mx[:fa_insert_c]= "#{Mx[:fa_c_o]}ins#{Mx[:fa_c]}" -Mx[:fa_strike_o]= "#{Mx[:fa_o]}del#{Mx[:fa_o_c]}"; Mx[:fa_strike_c]= "#{Mx[:fa_c_o]}del#{Mx[:fa_c]}" -Mx[:fa_superscript_o]="#{Mx[:fa_o]}sup#{Mx[:fa_o_c]}"; Mx[:fa_superscript_c]="#{Mx[:fa_c_o]}sup#{Mx[:fa_c]}" -Mx[:fa_subscript_o]= "#{Mx[:fa_o]}sub#{Mx[:fa_o_c]}"; Mx[:fa_subscript_c]= "#{Mx[:fa_c_o]}sub#{Mx[:fa_c]}" -Mx[:fa_hilite_o]= "#{Mx[:fa_o]}hi#{Mx[:fa_o_c]}"; Mx[:fa_hilite_c]= "#{Mx[:fa_c_o]}hi#{Mx[:fa_c]}" -Mx[:fa_monospace_o]= "#{Mx[:fa_o]}mono#{Mx[:fa_o_c]}"; Mx[:fa_monospace_c]= "#{Mx[:fa_c_o]}mono#{Mx[:fa_c]}" -Mx[:gl_bullet]= "#{Mx[:gl_o]}●#{Mx[:gl_c]}" - Mx[:pa_non_object_dummy_heading]="#{Mx[:pa_o]}-##{Mx[:pa_c]}" #unnumbered paragraph, delete when not required [used in dummy headings, eg. for segmented html] (place marker at end of paragraph) - Mx[:pa_non_object_no_heading]="#{Mx[:pa_o]}~##{Mx[:pa_c]}" #unnumbered paragraph (place marker at end of paragraph) -Mx[:idx_o]='▢ '; Mx[:idx_c]='▢ ' # -Mx[:nbsp]= '░' #'▭ ' -Mx[:br_line]= '╱' #lB ▌ 9612 ┘ ¶ -Mx[:br_nl]= '╲' #lB ▌ 』 ┘ -Mx[:br_paragraph]= '█' #FB █ 9608 # PP ∥ 8741 #▐ #'┘' #'¶' #FB █ 9608 lB ▌ 9612 RB ▐ 9616 -Mx[:br_obj]= 'break_obj'; Hx[:br_obj]= { obj: Mx[:br_obj] } # line sep -Mx[:br_page]= 'break_page'; Hx[:br_page]= { obj: Mx[:br_page] } # newpage -Mx[:br_page_new]= 'break_page_new'; Hx[:br_page_new]= { obj: Mx[:br_page_new] } # clearpage -Mx[:br_endnotes]= "#{Mx[:mk_o]}ENDNOTES#{Mx[:mk_c]}" -Mx[:br_eof]= "#{Mx[:mk_o]}EOF#{Mx[:mk_c]}" -Mx[:lnk_o]='⌠'; Mx[:lnk_c]='⌡' #'⌈' '⌋' '⌠' '⌡' #Mx[:lnk_o]='◁'; Mx[:lnk_c]='▷' #‹ › -Mx[:url_o]='「'; Mx[:url_c]='」' -Mx[:rel_o]='⌈'; Mx[:rel_c]='⌋' -Mx[:tag_o]='⌊'; Mx[:tag_c]='⌉' -Mx[:sm_set_o]='《'; Mx[:sm_set_c]='》' -Mx[:sm_subset_o]='《 '; Mx[:sm_subset_c]='》' -Mx[:vline]='┆' # ¦ | +Ax={ + tab: "\t", +} +Xx={ + protect: '☞', + segment: 'Ф', + html_relative2: '※※', #'※' '☼' + html_relative1: '※', #'※' '☼' +} +Mx={ + meta_o: '〔@', meta_c: '〕', + lv_o_1: 1, + lv_o_2: 2, + lv_o_3: 3, + lv_o_4: 4, + lv_o_5: 5, + lv_o_6: 6, + lv_o_7: 7, + lv_o_8: 8, + lv_o_9: 9, + lv_o: '〔', lv_c: '〕', + en_a_o: '【', en_a_c: '】', #endnote Mx[:en_a_o]='~{'; Mx[:en_a_c]='}~' + en_b_o: '〖', en_b_c: '〗', #endnote Mx[:en_b_o]='~['; Mx[:en_b_c]=']~' + bl_o: '〔', bl_c: '〕', #block text mark + gr_o: '〔', gr_c: '〕', #group text mark #REPLACE & RETIRE + id_o: '〔', id_c: '〕', #object id mark + tc_o: '『', tc_c: "』", #table row mark #Mx[:tc_c]="』\n" + tc_p: '┆', #table col/misc mark + pa_o: '〔', pa_c: '〕', #affects paragraph mark + mk_o: '〔', mk_c: '〕', #generic mark + gl_o: '〔', gl_c: '〕', #glyph + fa_o: '〔', fa_o_c: '¤', fa_c_o: '¤', fa_c: '〕', + idx_o: '▢ ', idx_c: '▢ ', + nbsp: '░', #'▭ ' + br_line: '╱', #lB ▌ 9612 ┘ ¶ + br_nl: '╲', #lB ▌ 』 ┘ + br_paragraph: '█', #FB █ 9608 # PP ∥ 8741 #▐ #'┘' #'¶' #FB █ 9608 lB ▌ 9612 RB ▐ 9616 + br_obj: 'break_obj', + br_page: 'break_page', + br_page_new: 'break_page_new', + lnk_o: '⌠', lnk_c: '⌡', #'⌈' '⌋' '⌠' '⌡' #Mx[:lnk_o: '◁'; Mx[:lnk_c: '▷' #‹ › + url_o: '「', url_c: '」', + rel_o: '⌈', rel_c: '⌋', + tag_o: '⌊', tag_c: '⌉', + sm_set_o: '《', sm_set_c: '》', + sm_subset_o: '《 ', sm_subset_c: '》', + vline: '┆', # ¦ | +} +Mx[:fa_bold_o]= "#{Mx[:fa_o]}b#{Mx[:fa_o_c]}" +Mx[:fa_bold_c]= "#{Mx[:fa_c_o]}b#{Mx[:fa_c]}" +Mx[:fa_italics_o]= "#{Mx[:fa_o]}i#{Mx[:fa_o_c]}" +Mx[:fa_italics_c]= "#{Mx[:fa_c_o]}i#{Mx[:fa_c]}" +Mx[:fa_underscore_o]= "#{Mx[:fa_o]}u#{Mx[:fa_o_c]}" +Mx[:fa_underscore_c]= "#{Mx[:fa_c_o]}u#{Mx[:fa_c]}" +Mx[:fa_cite_o]= "#{Mx[:fa_o]}cite#{Mx[:fa_o_c]}" +Mx[:fa_cite_c]= "#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}" +Mx[:fa_insert_o]= "#{Mx[:fa_o]}ins#{Mx[:fa_o_c]}" +Mx[:fa_insert_c]= "#{Mx[:fa_c_o]}ins#{Mx[:fa_c]}" +Mx[:fa_strike_o]= "#{Mx[:fa_o]}del#{Mx[:fa_o_c]}" +Mx[:fa_strike_c]= "#{Mx[:fa_c_o]}del#{Mx[:fa_c]}" +Mx[:fa_superscript_o]= "#{Mx[:fa_o]}sup#{Mx[:fa_o_c]}" +Mx[:fa_superscript_c]= "#{Mx[:fa_c_o]}sup#{Mx[:fa_c]}" +Mx[:fa_subscript_o]= "#{Mx[:fa_o]}sub#{Mx[:fa_o_c]}" +Mx[:fa_subscript_c]= "#{Mx[:fa_c_o]}sub#{Mx[:fa_c]}" +Mx[:fa_hilite_o]= "#{Mx[:fa_o]}hi#{Mx[:fa_o_c]}" +Mx[:fa_hilite_c]= "#{Mx[:fa_c_o]}hi#{Mx[:fa_c]}" +Mx[:fa_monospace_o]= "#{Mx[:fa_o]}mono#{Mx[:fa_o_c]}" +Mx[:fa_monospace_c]= "#{Mx[:fa_c_o]}mono#{Mx[:fa_c]}" +Mx[:gl_bullet]= "#{Mx[:gl_o]}●#{Mx[:gl_c]}" +Mx[:br_endnotes]= "#{Mx[:mk_o]}ENDNOTES#{Mx[:mk_c]}" +Mx[:br_eof]= "#{Mx[:mk_o]}EOF#{Mx[:mk_c]}" +Mx[:pa_non_object_dummy_heading]="#{Mx[:pa_o]}-##{Mx[:pa_c]}" #unnumbered paragraph, delete when not required [used in dummy headings, eg. for segmented html] (place marker at end of paragraph) +Mx[:pa_non_object_no_heading]="#{Mx[:pa_o]}~##{Mx[:pa_c]}" #unnumbered paragraph (place marker at end of paragraph) +Hx={ + br_obj: { obj: Mx[:br_obj] }, # line sep + br_page: { obj: Mx[:br_page] }, # newpage + br_page_new: { obj: Mx[:br_page_new] }, # clearpage +} #Mx[:sm_set_o]='∈ '; Mx[:sm_set_c]='∋ ' #Mx[:sm_subset_o]='∈ '; Mx[:sm_subset_c]='∋ ' -Rx[:mx_fa_clean]= /#{Mx[:fa_o]}.+?#{Mx[:fa_c]}|#{Mx[:pa_o]}.+?#{Mx[:pa_c]}|#{Mx[:mk_o]}.+?#{Mx[:mk_c]}/ -Rx[:lv],Rx[:lv_1],Rx[:lv_2],Rx[:lv_3],Rx[:lv_4],Rx[:lv_5],Rx[:lv_6],Rx[:lv_7],Rx[:lv_8],Rx[:lv_9]= - /〔([1-9]):(\S*?)〕/,/#{Mx[:lv_o_1]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_2]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_3]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_4]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_5]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_6]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_7]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_8]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_9]}(\S*?)#{Mx[:lv_c]}/ -Rx[:meta]=/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}/ -Dx[:url_o]='‹'; Dx[:url_c]='›' -Dx[:url_o_xml]='<'; Dx[:url_c_xml]='>' -Dx[:rel_o]='‹'; Dx[:rel_c]='›' # Dx[:rel_o]='「'; Dx[:rel_c]='」' -Dx[:lt_xml]='<'; Dx[:gt_xml]='>' -Tex[:backslash]="\\\\" -Tex[:backslash]="\\\\" -Tex[:tilde]='\\\\\\~' -#Px[:emphasis_o]= '*'; Px[:emphasis_c]= '*' -#Px[:bold_o]= '!'; Px[:bold_c]= '!' -Px[:bold_o]= '*'; Px[:bold_c]= '*' -Px[:italics_o]= '/'; Px[:italics_c]= '/' -Px[:underscore_o]= '_'; Px[:underscore_c]= '_' -Px[:cite_o]= '"'; Px[:cite_c]= '"' -Px[:insert_o]= '+'; Px[:insert_c]= '+' -Px[:strike_o]= '-'; Px[:strike_c]= '-' -Px[:superscript_o]= '^'; Px[:superscript_c]= '^' -Px[:subscript_o]= '['; Px[:subscript_c]= ']' -Px[:hilite_o]= '*'; Px[:hilite_c]= '*' -Px[:monospace_o]= ''; Px[:monospace_c]= '' -Px[:po_bold_o]= '!{'; Px[:po_bold_c]= '}!' -Px[:po_italics_o]= '/{'; Px[:po_italics_c]= '}/' -Px[:po_underscore_o]= '_{'; Px[:po_underscore_c]= '}_' -Px[:po_cite_o]= '"{'; Px[:po_cite_c]= '}"' -Px[:po_insert_o]= '+{'; Px[:po_insert_c]= '}+' -Px[:po_strike_o]= '-{'; Px[:po_strike_c]= '}-' -Px[:po_superscript_o]='^{'; Px[:po_superscript_c]='}^' -Px[:po_subscript_o]= ',{'; Px[:po_subscript_c]= '},' -Px[:po_hilite_o]= '*{'; Px[:po_hilite_c]= '}*' -Px[:po_monospace_o]= '#{'; Px[:po_monospace_c]= '}#' -Px[:lng_lst]=%w[am bg bn br ca cs cy da de el en eo es et eu fi fr ga gl he hi hr hy ia is it la lo lt lv ml mr nl nn no oc pl pt pt_BR ro ru sa se sk sl sq sr sv ta te th tk tr uk ur us vi] -#Px[:lng_lst]=%w[sq am hy eu bn pt_BR br bg ca hr cs da nl en eo et gl de el he hi is ia ga it fi fr lo la lv lt ml mr no nn oc pl pt ro ru se sa sr sk sl es sv ta te th tr tk uk ur vi cy us] -Px[:lv1]= '*' -Px[:lv2]= '=' -Px[:lv3]= '=' -Px[:lv4]= '-' -Px[:lv5]= '.' -Px[:lv6]= '.' -Db[:name_prefix]="SiSU#{SiSU_version_dir}e_" -Db[:name_prefix_db]="sisu_#{SiSU_version_dir}e_" -Db[:col_title]=800 -Db[:col_title_part]=400 -Db[:col_title_edition]=10 -Db[:col_name]=600 -Db[:col_creator_misc_short]=100 -Db[:col_language]=100 -Db[:col_language_char]=6 -Db[:col_date_text]=10 -Db[:col_classify_txt_long]=600 -Db[:col_classify_txt_short]=600 -Db[:col_classify_short]=200 -Db[:col_classify_identify]=256 -Db[:col_classify_library]=30 -Db[:col_classify_small]=16 -Db[:col_filename]=256 -Db[:col_digest]=64 -Db[:col_filesize]=10 -Db[:col_info_note]=2500 -Gt[:grotto]='sisu:' -Gt[:src]='src' -Gt[:pod]='pod' -Gt[:po]='po4a/po' -Gt[:pot]='po4a/pot' -Gt[:image]='mm/image' -Gt[:audio]='mm/audio' -Gt[:video]='mm/video' -Gt[:conf]='conf' -Gt[:skin]='conf/skin' #Gt[:skin]='conf/skin/doc' +Rx={ + mx_fa_clean: /#{Mx[:fa_o]}.+?#{Mx[:fa_c]}|#{Mx[:pa_o]}.+?#{Mx[:pa_c]}|#{Mx[:mk_o]}.+?#{Mx[:mk_c]}/, + lv: /〔([1-9]):(\S*?)〕/, + lv_1: /#{Mx[:lv_o_1]}(\S*?)#{Mx[:lv_c]}/, + lv_2: /#{Mx[:lv_o_2]}(\S*?)#{Mx[:lv_c]}/, + lv_3: /#{Mx[:lv_o_3]}(\S*?)#{Mx[:lv_c]}/, + lv_4: /#{Mx[:lv_o_4]}(\S*?)#{Mx[:lv_c]}/, + lv_5: /#{Mx[:lv_o_5]}(\S*?)#{Mx[:lv_c]}/, + lv_6: /#{Mx[:lv_o_6]}(\S*?)#{Mx[:lv_c]}/, + lv_7: /#{Mx[:lv_o_7]}(\S*?)#{Mx[:lv_c]}/, + lv_8: /#{Mx[:lv_o_8]}(\S*?)#{Mx[:lv_c]}/, + lv_9: /#{Mx[:lv_o_9]}(\S*?)#{Mx[:lv_c]}/, + meta: /#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}/, +} +Dx={ + url_o: '‹', url_c: '›', + url_o_xml: '<', url_c_xml: '>', + rel_o: '‹', rel_c: '›', + lt_xml: '<', gt_xml: '>', +} +Tex={ + backslash: "\\\\", + backslash: "\\\\", + tilde: '\\\\\\~', +} +Px={ + bold_o: '*', bold_c: '*', + italics_o: '/', italics_c: '/', + underscore_o: '_', underscore_c: '_', + #emphasis_o: '*', emphasis_c: '*', + #bold_o: '!', bold_c: '!', + cite_o: '"', cite_c: '"', + insert_o: '+', insert_c: '+', + strike_o: '-', strike_c: '-', + superscript_o: '^', superscript_c: '^', + subscript_o: '[', subscript_c: ']', + hilite_o: '*', hilite_c: '*', + monospace_o: '', monospace_c: '', + po_bold_o: '!{', po_bold_c: '}!', + po_italics_o: '/{', po_italics_c: '}/', + po_underscore_o: '_{', po_underscore_c: '}_', + po_cite_o: '"{', po_cite_c: '}"', + po_insert_o: '+{', po_insert_c: '}+', + po_strike_o: '-{', po_strike_c: '}-', + po_superscript_o: '^{', po_superscript_c: '}^', + po_subscript_o: ',{', po_subscript_c: '},', + po_hilite_o: '*{', po_hilite_c: '}*', + po_monospace_o: '#{', po_monospace_c: '}#', + lng_lst: %w[am bg bn br ca cs cy da de el en eo es et eu fi fr ga gl he hi hr hy ia is it la lo lt lv ml mr nl nn no oc pl pt pt_BR ro ru sa se sk sl sq sr sv ta te th tk tr uk ur us vi], + lv1: '*', + lv2: '=', + lv3: '=', + lv4: '-', + lv5: '.', + lv6: '.', +} +Db={ + name_prefix: "SiSU#{SiSU_version_dir}e_", + name_prefix_db: "sisu_#{SiSU_version_dir}e_", + col_title: 800, + col_title_part: 400, + col_title_edition: 10, + col_name: 600, + col_creator_misc_short: 100, + col_language: 100, + col_language_char: 6, + col_date_text: 10, + col_classify_txt_long: 600, + col_classify_txt_short: 600, + col_classify_short: 200, + col_classify_identify: 256, + col_classify_library: 30, + col_classify_small: 16, + col_filename: 256, + col_digest: 64, + col_filesize: 10, + col_info_note: 2500, +} +Gt={ + grotto: 'sisu:', + src: 'src', + pod: 'pod', + po: 'po4a/po', + pot: 'po4a/pot', + image: 'mm/image', + audio: 'mm/audio', + video: 'mm/video', + conf: 'conf', + skin: 'conf/skin', #Gt[:skin: 'conf/skin/doc' +} __END__ consider: 〔comment〕 -- cgit v1.2.3 From 532c0301d456758990609bdf65b718ce2f1f32ca Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 9 Aug 2011 00:06:18 -0400 Subject: v3: epub, constants, experiment with presentation * disable some internal "features" * make file and directory naming more flexible, now using 'OEBPS', 'toc.ncx', 'content.opf', * adjustment of some headers and general tuning * add opf guide * clean processing directory between each build * constants, added constants Ep (for epub) * constants, added DISABLE (used here with epub) --- lib/sisu/v3/constants.rb | 12 +++++ lib/sisu/v3/epub.rb | 9 ++-- lib/sisu/v3/epub_format.rb | 117 +++++++++++++++++++++++++++++++------------ lib/sisu/v3/epub_segments.rb | 2 +- lib/sisu/v3/sysenv.rb | 17 ++++--- lib/sisu/v3/urls.rb | 2 +- 6 files changed, 115 insertions(+), 44 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/constants.rb b/lib/sisu/v3/constants.rb index 3357996b..498ee1f3 100644 --- a/lib/sisu/v3/constants.rb +++ b/lib/sisu/v3/constants.rb @@ -195,6 +195,11 @@ Px={ lv5: '.', lv6: '.', } +Ep={ + d_oebps: 'OEBPS', + f_ncx: 'toc.ncx', + f_opf: 'content.opf', +} Db={ name_prefix: "SiSU#{SiSU_version_dir}e_", name_prefix_db: "sisu_#{SiSU_version_dir}e_", @@ -229,6 +234,13 @@ Gt={ conf: 'conf', skin: 'conf/skin', #Gt[:skin: 'conf/skin/doc' } +DISABLE={ + epub: { + internal_navigation: true, + per_section_title: true, + ncx_navpoint_unique_id: true, + }, +} __END__ consider: 〔comment〕 diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb index 2522b68a..83a0a795 100644 --- a/lib/sisu/v3/epub.rb +++ b/lib/sisu/v3/epub.rb @@ -198,7 +198,7 @@ module SiSU_EPUB toc=nil @@firstseg=nil @@toc={ seg: [], seg_mini: [], scr: [], ncx: [], opf: [] } - md_opf_a_content,md_opf_a_spine=[],[] + md_opf_a_content,md_opf_a_spine,md_opf_a_guide=[],[],[] @nav_no=1 @@toc[:ncx] << @epub.toc_ncx.open #epub ncx navmap @@toc[:ncx] << @epub.toc_ncx.head_open << @epub.toc_ncx.head << @epub.toc_ncx.head_close @@ -212,6 +212,7 @@ module SiSU_EPUB @@toc[:scr] << %{
\n
} md_opf_a_content << @epub.metadata_opf.manifest_content_sisu_toc md_opf_a_spine << @epub.metadata_opf.spine_sisu_toc + md_opf_a_guide << @epub.metadata_opf.guide_sisu_toc @ncxo=[nil,false,false,false,false,false,false] @dob_toc2,@dob_toc3=nil,nil @ncx_cls=[] @@ -254,6 +255,7 @@ module SiSU_EPUB @ncxo[4]=true md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc) md_opf_a_spine << @epub.metadata_opf.spine(dob_toc) + md_opf_a_guide << @epub.metadata_opf.guide(dob_toc) Toc.new(@md,dob_toc).level_4 when 5; Toc.new(@md,dob_toc).level_5 when 6; Toc.new(@md,dob_toc).level_6 @@ -288,6 +290,7 @@ module SiSU_EPUB @@toc[:ncx] << @epub.toc_ncx.close @@toc[:opf] << md_opf_a_content << @epub.metadata_opf.manifest_close @@toc[:opf] << @epub.metadata_opf.spine_open << md_opf_a_spine << @epub.metadata_opf.spine_close + @@toc[:opf] << @epub.metadata_opf.guide_open << md_opf_a_guide << @epub.metadata_opf.guide_close @@toc[:opf] << @epub.metadata_opf.package_close @@toc[:opf]=@@toc[:opf].flatten Epub_output.new(@md,@@toc[:opf]).epub_metadata_opf @@ -629,9 +632,9 @@ module SiSU_EPUB def images img_pth=@md.env.path.image_source_include @md.ec[:image].each do |x| - if FileTest.directory?("#{@md.env.processing_path.epub}/OPS/image") \ + if FileTest.directory?("#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image") \ and FileTest.file?("#{img_pth}/#{x}") - cp("#{img_pth}/#{x}","#{@md.env.processing_path.epub}/OPS/image") + cp("#{img_pth}/#{x}","#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image") end end end diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index 2a9af20e..6afae58b 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -1310,12 +1310,14 @@ WOK end def metainf_container #container.xml file in META-INF directory #simple, make sure full-path of rootfile points to metadata.opf - #epub_metadata.opf epb.opf + #epub_metadata.opf content.opf < - + - + WOK @@ -1335,6 +1337,9 @@ WOK end def open < + WOK end @@ -1353,11 +1358,13 @@ WOK < - - - - - + #{@md.title.full} by #{@md.author} + + + + + + WOK end def head_close @@ -1385,31 +1392,40 @@ WOK WOK end def navmap_sisu_toc(no) + id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ + ? '' \ + : "-#{no}" < + Table of Contents - + WOK end def navpoint(dob,no) + id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ + ? '' \ + : "-#{no}" < + #{dob.obj} - + WOK end def navpoint_top3(dob,no,name) + id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ + ? '' \ + : "-#{no}" < + #{dob.obj} - + WOK end def navpoint_close @@ -1433,6 +1449,8 @@ WOK manifest_close spine_open spine_close + guide_open + guide_close package_close end def package_open @@ -1563,12 +1581,16 @@ WOK %{\n #{rights}} else '' end + f=SiSU_Env::SiSU_file.new(@md) < + #{@md.title.full} #{author}#{editor}#{translator}#{illustrator}#{language}#{date_published}#{subject}#{rights} - ... - urn:uuid:#{@md.dgst[1]} + #{f.output_path.epub.url}/#{f.base_filename.epub} + urn:uuid:#{@md.dgst[1]} + WOK end @@ -1576,20 +1598,20 @@ WOK < - + - + WOK end def manifest_content_sisu_toc < + WOK end def manifest_content(dob) < + WOK end def manifest_images(imgs) @@ -1598,7 +1620,7 @@ WOK imgs.each do |i| image,type=/(\S+?)\.(png|jpg|gif)/.match(i)[1,2] images<<< + WOK end images=images.join('') @@ -1610,24 +1632,45 @@ WOK WOK end def spine_open - #spine: reading order of HTML files from manifest, idref attribute refers back to id in manifest (exclude images, CSS etc.). + #spine: reading order of XHTML files from manifest, idref attribute refers back to id in manifest (exclude images, CSS etc.). < WOK end def spine_sisu_toc < + WOK end def spine(dob) < + WOK end def spine_close < +WOK + end + def guide_open + #guide: presentation order of XHTML files by reader). + < +WOK + end + def guide_sisu_toc + < +WOK + end + def guide(dob) + < +WOK + end + def guide_close + < WOK end self @@ -1705,13 +1748,17 @@ WOK firstseg=%{ #{@vz.epub_png_nav_nxt} } if @md.firstseg =~/\S+/ - %{

#{firstseg}

} + DISABLE[:epub][:internal_navigation] \ + ? '' \ + : %{

#{firstseg}

} end def seg_head_navigation_band_bottom firstseg=%{ #{@vz.epub_png_nav_nxt} } if @md.firstseg =~/\S+/ - %{

#{firstseg}

} + DISABLE[:epub][:internal_navigation] \ + ? '' \ + : %{

#{firstseg}

} end def manifest_link(text) #watch fix removed font size 2 %{ #{text}} @@ -1888,7 +1935,9 @@ WOK #{@vz.epub_png_nav_nxt} } if f_nxt==true - %{

+ DISABLE[:epub][:internal_navigation] \ + ? '' \ + : %{

#{pre} #{toc} #{nxt} @@ -2215,13 +2264,19 @@ WOK } end def title_heading1 - title_heading('h1','tiny') + id_u=DISABLE[:epub][:per_section_title] \ + ? '' \ + : title_heading('h1','tiny') end def title_heading2 - title_heading('h2','tiny') + id_u=DISABLE[:epub][:per_section_title] \ + ? '' \ + : title_heading('h2','tiny') end def title_heading3 - title_heading('h3','tiny') + id_u=DISABLE[:epub][:per_section_title] \ + ? '' \ + : title_heading('h3','tiny') end def title_heading4 '' diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb index b9b75b9c..23af70f7 100644 --- a/lib/sisu/v3/epub_segments.rb +++ b/lib/sisu/v3/epub_segments.rb @@ -223,7 +223,7 @@ WOK end end if @@is4==1 - dir_epub_cont="#{@md.env.processing_path.epub}/OPS" + dir_epub_cont="#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}" if newfile==1 \ or dob.obj =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/ newfile=0 diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index c265b010..80069f9d 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -1848,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] @@ -4446,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 diff --git a/lib/sisu/v3/urls.rb b/lib/sisu/v3/urls.rb index d5698b53..5f9b8f00 100644 --- a/lib/sisu/v3/urls.rb +++ b/lib/sisu/v3/urls.rb @@ -261,7 +261,7 @@ module SiSU_urls if x=~/^e/ \ and @opt.cmd=~/e/ \ and x=~/^[#{@opt.cmd}]/ - SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.epub}/OPS/toc.xhtml").maintenance + SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.epub}/#{Ep[:d_oebps]}/toc.xhtml").maintenance end if x=~/^o/ \ and @opt.cmd=~/o/ \ -- cgit v1.2.3