diff options
author | Ralph Amissah <ralph@amissah.com> | 2010-10-30 23:48:54 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2010-10-30 23:48:54 -0400 |
commit | b70456bc6ffc452459b12741f1afc4f9f1fbfa4d (patch) | |
tree | 3dc850832a170047d70e41acd1465a1158dc809e /lib | |
parent | debian/changelog 2.7.7-1 (diff) | |
parent | texpdf_format, i18n, set tex document header language (polyglossia) (diff) |
Merge branch 'upstream' into debian/sid
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v2/dal_syntax.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v2/epub_tune.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v2/html.rb | 38 | ||||
-rw-r--r-- | lib/sisu/v2/html_format.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v2/html_segments.rb | 22 | ||||
-rw-r--r-- | lib/sisu/v2/html_tune.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v2/i18n.rb | 156 | ||||
-rw-r--r-- | lib/sisu/v2/param.rb | 22 | ||||
-rw-r--r-- | lib/sisu/v2/sysenv.rb | 12 | ||||
-rw-r--r-- | lib/sisu/v2/texpdf_format.rb | 56 |
10 files changed, 245 insertions, 75 deletions
diff --git a/lib/sisu/v2/dal_syntax.rb b/lib/sisu/v2/dal_syntax.rb index fbc62158..01604b65 100644 --- a/lib/sisu/v2/dal_syntax.rb +++ b/lib/sisu/v2/dal_syntax.rb @@ -384,11 +384,11 @@ module SiSU_Syntax "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3") #linked (text or image, however text cannot include modified face, e.g. bold, ital, underline) dob.obj.gsub!(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])((?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3}) - dob.obj.gsub!(/#{Mx[:lnk_c]}#(\S+?[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, + dob.obj.gsub!(/#{Mx[:lnk_c]}#(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, %{#{Mx[:lnk_c]}#{Mx[:rel_o]}\\1#{Mx[:rel_c]}\\2}) - dob.obj.gsub!(/#{Mx[:lnk_c]}:(\S+?[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, + dob.obj.gsub!(/#{Mx[:lnk_c]}:(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2}) - dob.obj.gsub!(/#{Mx[:lnk_c]}[.]{2}\/(\S+?[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, + dob.obj.gsub!(/#{Mx[:lnk_c]}[.]{2}\/(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2}) end if dob.obj=~/_(?:https?|ftp):\S+/m # _http://url #CHECK diff --git a/lib/sisu/v2/epub_tune.rb b/lib/sisu/v2/epub_tune.rb index e0c1e029..10583936 100644 --- a/lib/sisu/v2/epub_tune.rb +++ b/lib/sisu/v2/epub_tune.rb @@ -333,7 +333,7 @@ module SiSU_EPUB_Tune %{<img src="#{@env.url.images_epub}/\\1" naturalsizeflag="0" align="bottom" border="0" />}) end if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/ - @word_mode=dob.obj.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+/mu) + @word_mode=dob.obj.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)[()\[\]]*[,.;:!?'"]{0,2}|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+/mu) words=urls(@word_mode) dob.obj.gsub!(/.+/m,words) end diff --git a/lib/sisu/v2/html.rb b/lib/sisu/v2/html.rb index 309297df..c984a858 100644 --- a/lib/sisu/v2/html.rb +++ b/lib/sisu/v2/html.rb @@ -162,29 +162,33 @@ module SiSU_HTML @links_guide_toc=[] def initialize(data,md) @data,@md=data,md + @links_guide_=SiSU_Env::Create_site.new(@md.cmd).html_quick_ref? end def toc @links_guide_toc=[] - format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) - guide_type='horzontal' #values: horizontal or vertical - @links_guide_toc << format_head_toc.links_guide_open(guide_type) - if defined? @md.lnk \ - and @md.lnk - @md.lnk.each do |l| - if defined? l[:say] - target=if l[:url] !~/^\.(\.)?\//; 'external' - else '_top' + if @links_guide_ + format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) + guide_type='horzontal' #values: horizontal or vertical + @links_guide_toc << format_head_toc.links_guide_open(guide_type) + if defined? @md.lnk \ + and @md.lnk + @md.lnk.each do |l| + if defined? l[:say] + target=if l[:url] !~/^\.(\.)?\//; 'external' + else '_top' + end + s_lnk_url,s_lnk_lnk=l[:url],l[:say] + txt_obj={:lnk_url =>s_lnk_url,:lnk_txt =>s_lnk_lnk,:target =>target} + lev_dob_ocn=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + @links_guide_toc << lev_dob_ocn.links_guide if s_lnk_lnk end - s_lnk_url,s_lnk_lnk=l[:url],l[:say] - txt_obj={:lnk_url =>s_lnk_url,:lnk_txt =>s_lnk_lnk,:target =>target} - lev_dob_ocn=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) - @links_guide_toc << lev_dob_ocn.links_guide if s_lnk_lnk end end + format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) + @links_guide_toc << format_head_toc.links_guide_close #(guide_type) + @links_guide_toc + else '' end - format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) - @links_guide_toc << format_head_toc.links_guide_close #(guide_type) - @links_guide_toc end end class Endnotes @@ -545,8 +549,6 @@ WOK toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold end - toc_shared << format_head_toc.copyat - @segtoc << format_head_toc.copyat toc_shared << "#{@vz.table_close*1}\n" @segtoc << "#{@vz.table_close*1}\n" tmp_head=nil diff --git a/lib/sisu/v2/html_format.rb b/lib/sisu/v2/html_format.rb index 358fa293..c4758c5f 100644 --- a/lib/sisu/v2/html_format.rb +++ b/lib/sisu/v2/html_format.rb @@ -418,7 +418,7 @@ WOK #{@vz.table_close}} end end - def links_guide_vertical_open #??? + def links_guide_vertical_open url=((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/ ? @vz.url_hp : @vz.url_home) %{ <div id="vertical_links"> @@ -438,7 +438,7 @@ WOK </li> <!- quick ref -!>} end - def links_guide_horizontal_open #??? + def links_guide_horizontal_open url=((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/ ? @vz.url_hp : @vz.url_home) %{ <div id="horizontal_links"> diff --git a/lib/sisu/v2/html_segments.rb b/lib/sisu/v2/html_segments.rb index 33e56402..a516d809 100644 --- a/lib/sisu/v2/html_segments.rb +++ b/lib/sisu/v2/html_segments.rb @@ -64,6 +64,7 @@ module SiSU_HTML_seg class Seg_output def initialize(md,outputfile,seg,minitoc,type='') @md,@output_seg_file,@seg,@minitoc,@type=md,outputfile,seg,minitoc,type + @title_banner_=SiSU_Env::Create_site.new(@md.cmd).html_seg_title_banner? end def output if @seg[:title] =~/\S/ @@ -72,7 +73,9 @@ module SiSU_HTML_seg if @type=='endnotes' @seg[:headings]=[] format_head_seg=SiSU_HTML_Format::Head_seg.new(@md) - @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author) + if @title_banner_ + @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author) + end txt_obj={:txt =>'Endnotes',:ocn_display =>''} format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) @seg[:headings] << format_seg.title_heading1 @@ -80,7 +83,9 @@ module SiSU_HTML_seg elsif @type=='idx' @seg[:headings]=[] format_head_seg=SiSU_HTML_Format::Head_seg.new(@md) - @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author) + if @title_banner_ + @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author) + end txt_obj={:txt =>'Index',:ocn_display =>''} format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) @seg[:headings] << format_seg.title_heading1 @@ -89,7 +94,9 @@ module SiSU_HTML_seg metadata=Metadata::Summary.new(@md).xhtml_display.metadata @seg[:headings]=[] format_head_seg=SiSU_HTML_Format::Head_seg.new(@md) - @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author) + if @title_banner_ + @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author) + end txt_obj={:txt =>'Metadata',:ocn_display =>''} format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) @seg[:headings] << format_seg.title_heading1 @@ -122,11 +129,14 @@ module SiSU_HTML_seg @@dp,@@segtocband=nil,nil @@fns_previous='' attr_reader :seg_name_html,:seg_name_html_tracker - def initialize(md='',data='') + def initialize(md=nil,data='') @md,@data=md,data @vz=SiSU_Env::Get_init.instance.skin @seg_name_html=@@seg_name_html || nil @seg_name_html_tracker=@@tracker || nil + if @md + @title_banner_=SiSU_Env::Create_site.new(@md.cmd).html_seg_title_banner? + end end def songsheet begin @@ -299,7 +309,9 @@ module SiSU_HTML_seg end @@seg[:tocband_bannerless] << '<br />' << conditional_div_close << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) @@seg[:headings] << format_head_seg.seg_head_escript if SiSU_HTML_Format::Head_seg.method_defined? :seg_head_escript #debug PHP move up in text #bug - @@seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author).gsub(clean,'') + if @title_banner_ + @@seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author).gsub(clean,'') + end ocn=if @@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix else '' end diff --git a/lib/sisu/v2/html_tune.rb b/lib/sisu/v2/html_tune.rb index f4ad532f..9d3dce0b 100644 --- a/lib/sisu/v2/html_tune.rb +++ b/lib/sisu/v2/html_tune.rb @@ -305,7 +305,7 @@ module SiSU_HTML_Tune data.each do |dob| unless dob.is=='code' if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/ - @word_mode=dob.obj.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+/mu) + @word_mode=dob.obj.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)[()\[\]]*[,.;:!?'"]{0,2}|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+/mu) words=urls(@word_mode) dob.obj.gsub!(/.+/m,words) end #consider change, do a while loop diff --git a/lib/sisu/v2/i18n.rb b/lib/sisu/v2/i18n.rb index 2aa730be..c43daabe 100644 --- a/lib/sisu/v2/i18n.rb +++ b/lib/sisu/v2/i18n.rb @@ -56,6 +56,90 @@ ** Description: internationalisation =end +module SiSU_i18n + class Language + def initialize(md) + @md=md + end + def tex_name(char) + @lang=if char + case char + when 'sq'; 'albanian' + when 'am'; 'amharic' + #when 'ar'; 'arabic' # see polyglossia + when 'hy'; 'armenian' + #when ''; 'asturian' # polyglossia + #when ''; 'bahasai' # polyglossia + #when ''; 'bahasam' # polyglossia + when 'eu'; 'basque' + when 'bn'; 'bengali' + when 'pt_BR'; 'brazilian' + when 'br'; 'breton' + when 'bg'; 'bulgarian' + when 'ca'; 'catalan' # see polyglossia + #when ''; 'coptic' # polyglossia + when 'hr'; 'croatian' + when 'cs'; 'czech' + when 'da'; 'danish' + #when ''; 'divehi' # polyglossia + when 'nl'; 'dutch' # see polyglossia + when 'en'; 'english' # see polyglossia + when 'eo'; 'esperanto' # see polyglossia + when 'et'; 'estonian' + when 'gl'; 'galician' + when 'de'; 'german' + when 'el'; 'greek' #gl ? + when 'he'; 'hebrew' + when 'hi'; 'hindi' + when 'is'; 'icelandic' + when 'ia'; 'interlingua' + when 'ga'; 'irish' + when 'it'; 'italian' + #when ''; 'farsi' # polyglossia + when 'fi'; 'finnish' + when 'fr'; 'french' + when 'lo'; 'lao' + when 'la'; 'latin' + when 'lv'; 'latvian' + when 'lt'; 'lithuanian' + #when ''; 'lsorbian' # polyglossia + #when ''; 'magyar' # polyglossia + when 'ml'; 'malayalam' + when 'mr'; 'marathi' + #when 'hu'; 'magyar' + when 'no'; 'norske' + when 'nn'; 'nynorsk' + when 'oc'; 'occitan' + when 'pl'; 'polish' + when 'pt'; 'portuges' + when 'ro'; 'romanian' + when 'ru'; 'russian' + when 'se'; 'samin' #(check sami?) + when 'sa'; 'sanskrit' + when 'sr'; 'serbian' + #when ''; 'scottish' # polyglossia (gd (Gaelic (Scots))) + when 'sk'; 'slovak' + when 'sl'; 'slovenian' + when 'es'; 'spanish' + when 'sv'; 'swedish' + when 'ta'; 'tamil' + when 'te'; 'telugu' + when 'th'; 'thai' + when 'tr'; 'turkish' + when 'tk'; 'turkmen' + when 'uk'; 'ukrainian' + when 'ur'; 'urdu' + #when ''; 'usorbian' # polyglossia + when 'vi'; 'vietnamese' + when 'cy'; 'welsh' + when 'us'; 'USenglish' # depreciated, see iso-639-2 + else 'english' + end + else 'english' + end + end + end +end module SiSU_Translate require "#{SiSU_lib}/sysenv" # sysenv.rb include SiSU_Env; include SiSU_Param @@ -93,6 +177,7 @@ module SiSU_Translate else English.new(md,doc_lang,trans_str) end end + def filename @lang_class.filename end @@ -1623,3 +1708,74 @@ module SiSU_Translate end end __END__ +http://www.debian.org/international/l10n/po/ +http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes +http://www.loc.gov/standards/iso639-2/php/code_list.php +albanian sq +amharic am +arabic ar +armenian hy +asturian +bahasai +bahasam +basque eu +bengali bn +brazil[ian] pt_BR +breton br +bulgarian bg +catalan ca +coptic +croatian hr +czech cs +danish da +divehi +dutch nl +english en +esperanto eo +estonian et +galician gl +german de +greek el +hebrew he +hindi hi +icelandic is +interlingua ia +irish ga +italian it +farsi +finnish fi +french fr +lao lo +latin la +latvian lv +lithuanian lt +lsorbian +magyar +malayalam ml +marathi mr +norsk no +nynorsk nn +occitan oc +polish pl +portuges pt +romanian ro +russian ru +samin se (check sami?) +sanskrit sa +scottish # (gd (Gaelic (Scots))) +serbian sr +slovak sk +slovenian sl +spanish es +swedish sv +syriac # (ar_SY (Arabic, as spoken in Syrian Arab Republic)) +tamil ta +telugu te +thai th +turkish tr +turkmen tk +ukrainian uk +urdu ur +usorbian +vietnamese vi +welsh cy diff --git a/lib/sisu/v2/param.rb b/lib/sisu/v2/param.rb index 78cad7c6..207154b0 100644 --- a/lib/sisu/v2/param.rb +++ b/lib/sisu/v2/param.rb @@ -655,6 +655,14 @@ module SiSU_Param end {:page_new =>page_new, :page_break =>page_break} end + def language + l=if @h['language'] && (@h['language']=~/\S{2,}/) + ((@h['language'] =~/,/) \ + ? (@h['language'].split(/,\s*/)) \ + : [ @h['language'] ]) + else [ 'en' ] + end + end def bold m=@h['bold'] x=(m=~/\/i$/)? 'i' : '' @@ -811,9 +819,9 @@ module SiSU_Param @doc={ :lv=>[] } @doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','','' @@publisher='SiSU scribe' - attr_accessor :cmd,:make,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:markup_version,:markup_declared,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:links,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:lang,:en,:notes,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy + attr_accessor :cmd,:make,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:markup_version,:markup_declared,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:links,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:i18n,:lang,:en,:notes,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy def initialize(fns_array,opt) - @env=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@num_top=@toc_lev_limit=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@links=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@filesize=@firstseg=@programs=@author_copymark=@lang=@en=@notes=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=nil + @env=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@num_top=@toc_lev_limit=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@links=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@filesize=@firstseg=@programs=@author_copymark=@i18n=@lang=@en=@notes=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=nil @data,@fns,@cmd,@mod,@opt=fns_array,opt.fns,opt.cmd,opt.mod,opt #@data used as data @flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo,@book_idx=false,false,false,false,false,false,false @seg_autoname_safe=true @@ -1003,6 +1011,10 @@ module SiSU_Param and @make.num_top @num_top=@make.num_top # remove @num_top end + if defined? @make.language \ + and @make.language[0] + @i18n=@make.language + end if defined? @make.skin \ and @make.skin @doc_skin=@make.skin @@ -1159,6 +1171,12 @@ module SiSU_Param end @topic_register_array.sort! end + if @i18n + @i18n.uniq! + @i18n << 'en' unless @i18n.find_index("en") + else + @i18n=[ en ] + end if @markup_version.determined >= 0.38 #convert values in headers to internal representation translated=[] translate_list=[@pagenew,@pagebreak,@num_top,@toc_lev_limit] diff --git a/lib/sisu/v2/sysenv.rb b/lib/sisu/v2/sysenv.rb index 395559a8..ed955006 100644 --- a/lib/sisu/v2/sysenv.rb +++ b/lib/sisu/v2/sysenv.rb @@ -3260,6 +3260,18 @@ WOK filename_homepage_toc << @vz_home.homepage end end + def html_seg_title_banner? + ((defined? @rc['html']['seg_title_banner']) \ + && @rc['html']['seg_title_banner']==true) \ + ? @rc['html']['seg_title_banner'] \ + : false + end + def html_quick_ref? + ((defined? @rc['html']['quick_ref']) \ + && @rc['html']['quick_ref']==true) \ + ? @rc['html']['quick_ref'] \ + : false + end def cp_images(src_path,dest_path) if FileTest.directory?(src_path) cd(src_path) diff --git a/lib/sisu/v2/texpdf_format.rb b/lib/sisu/v2/texpdf_format.rb index 9ebef9dc..465d4d90 100644 --- a/lib/sisu/v2/texpdf_format.rb +++ b/lib/sisu/v2/texpdf_format.rb @@ -604,6 +604,7 @@ module SiSU_TeX_Pdf end end class Format_head + require "#{SiSU_lib}/i18n" # defaults.rb def initialize(md,t_o) @md,@t_o=md,t_o @env=SiSU_Env::Info_env.new(@md.fns) @@ -621,47 +622,16 @@ module SiSU_TeX_Pdf @brace_url=SiSU_Viz::Skin.new.url_decoration @tex2pdf=@@tex3pdf ||=SiSU_Env::System_call.new.tex2pdf_engine @ps=@txt if @txt=~/(?:a4|letter|legal|book|a5|b5)/i - end - def language - @lang=if @md.language[:code] - case @md.language[:code] - when 'en'; 'english' - when 'us'; 'USenglish' # depreciated, see iso-639-2 - when 'fr'; 'french' - when 'de'; 'ngerman' - when 'it'; 'italian' - when 'es'; 'spanish' - when 'pt'; 'portuges' - #when 'br'; 'brazilian' # depreciated, see iso-639-2 - when 'sv'; 'swedish' - when 'da'; 'danish' - when 'fi'; 'finnish' - when 'no'; 'norske,nynorsk' - when 'is'; 'icelandic' - when 'nl'; 'dutch' - when 'et'; 'estonian' - when 'hu'; 'magyar' - when 'pl'; 'polish' - when 'ro'; 'romanian' - when 'ru'; 'russian' - when 'gl'; 'greek' - when 'uk'; 'ukrainian' - when 'tr'; 'turkish' - when 'sk'; 'slovak' - when 'sl'; 'slovenian' - when 'hr'; 'croatian' - when 'cs'; 'czech' - when 'bg'; 'bulgarian' - else 'english' - end - else 'english' - end + @lang ||=SiSU_i18n::Language.new(@md) end def tex_head_lang #babel 18n - language - lang=if @lang =~/^(?:en)$/; @lang - else "#{@lang},english" - end + lang_char_arr=@md.i18n + mainlang_char=lang_char_arr.slice(0) + mainlang=@lang.tex_name(mainlang_char) + otherlang=[] + lang_char_arr.slice(1..9).each { |ch| otherlang << @lang.tex_name(ch) } + otherlang=otherlang.join(',') + { :mainlang=>mainlang, :otherlang=>otherlang } end def tex_head_encode texpdf_font=if defined? @md.make.texpdf_font \ @@ -674,8 +644,8 @@ module SiSU_TeX_Pdf when /xe/ <<WOK \\usepackage{polyglossia, ucs, fontspec, xltxtra, xunicode} -\\setmainlanguage{#{tex_head_lang}} -\\setotherlanguage{english} +\\setmainlanguage{#{tex_head_lang[:mainlang]}} +\\setotherlanguage{#{tex_head_lang[:otherlang]}} \\setmainfont{#{texpdf_font}} WOK when /pdf/ @@ -913,7 +883,7 @@ WOK end def document_head_with_orientation endnotes=("\\usepackage{endnotes}" if @txt =~/endnotes?/)||'' #not implemented see also def endnotes - language + @lang.tex_name(@md.i18n[0]) <<WOK #{tex_head_paper} #{tex_head_encode} @@ -976,7 +946,7 @@ WOK {-\\baselineskip}{0.5\\baselineskip}% {\\normalfont\\normalsize\\itshape\\raggedright}} % \\makeatother -\\selectlanguage{#{language}} +\\selectlanguage{#{@lang.tex_name(@md.i18n[0])}} WOK end def a4generic |