diff options
author | Ralph Amissah <ralph@amissah.com> | 2011-05-23 21:23:30 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2011-05-23 21:27:08 -0400 |
commit | a11485b8aa86780677c7a5ac415551e559e5961c (patch) | |
tree | 6d9bf5d421518c2faa790b3fa30c950731273ced /lib | |
parent | v3: prog_text_translation, language class name fix; languge name matching (diff) |
v3: param, html, epub, xml, simplify file-naming with language code
* language code occurs in fixed location within file-name (could previously do
so in 1 of 3 configured locations)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v3/concordance.rb | 12 | ||||
-rw-r--r-- | lib/sisu/v3/epub.rb | 10 | ||||
-rw-r--r-- | lib/sisu/v3/epub_concordance.rb | 10 | ||||
-rw-r--r-- | lib/sisu/v3/epub_format.rb | 22 | ||||
-rw-r--r-- | lib/sisu/v3/epub_segments.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v3/html.rb | 10 | ||||
-rw-r--r-- | lib/sisu/v3/html_format.rb | 22 | ||||
-rw-r--r-- | lib/sisu/v3/html_minitoc.rb | 10 | ||||
-rw-r--r-- | lib/sisu/v3/html_segments.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v3/param.rb | 9 | ||||
-rw-r--r-- | lib/sisu/v3/xml_format.rb | 22 |
11 files changed, 68 insertions, 65 deletions
diff --git a/lib/sisu/v3/concordance.rb b/lib/sisu/v3/concordance.rb index 72031419..91b63778 100644 --- a/lib/sisu/v3/concordance.rb +++ b/lib/sisu/v3/concordance.rb @@ -212,17 +212,17 @@ WOK end protected def location_scroll(wordlocation,show) - %{<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}\##{wordlocation}">#{wordlocation}</a>; } + %{<a href="doc#{@md.lang_code_insert}#{Sfx[:html]}\##{wordlocation}">#{wordlocation}</a>; } end def location_seg(wordlocation,show) ##fix - @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"#{@md.fnl[:pre]}\\1#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}#\\2") unless wordlocation.nil? + @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"\\1#{@md.lang_code_insert}#{Sfx[:html]}#\\2") unless wordlocation.nil? case wordlocation when @rxp_t1 - %{[<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}##{show}">H</a>]#{show}, } + %{[<a href="doc#{@md.lang_code_insert}#{Sfx[:html]}##{show}">H</a>]#{show}, } when @rxp_t2 - %{[<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}##{show}">H</a>]#{show}, } + %{[<a href="doc#{@md.lang_code_insert}#{Sfx[:html]}##{show}">H</a>]#{show}, } when @rxp_t3 - %{[<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}##{show}">H</a>]#{show}, } + %{[<a href="doc#{@md.lang_code_insert}#{Sfx[:html]}##{show}">H</a>]#{show}, } else %{<a href="#{@word_location_seg}">#{show}</a>, } end end @@ -337,7 +337,7 @@ WOK end credits=@vz.credits_sisu @file_concordance << %{</div></body>\n</html>} # footer - SiSU_Screen::Ansi.new(@opt.cmd,@md.fns,"#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}").flow if @md.opt.cmd =~/[MV]/ + SiSU_Screen::Ansi.new(@md.opt.cmd,@md.fns,"#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}").flow if @md.opt.cmd =~/[MV]/ end end end diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb index 422c1e68..7293c601 100644 --- a/lib/sisu/v3/epub.rb +++ b/lib/sisu/v3/epub.rb @@ -310,7 +310,7 @@ module SiSU_EPUB title=if dob.obj !~/Document Information/; linkname else link='metadata' - %{<b><a href="#{@md.fnl[:pre]}#{link}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}">#{linkname}</a></b>} + %{<b><a href="#{link}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}">#{linkname}</a></b>} end toc={} txt_obj={ txt: title } @@ -395,13 +395,13 @@ module SiSU_EPUB linkname,ocn=dob.obj.strip,dob.ocn p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) if ocn if dob.ln==4 - seg_link=%{ <a href="#{@md.fnl[:pre]}#{dob.name}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}"> + seg_link=%{ <a href="#{dob.name}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}"> #{dob.obj} </a> } @@seg_url=dob.name elsif dob.obj =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/ seg_link=dob.obj.gsub(/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/, - %{<a href="#{@md.fnl[:pre]}\\1#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}">} + + %{<a href="\\1#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}">} + %{\\1 \\2</a> }) end p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) if ocn @@ -423,7 +423,7 @@ module SiSU_EPUB if ocn \ and ocn !~/#/ p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) - lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}#o#{ocn}"> + lnk_n_txt=%{ <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}#o#{ocn}"> #{linkname} </a>} txt_obj={ txt: lnk_n_txt } @@ -444,7 +444,7 @@ module SiSU_EPUB if ocn \ and ocn !~/#/ p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) - lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}#o#{ocn}"> + lnk_n_txt=%{ <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}#o#{ocn}"> #{linkname} </a>} txt_obj={ txt: lnk_n_txt } diff --git a/lib/sisu/v3/epub_concordance.rb b/lib/sisu/v3/epub_concordance.rb index 205f4f22..687155d2 100644 --- a/lib/sisu/v3/epub_concordance.rb +++ b/lib/sisu/v3/epub_concordance.rb @@ -185,18 +185,18 @@ WOK protected def location_scroll(wordlocation,show) @wordlocation=wordlocation - %{<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}\##{@wordlocation}">#{@wordlocation}</a>; } + %{<a href="doc#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}\##{@wordlocation}">#{@wordlocation}</a>; } end def location_seg(wordlocation,show) @wordlocation,@show=wordlocation,show - @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"#{@md.fnl[:pre]}\\1#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}#o\\2") unless wordlocation.nil? + @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"\\1#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}#o\\2") unless wordlocation.nil? case @wordlocation when @rxp_t1 - %{[<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}##{@show}">H</a>]#{@show}, } + %{[<a href="doc#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}##{@show}">H</a>]#{@show}, } when @rxp_t2 - %{[<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}##{@show}">H</a>]#{@show}, } + %{[<a href="doc#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}##{@show}">H</a>]#{@show}, } when @rxp_t3 - %{[<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}##{@show}">H</a>]#{@show}, } + %{[<a href="doc#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}##{@show}">H</a>]#{@show}, } else %{<a href="#{@word_location_seg}">#{@show}</a>, } end end diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index 5af5c0b4..e75ad112 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -1196,13 +1196,13 @@ WOK } end def seg_head_navigation_band - firstseg=%{<a href="#{@md.fnl[:pre]}#{@md.firstseg}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top"> + firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top"> #{@vz.epub_png_nav_nxt} </a>} if @md.firstseg =~/\S+/ %{<p class="align_right">#{firstseg}</p>} end def seg_head_navigation_band_bottom - firstseg=%{<a href="#{@md.fnl[:pre]}#{@md.firstseg}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top"> + firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top"> #{@vz.epub_png_nav_nxt} </a>} if @md.firstseg =~/\S+/ %{<p class="align_right">#{firstseg}</p>} @@ -1335,17 +1335,17 @@ WOK def dot_control_pre_next %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> <tr><td align="left"> - <a href="#{@md.fnl[:pre]}#{@seg_name_xhtml[@seg_name_xhtml_tracker-1]}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}> + <a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker-1]}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_prev}> #{@vz.png_nav_dot_pre} </a> </td> <td align="center"> - <a href="#{@md.fnl[:pre]}#{@index}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}> + <a href="#{@index}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_toc}> #{@vz.png_nav_dot_toc} </a> </td> <td align="right"> - <a href="#{@md.fnl[:pre]}#{@seg_name_xhtml[@seg_name_xhtml_tracker+1]}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_next}> + <a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker+1]}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_next}> #{@vz.png_nav_dot_nxt} </a> #{@vz.table_close}} @@ -1353,12 +1353,12 @@ WOK def dot_control_pre %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> <tr><td align="left"> - <a href="#{@md.fnl[:pre]}#{@seg_name_xhtml[@seg_name_xhtml_tracker-1]}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}> + <a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker-1]}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_prev}> #{@vz.png_nav_dot_pre} </a> </td> <td align="center"> - <a href="#{@md.fnl[:pre]}#{@index}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}> + <a href="#{@index}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_toc}> #{@vz.png_nav_dot_toc} </a> </td> @@ -1370,15 +1370,15 @@ WOK end def toc_nav(f_pre=false,f_nxt=false,use=1) pre=nxt='' - toc=%{<a href="#{@md.fnl[:pre]}#{@index}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}> + toc=%{<a href="#{@index}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_toc}> #{@vz.epub_png_nav_toc} </a> } - pre=%{<a href="#{@md.fnl[:pre]}#{@seg_name_xhtml[@seg_name_xhtml_tracker-use]}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}> + pre=%{<a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker-use]}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_prev}> #{@vz.epub_png_nav_pre} </a> } if f_pre==true - nxt=%{<a href="#{@md.fnl[:pre]}#{@seg_name_xhtml[@seg_name_xhtml_tracker+1]}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_next}> + nxt=%{<a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker+1]}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_next}> #{@vz.epub_png_nav_nxt} </a> } if f_nxt==true @@ -1861,7 +1861,7 @@ WOK fn='doc' if fn.to_s.empty? #you may wish to reconsider, sends to 'doc' where no segment info %{ <p class="endnote"> - #{@endnote_part_a}#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}#{@endnote_part_b} + #{@endnote_part_a}#{fn}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}#{@endnote_part_b} </p> } end diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb index a21a64a7..ed8c8d39 100644 --- a/lib/sisu/v3/epub_segments.rb +++ b/lib/sisu/v3/epub_segments.rb @@ -231,7 +231,7 @@ WOK and dob.ln==4 if tracking != 0 Seg.new(@md).tail - segfilename="#{dir_epub_cont}/#{@md.fnl[:pre]}#{@@seg_name_xhtml[tracking-1]}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" + segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking-1]}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" output_epub_cont_seg=File.new(segfilename,'w') if @@seg_name_xhtml[tracking-1] if dob.is=='heading' \ or @@seg_name_xhtml[tracking-1] !~/endnotes|book_index|metadata/ @@ -252,7 +252,7 @@ WOK heading_art(dob) head(dob) if @@seg_name_xhtml[tracking]=='sisu_manifest' # this is for manifest, includes navigation bug - segfilename="#{dir_epub_cont}/#{@md.fnl[:pre]}#{@@seg_name_xhtml[tracking]}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" + segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking]}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" output_epub_cont_seg=File.new(segfilename,'w') Seg_output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'sisu_manifest').output Seg.new.reinitialise #BUG navigation bug with items following metadata, and occurring before manifest, this becomes a bug ... work area for book index, FIX diff --git a/lib/sisu/v3/html.rb b/lib/sisu/v3/html.rb index 8d10b7da..b569653f 100644 --- a/lib/sisu/v3/html.rb +++ b/lib/sisu/v3/html.rb @@ -322,7 +322,7 @@ WOK title=if dob.obj !~/Metadata/; linkname else link='metadata' - %{<b><a href="#{@md.fnl[:pre]}#{link}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}">#{linkname}</a></b>} + %{<b><a href="#{link}#{@md.lang_code_insert}#{Sfx[:html]}">#{linkname}</a></b>} end toc={} txt_obj={ txt: title } @@ -409,13 +409,13 @@ WOK linkname,ocn=dob.obj.strip,dob.ocn p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) if ocn if dob.ln ==4 - seg_link=%{ <a href="#{@md.fnl[:pre]}#{dob.name}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top"> + seg_link=%{ <a href="#{dob.name}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top"> #{dob.obj} </a> } @@seg_url=dob.name elsif dob.obj =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/ seg_link=dob.obj.gsub(/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/, - %{<a href="#{@md.fnl[:pre]}\\1#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" } + + %{<a href="\\1#{@md.lang_code_insert}#{Sfx[:html]}" } + %{target="_top">\\1 \\2</a> }) end p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) if ocn @@ -451,7 +451,7 @@ WOK if ocn \ and ocn !~/#/ p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) - lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}##{ocn}"> + lnk_n_txt=%{ <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:html]}##{ocn}"> #{linkname} </a>} txt_obj={ txt: lnk_n_txt } @@ -472,7 +472,7 @@ WOK if ocn \ and ocn !~/#/ p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) - lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}##{ocn}"> + lnk_n_txt=%{ <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:html]}##{ocn}"> #{linkname} </a>} txt_obj={ txt: lnk_n_txt } diff --git a/lib/sisu/v3/html_format.rb b/lib/sisu/v3/html_format.rb index a4a05293..e89b5c43 100644 --- a/lib/sisu/v3/html_format.rb +++ b/lib/sisu/v3/html_format.rb @@ -299,7 +299,7 @@ WOK <p />} end def seg_head_navigation_band(type='') - firstseg=%{<a href="#{@md.fnl[:pre]}#{@md.firstseg}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" alt="->"> + firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="->"> #{@vz.png_nav_nxt} </a>} if @md.firstseg =~/\S+/ %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> @@ -318,7 +318,7 @@ WOK if type=~/pdf/ @tocband_segtoc=make_scroll_seg_pdf end - firstseg=%{<a href="#{@md.fnl[:pre]}#{@md.firstseg}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" alt="->"> + firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="->"> #{@vz.png_nav_nxt} </a>} if @md.firstseg =~/\S+/ %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> @@ -646,9 +646,9 @@ WOK def title_banner(title,subtitle,creator) end def dot_control_pre_next - pre="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" - up="#{@md.fnl[:pre]}#{@toc}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" - nxt="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" + pre="#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.lang_code_insert}#{Sfx[:html]}" + up="#{@toc}#{@md.lang_code_insert}#{Sfx[:html]}" + nxt="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}" if nxt=~/sisu_manifest\.html/ @file=SiSU_Env::SiSU_file.new(@md) if @md if @file.output_dir_structure.by_language_code? \ @@ -674,8 +674,8 @@ WOK #{@vz.table_close}} end def dot_control_pre - pre="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" - up="#{@md.fnl[:pre]}#{@toc}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" + pre="#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.lang_code_insert}#{Sfx[:html]}" + up="#{@toc}#{@md.lang_code_insert}#{Sfx[:html]}" nxt="#{@md.fn[:toc]}" %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> <tr><td align="left"> @@ -697,17 +697,17 @@ WOK def toc_nav(f_pre=false,f_nxt=false,use=1) pre=nxt='' toc=%{<td align="center" bgcolor=#{@vz.color_band1}> - <a href="#{@md.fnl[:pre]}#{@toc}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}> + <a href="#{@toc}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" #{@vz.js_toc}> #{@vz.png_nav_toc} </a> </td>} pre=%{<td align="center" bgcolor=#{@vz.color_band1}> - <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}> + <a href="#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" #{@vz.js_prev}> #{@vz.png_nav_pre} </a> </td>} if f_pre==true nxt=%{<td align="center" bgcolor=#{@vz.color_band1}> - <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_next}> + <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" #{@vz.js_next}> #{@vz.png_nav_nxt} </a> </td>} if f_nxt==true @@ -1281,7 +1281,7 @@ WOK fn='doc' if fn.to_s.empty? #you may wish to reconsider, sends to 'doc' where no segment info %{ <p class="endnote"> - #{@endnote_part_a}#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}#{@endnote_part_b} + #{@endnote_part_a}#{fn}#{@md.lang_code_insert}#{Sfx[:html]}#{@endnote_part_b} </p> } end diff --git a/lib/sisu/v3/html_minitoc.rb b/lib/sisu/v3/html_minitoc.rb index 7390ee7c..3a4f8fc5 100644 --- a/lib/sisu/v3/html_minitoc.rb +++ b/lib/sisu/v3/html_minitoc.rb @@ -115,7 +115,7 @@ title=unless txt.obj =~/Document Information/; txt.obj else link='metadata' - %{<b><a href="#{@md.fnl[:pre]}#{link}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}">#{txt.obj}</a></b>} + %{<b><a href="#{link}#{@md.lang_code_insert}#{Sfx[:html]}">#{txt.obj}</a></b>} end toc={} txt_obj={ txt: title } @@ -148,13 +148,13 @@ txt=@data unless txt =~/~metadata/ if txt.ln ==4 - seg_link=%{ <a href="#{@md.fnl[:pre]}#{txt.name}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top"> + seg_link=%{ <a href="#{txt.name}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top"> #{txt.obj} </a> } @@seg_url=txt.name elsif txt.obj =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/ seg_link=txt.obj.gsub(/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/, - %{<a href="#{@md.fnl[:pre]}\\2#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" } + + %{<a href="\\2#{@md.lang_code_insert}#{Sfx[:html]}" } + %{target="_top">\\1 \\2</a> }) end txt_obj={ txt: seg_link } @@ -170,7 +170,7 @@ txt.obj.gsub!(@pat_strip_heading_name,'\1') end toc={} - lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}##{txt.ocn}"> + lnk_n_txt=%{ <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:html]}##{txt.ocn}"> #{txt.obj} </a>} txt_obj={ txt: lnk_n_txt } @@ -185,7 +185,7 @@ txt.obj.gsub!(@pat_strip_heading_name,'\1') end toc={} - lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}##{txt.ocn}"> + lnk_n_txt=%{ <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:html]}##{txt.ocn}"> #{txt.obj} </a>} txt_obj={ txt: lnk_n_txt } diff --git a/lib/sisu/v3/html_segments.rb b/lib/sisu/v3/html_segments.rb index fb9b01cb..ccd48407 100644 --- a/lib/sisu/v3/html_segments.rb +++ b/lib/sisu/v3/html_segments.rb @@ -237,7 +237,7 @@ module SiSU_HTML_seg mkdir_p(@file.output_path.html_seg.dir) if File.writable?("#{@file.output_path.base.dir}/.") end Seg.new(@md).tail - segfilename="#{@file.output_path.html_seg.dir}/#{@md.fnl[:pre]}#{@@seg_name_html[tracking-1]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" + segfilename="#{@file.output_path.html_seg.dir}/#{@@seg_name_html[tracking-1]}#{@md.lang_code_insert}#{Sfx[:html]}" output_seg_file=File.new(segfilename,'w') if @@seg_name_html[tracking-1] minitoc=(@env.html_minitoc?) \ ? @minitoc \ diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index 5d93523e..5d35bf3d 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -905,9 +905,9 @@ module SiSU_Param @doc={ lv: [] } @doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','','' @@publisher='SiSU scribe' - attr_accessor :make,:env,:path,:file,: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 + attr_accessor :make,:env,:path,:file,: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,:lang_code_insert,: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=@path,@file=@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 + @env=@path,@file=@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=@lang_code_insert=@en=@notes=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=nil @data,@path,@fns,@opt=fns_array,opt.pth,opt.fns,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 @@ -918,6 +918,9 @@ module SiSU_Param @flv,@lang,@seg_names,@tags,@tag_array,@tag_a,@ec[:image],@ec[:audio],@ec[:multimedia]=Array.new(9){[]} @authors,@topic_register_array,@papersize_array=[],[],[] @lvs=[nil,0,0,0,0,0,0] + @lang_code_insert=(@opt.dir_structure_by =~/language/) \ + ? '' \ + : ".#{@opt.lng}" @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/ @rgx_audio=/\{\s*(\S+?\.(?:mp3|ogg))/ @rgx_mm=/\{\s*(\S+?\.(?:ogg|mpeg))/ #expand and distinguish ogg @@ -1318,7 +1321,7 @@ module SiSU_Param @language[:code]=fn_set_lang[:c] @language[:name]=fn_set_lang[:n] end - @fnl=@env.i18n.lang_filename(fn_set_lang[:n]) + @fnl=@env.i18n.lang_filename(fn_set_lang[:c]) #fix # @flv.each do |l| # lang=SiSU_Env::Standardise_language.new.file_to_language(l) diff --git a/lib/sisu/v3/xml_format.rb b/lib/sisu/v3/xml_format.rb index a3539f60..58b3f880 100644 --- a/lib/sisu/v3/xml_format.rb +++ b/lib/sisu/v3/xml_format.rb @@ -537,7 +537,7 @@ WOK if type=~/pdf/ @tocband_segtoc=make_scroll_seg_pdf end - firstseg=%{<a href="#{@md.fnl[:pre]}#{@md.firstseg}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" alt="->"> + firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" alt="->"> #{@vz.png_nav_nxt} </a>} if @md.firstseg =~/\S+/ %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> @@ -556,7 +556,7 @@ WOK if type=~/pdf/ @tocband_segtoc=make_scroll_seg_pdf end - firstseg=%{<a href="#{@md.fnl[:pre]}#{@md.firstseg}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" alt="->"> + firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" alt="->"> #{@vz.png_nav_nxt} </a>} if @md.firstseg =~/\S+/ %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> @@ -891,17 +891,17 @@ WOK def dot_control_pre_next %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> <tr><td align="left"> - <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}> + <a href="#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" #{@vz.js_prev}> #{@vz.png_nav_dot_pre} </a> </td> <td align="center"> - <a href="#{@md.fnl[:pre]}#{@index}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}> + <a href="#{@index}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" #{@vz.js_toc}> #{@vz.png_nav_dot_toc} </a> </td> <td align="right"> - <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_next}> + <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" #{@vz.js_next}> #{@vz.png_nav_dot_nxt} </a> #{@vz.table_close}} @@ -909,12 +909,12 @@ WOK def dot_control_pre %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> <tr><td align="left"> - <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}> + <a href="#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" #{@vz.js_prev}> #{@vz.png_nav_dot_pre} </a> </td> <td align="center"> - <a href="#{@md.fnl[:pre]}#{@index}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}> + <a href="#{@index}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" #{@vz.js_toc}> #{@vz.png_nav_dot_toc} </a> </td> @@ -927,17 +927,17 @@ WOK def toc_nav(f_pre=false,f_nxt=false,use=1) pre=nxt='' toc=%{<td align="center" bgcolor=#{@vz.color_band1}> - <a href="#{@md.fnl[:pre]}#{@index}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}> + <a href="#{@index}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" #{@vz.js_toc}> #{@vz.png_nav_toc} </a> </td>} pre=%{<td align="center" bgcolor=#{@vz.color_band1}> - <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}> + <a href="#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" #{@vz.js_prev}> #{@vz.png_nav_pre} </a> </td>} if f_pre==true nxt=%{<td align="center" bgcolor=#{@vz.color_band1}> - <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_next}> + <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" #{@vz.js_next}> #{@vz.png_nav_nxt} </a> </td>} if f_nxt==true @@ -1479,7 +1479,7 @@ WOK fn='doc' if fn.empty? #you may wish to reconsider, sends to 'doc' where no segment info # Sfx[:html] or Sfx[:xhtml] ? %{ <p class="endnote"> - #{@endnote_part_a}#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}#{@endnote_part_b} + #{@endnote_part_a}#{fn}#{@md.lang_code_insert}#{Sfx[:html]}#{@endnote_part_b} </p> } end |