diff options
-rw-r--r-- | CHANGELOG_v2 | 51 | ||||
-rw-r--r-- | conf/sisu/v2/sisurc.yml | 3 | ||||
-rw-r--r-- | data/doc/sisu/v2/CHANGELOG | 51 | ||||
-rw-r--r-- | data/sisu/v2/conf/editor-syntax-etc/vim/syntax/sisu.vim | 8 | ||||
-rw-r--r-- | data/sisu/v2/v/version.yml | 6 | ||||
-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 |
15 files changed, 351 insertions, 88 deletions
diff --git a/CHANGELOG_v2 b/CHANGELOG_v2 index 9b7a7c11..e55187cd 100644 --- a/CHANGELOG_v2 +++ b/CHANGELOG_v2 @@ -12,11 +12,56 @@ Reverse Chronological: %% Development branch UNSTABLE +%% 2.7.8.orig.tar.gz (2010-10-25:43/1) +http://www.jus.uio.no/sisu/pkg/src/sisu_2.7.8.orig.tar.gz + sisu_2.7.8.orig.tar.gz + sisu_2.7.8-1.dsc + sisu_2.7.8-1.diff.gz + + [debian freeze, fix] + + * i18n, introduce header @make: :language: internationalization using codes + from http://www.debian.org/international/l10n/po/ at this time for texpdf, + (able to satify needs of polyglossia for the likes of Brazilian Portugues) + and in future for po files, where iso:639 for this purpose appears to have + use limitations http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes + * param, extract @make: :language: information if provided, default + "english" + * i18n, add code list and associated language (as listed by polyglossia) + * texpdf_format, use param (@make: :language: (default english)), to set + tex document language header (previously used file naming convention) + * sisu.vim recognize @make: :language: + (also elsewhere shortened :lang_code: from :language_code:) + + * internal links + * dal, exclude parentheses and square brackets from matching + (requested fix, Ben Armstrong) + * html, remove space between link & following punctuation, parentheses &/or + square brackets + (requested fix, Ben Armstrong) + * epub, remove space between link & following punctuation, parentheses &/or + square brackets + + * html + * remove "copy @" mark + (requested, Daniel Baumann) + * segments, title banner (including "copy @" mark) configurable, boolean, + true/false (default false) + (requested off option, Daniel Baumann) + * quick ref links_guide configurable, boolean, true/false (default false) + (requested off option, Daniel Baumann) + + * config.yml + * html, seg title banner, boolean true/false setting (commented out, + default false) + * html, quick_ref, boolean true/false setting (commented out, default + false) + %% 2.7.7.orig.tar.gz (2010-10-17:41/7) http://www.jus.uio.no/sisu/pkg/src/sisu_2.7.7.orig.tar.gz - sisu_2.7.7.orig.tar.gz - sisu_2.7.7-1.dsc - sisu_2.7.7-1.diff.gz + 0a9befa48e6cfd62ecd7ee25febe1c4e1dc3f54eed8d89042f8d3519d3fff345 2747742 sisu_2.7.7.orig.tar.gz + e8f3c1f8a546fa5ff58a1e14e6e4b9288b4ef1c549f018539bcc88a7f58f3c7f 1196 sisu_2.7.7-1.dsc + 6ff81e70249e8f0a08897c99729b885969e5266135bd3a3f3ea506ab06d27936 288701 sisu_2.7.7-1.diff.gz [debian freeze, fix] diff --git a/conf/sisu/v2/sisurc.yml b/conf/sisu/v2/sisurc.yml index cb57891d..982274d1 100644 --- a/conf/sisu/v2/sisurc.yml +++ b/conf/sisu/v2/sisurc.yml @@ -87,6 +87,9 @@ default: # sqlite: # path: ~ # './sisu_sqlite.db' # port: "**" +#html: +# quick_ref: true #default false +# seg_title_banner: true #default false #% possible values ~, true, false, or command instruction e.g. editor: 'gvim -c :R -c :S'. #will only ignore if value set to false, absence or nil will not remove program as should operate without rc file #ie in case of ~ will ignore and use hard coded defaults within program), true, false, or command instruction e.g. editor: 'gvim -c :R -c :S' diff --git a/data/doc/sisu/v2/CHANGELOG b/data/doc/sisu/v2/CHANGELOG index ca439395..743786b4 100644 --- a/data/doc/sisu/v2/CHANGELOG +++ b/data/doc/sisu/v2/CHANGELOG @@ -12,11 +12,56 @@ Reverse Chronological: %% Development branch UNSTABLE +%% 2.7.8.orig.tar.gz (2010-10-25:43/1) +http://www.jus.uio.no/sisu/pkg/src/sisu_2.7.8.orig.tar.gz + sisu_2.7.8.orig.tar.gz + sisu_2.7.8-1.dsc + sisu_2.7.8-1.diff.gz + + [debian freeze, fix] + + * i18n, introduce header @make: :language: internationalization using codes + from http://www.debian.org/international/l10n/po/ at this time for texpdf, + (able to satify needs of polyglossia for the likes of Brazilian Portugues) + and in future for po files, where iso:639 for this purpose appears to have + use limitations http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes + * param, extract @make: :language: information if provided, default + "english" + * i18n, add code list and associated language (as listed by polyglossia) + * texpdf_format, use param (@make: :language: (default english)), to set + tex document language header (previously used file naming convention) + * sisu.vim recognize @make: :language: + (also elsewhere shortened :lang_code: from :language_code:) + + * internal links + * dal, exclude parentheses and square brackets from matching + (requested fix, Ben Armstrong) + * html, remove space between link & following punctuation, parentheses &/or + square brackets + (requested fix, Ben Armstrong) + * epub, remove space between link & following punctuation, parentheses &/or + square brackets + + * html + * remove "copy @" mark + (requested, Daniel Baumann) + * segments, title banner (including "copy @" mark) configurable, boolean, + true/false (default false) + (requested off option, Daniel Baumann) + * quick ref links_guide configurable, boolean, true/false (default false) + (requested off option, Daniel Baumann) + + * config.yml + * html, seg title banner, boolean true/false setting (commented out, + default false) + * html, quick_ref, boolean true/false setting (commented out, default + false) + %% 2.7.7.orig.tar.gz (2010-10-17:41/7) http://www.jus.uio.no/sisu/pkg/src/sisu_2.7.7.orig.tar.gz - sisu_2.7.7.orig.tar.gz - sisu_2.7.7-1.dsc - sisu_2.7.7-1.diff.gz + 0a9befa48e6cfd62ecd7ee25febe1c4e1dc3f54eed8d89042f8d3519d3fff345 2747742 sisu_2.7.7.orig.tar.gz + e8f3c1f8a546fa5ff58a1e14e6e4b9288b4ef1c549f018539bcc88a7f58f3c7f 1196 sisu_2.7.7-1.dsc + 6ff81e70249e8f0a08897c99729b885969e5266135bd3a3f3ea506ab06d27936 288701 sisu_2.7.7-1.diff.gz [debian freeze, fix] diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/syntax/sisu.vim b/data/sisu/v2/conf/editor-syntax-etc/vim/syntax/sisu.vim index 334d058c..2071fa5c 100644 --- a/data/sisu/v2/conf/editor-syntax-etc/vim/syntax/sisu.vim +++ b/data/sisu/v2/conf/editor-syntax-etc/vim/syntax/sisu.vim @@ -1,6 +1,6 @@ "SiSU Vim syntax file "SiSU Maintainer: Ralph Amissah <ralph@amissah.com> -"SiSU Markup: SiSU (sisu-2.6.2, 2010-07-10) +"SiSU Markup: SiSU (sisu-2.6.8, 2010-10-25) "(originally looked at Ruby Vim by Mirko Nasato) if version < 600 @@ -28,13 +28,13 @@ if !exists("sisu_no_identifiers") syn match sisu_require contains=@NoSpell "^<<\s*[a-zA-Z0-9^._-]\+\.ss[it]$" syn match sisu_require contains=@NoSpell "^<<{[a-zA-Z0-9^._-]\+\.ss[it]}$" syn match sisu_structure "^:A\~$" - syn match sisu_sub_header_title "^\s\+:\(subtitle\|short\|edition\|language\|language_char\|note\):\s" "group=sisu_header_content + syn match sisu_sub_header_title "^\s\+:\(subtitle\|short\|edition\|language\|lang_char\|note\):\s" "group=sisu_header_content syn match sisu_sub_header_creator "^\s\+:\(author\|contributor\|illustrator\|photographer\|translator\|digitized_by\|prepared_by\|audio\|video\):\s" " &hon &institution syn match sisu_sub_header_rights "^\s\+:\(copyright\|text\|translation\|illustrations\|photographs\|preparation\|digitization\|audio\|video\|license\|all\):\s" " access_rights license syn match sisu_sub_header_classify "^\s\+:\(topic_register\|coverage\|format\|identifier\|keywords\|relation\|subject\|type\|dewey\|loc\|oclc\|pg\|isbn\):\s" syn match sisu_sub_header_dates "^\s\+:\(added_to_site\|available\|created\|issued\|modified\|published\|valid\|translated\|original_publication\):\s" - syn match sisu_sub_header_original "^\s\+:\(publisher\|date\|language\|language_char\|institution\|nationality\|source\):\s" - syn match sisu_sub_header_make "^\s\+:\(headings\|num_top\|breaks\|italics\|bold\|emphasis\|plaintext_wrap\|texpdf_font\|skin\|stamp\|promo\|ad\|manpage\):\s" + syn match sisu_sub_header_original "^\s\+:\(publisher\|date\|language\|lang_char\|institution\|nationality\|source\):\s" + syn match sisu_sub_header_make "^\s\+:\(headings\|num_top\|breaks\|language\|italics\|bold\|emphasis\|plaintext_wrap\|texpdf_font\|skin\|stamp\|promo\|ad\|manpage\):\s" syn match sisu_sub_header_notes "^\s\+:\(abstract\comment\|description\|history\|prefix\|prefix_[ab]\|suffix\):\s" syn match sisu_sem_marker ";{\|};[a-z._]*[a-z]" syn match sisu_sem_marker_block "\([a-z][a-z._]*\|\):{\|}:[a-z._]*[a-z]" diff --git a/data/sisu/v2/v/version.yml b/data/sisu/v2/v/version.yml index 48cd5d90..58135bb9 100644 --- a/data/sisu/v2/v/version.yml +++ b/data/sisu/v2/v/version.yml @@ -1,5 +1,5 @@ --- -:version: 2.7.7 -:date_stamp: 2010w41/7 -:date: "2010-10-17" +:version: 2.7.8 +:date_stamp: 2010w43/1 +:date: "2010-10-25" :project: SiSU 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 |