diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v5/ao_doc_str.rb | 32 | ||||
-rw-r--r-- | lib/sisu/v5/ao_numbering.rb | 23 | ||||
-rw-r--r-- | lib/sisu/v5/harvest_authors.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v5/html_format.rb | 43 | ||||
-rw-r--r-- | lib/sisu/v5/hub_options.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v5/manifest.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v5/se_processing.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v5/shared_metadata.rb | 16 | ||||
-rw-r--r-- | lib/sisu/v5/xhtml.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v5/xhtml_epub2.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v5/xml_format.rb | 20 | ||||
-rw-r--r-- | lib/sisu/v5/xml_odf_odt.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v5/xml_shared.rb | 107 | ||||
-rw-r--r-- | lib/sisu/v6/ao_doc_str.rb | 32 | ||||
-rw-r--r-- | lib/sisu/v6/ao_numbering.rb | 23 | ||||
-rw-r--r-- | lib/sisu/v6/harvest_authors.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v6/html_format.rb | 43 | ||||
-rw-r--r-- | lib/sisu/v6/hub_options.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v6/manifest.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v6/se_processing.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v6/shared_metadata.rb | 16 | ||||
-rw-r--r-- | lib/sisu/v6/xhtml.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v6/xhtml_epub2.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v6/xml_format.rb | 20 | ||||
-rw-r--r-- | lib/sisu/v6/xml_odf_odt.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v6/xml_shared.rb | 107 |
26 files changed, 222 insertions, 292 deletions
diff --git a/lib/sisu/v5/ao_doc_str.rb b/lib/sisu/v5/ao_doc_str.rb index e10cc4ef..49c9bdf1 100644 --- a/lib/sisu/v5/ao_doc_str.rb +++ b/lib/sisu/v5/ao_doc_str.rb @@ -1308,7 +1308,10 @@ module SiSU_AO_DocumentStructureExtract STDERR.puts %{current level: #{structure_info.lv[node_ln]} (possible parent levels: #{structure_info.possible_parents(structure_info.lv[node_ln])}) parent level: #{structure_info.lv[node_parent_ln]} (possible child levels: #{structure_info.possible_children(structure_info.lv[node_parent_ln])}) SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end end end @@ -1327,7 +1330,10 @@ has incorrect level and/or parent level @title: SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}" } - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end unless (defined? @md.creator.author \ and @md.creator.author) @@ -1337,7 +1343,10 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}" :author: anonymous? SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}" } - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end end def ocn #and auto segment numbering increment @@ -1672,8 +1681,11 @@ or this level should be 6~ rather #{dob.lv}" STDERR.puts %{Substantive text objects must follow a level 1~ 2~ or 3~ heading: #{lev}~ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} puts dob.obj.gsub(/^(.{1,80})/,'"\1"') - $process_document = :skip - break + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + break + else exit + end end if not dob.obj =~/~#|-#/ ocn_flag=true @@ -1751,13 +1763,19 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} STDERR.puts %{The number of level A~ in this document: #{@lev_occurences[:a]} There must be one level A~ (no more and no less) SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end unless @lev_occurences[:l1] > 0 STDERR.puts %{The number of level 1~ in this document: #{@lev_occurences[:l1]} There must be at least one level 1~ (and as many as required) SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end @o_array end diff --git a/lib/sisu/v5/ao_numbering.rb b/lib/sisu/v5/ao_numbering.rb index b4ff7f0b..f9257e6a 100644 --- a/lib/sisu/v5/ao_numbering.rb +++ b/lib/sisu/v5/ao_numbering.rb @@ -314,11 +314,11 @@ module SiSU_AO_Numbering possible_seg_name.to_s end end - def auto_seg_name(possible_seg_name,heading_num_is,lv,type) + def auto_seg_name(possible_seg_name,heading_num_is,dob,type) prefix=case type when :auto then Mx[:segname_prefix_auto_num_provide] when :extract then Mx[:segname_prefix_auto_num_extract] - else '_'*lv.to_i #should not occur + else '_'*dob.lv.to_i #should not occur end if possible_seg_name =~/^[0-9]+?\.$/m #!~/[.,:-]+/ possible_seg_name=possible_seg_name. @@ -326,35 +326,38 @@ module SiSU_AO_Numbering end chosen_seg_name=if possible_seg_name.to_s =~/^[0-9]+[.]?$/m \ and possible_seg_name.to_i <= heading_num_is.to_i \ - and lv == '1' + and dob.lv == '1' prefix + leading_zeros_fixed_width_number(possible_seg_name) elsif possible_seg_name.to_s =~/^[0-9]+[.,:-]*$/m \ - and lv == '1' + and dob.lv == '1' possible_seg_name=possible_seg_name.to_s. gsub(/(?:[:,-]|\W)/,'.'). gsub(/\.$/,'') prefix + possible_seg_name elsif possible_seg_name.to_s =~ /^[0-9]+[.,:-][0-9]+[.,:-]*$/m \ - and lv == '2' + and dob.lv == '2' possible_seg_name=possible_seg_name.to_s. gsub(/(?:[:,-]|\W)/,'.'). gsub(/\.$/,'') prefix + possible_seg_name elsif possible_seg_name.to_s =~ /^[0-9]+[.,:-][0-9]+[.,:-][0-9][\d.,:-]*$/m \ - and lv == '3' + and dob.lv == '3' possible_seg_name=possible_seg_name.to_s. gsub(/(?:[:,-]|\W)/,'.'). gsub(/\.$/,'') prefix + possible_seg_name - else Mx[:segname_prefix_auto_num_other]*lv.to_i + possible_seg_name.to_s + else + Mx[:segname_prefix_auto_num_other]*dob.lv.to_i \ + + possible_seg_name.to_s end @chosen_seg_names << chosen_seg_name if @chosen_seg_names.compact.uniq.length == @chosen_seg_names.compact.length #checks that all auto given seg names are unique chosen_seg_name else - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).mark("duplicated auto segment name: #{type} #{chosen_seg_name} - #{@chosen_seg_names}; manually name level 1 segments '1~given_name'") + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green). + mark("duplicated auto segment name: #{type} #{chosen_seg_name} - #{@chosen_seg_names}; manually name level 1 segments '1~given_name'\n #{@md.fns}\n #{dob.obj}") exit end end @@ -396,7 +399,7 @@ module SiSU_AO_Numbering and dob.obj =~/^\s*(?:\S+\s+)?([0-9][0-9.,:-]*)/m #heading starts with a recognised numeric or word followed by a recognised numeric construct, use that as name possible_seg_name=$1 possible_seg_name= - auto_seg_name(possible_seg_name,heading_num_is,dob.lv,:extract) + auto_seg_name(possible_seg_name,heading_num_is,dob,:extract) possible_seg_name=possible_seg_name. gsub(/(?:[:,-]|\W)/,'.'). gsub(/\.$/,'') @@ -421,7 +424,7 @@ module SiSU_AO_Numbering if dob.ln==4 \ and not dob.name #if still no segment name, provide a numerical one possible_seg_name= - auto_seg_name(art_filename_auto,heading_num_is,dob.lv,:auto) + auto_seg_name(art_filename_auto,heading_num_is,dob,:auto) if @md.seg_names.is_a?(Array) \ and not @md.seg_names.include?(possible_seg_name) dob.name=possible_seg_name diff --git a/lib/sisu/v5/harvest_authors.rb b/lib/sisu/v5/harvest_authors.rb index 26a0a9e3..c43733ee 100644 --- a/lib/sisu/v5/harvest_authors.rb +++ b/lib/sisu/v5/harvest_authors.rb @@ -433,9 +433,9 @@ WOK manifest_at=if @env.output_dir_structure.by? == :language i[:file] + Sfx[:html] elsif @env.output_dir_structure.by? == :filetype - i[:file] + '.' + lang_code_insert + Sfx[:html] + i[:file] + lang_code_insert + Sfx[:html] elsif @env.output_dir_structure.by? == :filename - "./#{i[:file]}/#{i[:page]}" + './' + i[:file] + '/' + i[:page] else '' #error end work=[ diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb index 7731464a..aa002ec7 100644 --- a/lib/sisu/v5/html_format.rb +++ b/lib/sisu/v5/html_format.rb @@ -198,7 +198,7 @@ module SiSU_HTML_Format button +=%{ <p class="tiny_left"><a href="#{@md.make.home_button_image[:link]}" target="_top"><img border="0" src="#{image_path}/#{@md.make.home_button_image[:home_button]}" width="#{@md.make.home_button_image[:w]}" height="#{@md.make.home_button_image[:h]}" alt="home icon -->" /></a></p>\n} elsif @md.home_button_links.is_a?(Array) @md.home_button_links.each do |links| - button +=%{ <p class="tiny_left"><a href="#{links[:url]}/" target="_top">\n #{links[:say]}\n </a></p>\n} + button +=%{ <p class="tiny_left"><a href="#{links[:url]}" target="_top">\n #{links[:say]}\n </a></p>\n} end end button +=%{ </td></tr>\n </table>} @@ -310,6 +310,15 @@ WOK end end def concordance_navigation_band + up_button=if @make.build.html_navigation? + %{</td> +<td width="5%" align="right"> + <a href="toc.html" target="_top" alt="->"> + #{png_nav.toc} + </a> +} + else '' + end if @make.build.html_top_band? %{<table summary="concordance navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> <tr><td width="20%"> @@ -317,29 +326,29 @@ WOK </td> <td width="75%" align="center"> #{doc_types} -</td> -<td width="5%" align="right"> - <a href="toc.html" target="_top" alt="->"> - #{png_nav.toc} - </a> +#{up_button} #{@vz.table_close} <p />} else '' end end def seg_head_navigation_band(page=:seg) - if page==:manifest - nxt=(@file.output_dir_structure.by_language_code? \ - || @file.output_dir_structure.by_filetype?) \ - ? "../html/#{@md.fnb}/toc#{@md.lang_code_insert}#{Sfx[:html]}" - : "toc#{@md.lang_code_insert}#{Sfx[:html]}" - firstseg=%{<a href="#{nxt}" target="_top" alt="->"> + if @make.build.html_navigation? + if page==:manifest + nxt=(@file.output_dir_structure.by_language_code? \ + || @file.output_dir_structure.by_filetype?) \ + ? "../html/#{@md.fnb}/toc#{@md.lang_code_insert}#{Sfx[:html]}" + : "toc#{@md.lang_code_insert}#{Sfx[:html]}" + firstseg=%{<a href="#{nxt}" target="_top" alt="->"> + #{png_nav.nxt}</a>} + elsif @md.firstseg =~/\S+/ + firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="->"> #{png_nav.nxt}</a>} - elsif @md.firstseg =~/\S+/ - firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="->"> - #{png_nav.nxt}</a>} + end + else '' end - %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> + if @make.build.html_top_band? + %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> <tr><td width="20%"> #{button_home(page)} </td> @@ -350,6 +359,8 @@ WOK #{firstseg} #{@vz.table_close} <p />} + else '' + end end def manifest_link(text) # @file=SiSU_Env::FileOp.new(@md) if @md diff --git a/lib/sisu/v5/hub_options.rb b/lib/sisu/v5/hub_options.rb index d871c9c3..676577fb 100644 --- a/lib/sisu/v5/hub_options.rb +++ b/lib/sisu/v5/hub_options.rb @@ -960,7 +960,7 @@ module SiSU_Commandline =~/"--(?:exc|no)-html-navigation-bar"|"--(?:exc|no)-navigation-bar"/ \ || act[:switch][:off].inspect =~/"html_navigation_bar"|"navbar"/ { bool: false, set: :off } - else { bool: true, set: :na } + else { bool: false, set: :na } end act[:segsubtoc]=if select_arr.inspect \ =~/"--inc-segsubtoc"/ diff --git a/lib/sisu/v5/manifest.rb b/lib/sisu/v5/manifest.rb index f19f8b38..b6c7bc63 100644 --- a/lib/sisu/v5/manifest.rb +++ b/lib/sisu/v5/manifest.rb @@ -947,7 +947,7 @@ WOK harvest=(FileTest.file?("#{pth_local}/authors#{@fn_lng}.html") \ && FileTest.file?("#{pth_local}/topics#{@fn_lng}.html")) \ ? %{<p class="small"><a href="#{pth_rel_home}/index.html">.:</a> other document manifests: [<a href="#{pth_rel}/authors#{@fn_lng}.html">authors</a>] [<a href="#{pth_rel}/topics#{@fn_lng}.html">topics</a>] #{output_organised_by}</p>} - : %{<p class="small"><a href="#{pth_rel_home}/index.html">#{output_organised_by}</p>} + : %{<p class="small"><a href="#{pth_rel_home}">#{output_organised_by}</a></p>} manifest_title=%{<p class="bold">#{@translate.manifest_description}</p>#{harvest}} @manifest[:html] <<<<WOK <div id="horizontal_links"> diff --git a/lib/sisu/v5/se_processing.rb b/lib/sisu/v5/se_processing.rb index 35fa72c2..33b4a4ed 100644 --- a/lib/sisu/v5/se_processing.rb +++ b/lib/sisu/v5/se_processing.rb @@ -309,7 +309,7 @@ module SiSU_Processing_Settings elsif env_rc.build.html_navigation_bar? ==:off false else - true + false end end def search_form? diff --git a/lib/sisu/v5/shared_metadata.rb b/lib/sisu/v5/shared_metadata.rb index 1f21af3f..e6721964 100644 --- a/lib/sisu/v5/shared_metadata.rb +++ b/lib/sisu/v5/shared_metadata.rb @@ -61,6 +61,7 @@ =end module SiSU_Metadata + require_relative 'xml_shared' # xml_shared.rb class Summary attr_accessor :tag,:inf,:class,:attrib def initialize(md,display_heading=false) @@ -73,6 +74,14 @@ module SiSU_Metadata language=l[:n] tr=SiSU_Translate::Source.new(@md,language) @attrib='md' + def meta_content_clean(content='') + content=if not content.nil? + content=content.tr('"',"'"). + gsub(/&/,'&') + content=SiSU_XML_Munge::Trans.new(@md).char_enc.utf8(content) + else content + end + end if @display_heading @tag,@inf=%{<b><u>Document Metadata</u></b>},'' meta << self.meta_para @@ -114,7 +123,7 @@ module SiSU_Metadata end if defined? @md.rights.all \ and @md.rights.all=~/\S+/ - @tag,@inf,@class=tr.rights,@md.rights.all,'dc' #15 + @tag,@inf,@class=tr.rights,meta_content_clean(@md.rights.all),'dc' #15 meta << self.meta_para end if defined? @md.classify.subject \ @@ -809,7 +818,8 @@ module SiSU_Metadata end def xml_docbook def meta_para - inf_xml=char_enc(@inf).utf8 + inf_xml=char_enc(@inf).amp + inf_xml=char_enc(inf_xml).utf8 inf_xml=char_enc(inf_xml).br <<WOK #{Ax[:tab]}<#{@tag}> @@ -842,6 +852,7 @@ WOK end def xml_dom def meta_para + inf_xml=char_enc(inf_xml).amp inf_xml=char_enc(@inf).utf8 inf_xml=char_enc(inf_xml).br <<WOK @@ -860,6 +871,7 @@ WOK end def xhtml_scroll def meta_para + inf_xml=char_enc(inf_xml).amp inf_xml=char_enc(@inf).utf8 inf_xml=char_enc(inf_xml).br <<WOK diff --git a/lib/sisu/v5/xhtml.rb b/lib/sisu/v5/xhtml.rb index 138ccf6d..60049043 100644 --- a/lib/sisu/v5/xhtml.rb +++ b/lib/sisu/v5/xhtml.rb @@ -234,7 +234,7 @@ WOK end extract_endnotes(dob) dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>'). #footnote/endnote clean - gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean + gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') util=SiSU_TextUtils::Wrap.new(dob.obj,70) wrapped=util.line_wrap @@xml[:body] << if defined? dob.ocn diff --git a/lib/sisu/v5/xhtml_epub2.rb b/lib/sisu/v5/xhtml_epub2.rb index e0aa70cb..daa00f39 100644 --- a/lib/sisu/v5/xhtml_epub2.rb +++ b/lib/sisu/v5/xhtml_epub2.rb @@ -71,6 +71,8 @@ module SiSU_XHTML_EPUB2 include SiSU_Particulars require_relative 'defaults' # defaults.rb include SiSU_Viz + require_relative 'xml_shared' # xml_shared.rb + include SiSU_XML_Munge require_relative 'xhtml_table' # xhtml_table.rb require_relative 'xhtml_epub2_format' # xhtml_epub2_format.rb include SiSU_XHTML_EPUB2_Format diff --git a/lib/sisu/v5/xml_format.rb b/lib/sisu/v5/xml_format.rb index fb2cff88..4a7264c0 100644 --- a/lib/sisu/v5/xml_format.rb +++ b/lib/sisu/v5/xml_format.rb @@ -191,15 +191,26 @@ module SiSU_XML_Format end if defined? @md.rights.all \ and @md.rights.all=~/\S+/ # DublinCore 15 - rights - @rdf_rights=%{ dc.rights="#{@md.rights.all}"\n} - @rights=%{<meta name="dc.rights" content="#{@md.rights.all}" />\n} + rights=meta_content_clean(@md.rights.all) + copyright=meta_content_clean(@md.rights.copyright.all) + @rdf_rights=%{ dc.rights="#{rights}"\n} + @rights=%{<meta name="dc.rights" content="#{rights}" />\n} end - @copyright=%{<meta name="copyright" content="#{@md.rights.copyright.all}" />\n} if @md.rights.copyright.all # possibly redundant see dc.rights + @copyright=%{<meta name="copyright" content="#{copyright}" />\n} \ + if @md.rights.copyright.all # possibly redundant see dc.rights @owner=%{<meta name="owner" content="#{@md.owner}" />\n} if @md.owner @keywords=%{<meta name="keywords" content="#{@md.keywords}" />\n} if @md.keywords @vz=SiSU_Viz::Defaults.new #margin,paragraph,table,banner,url,png,txt,color,font,nav_txt,nav_png,credits,js,php @index='index' end + def meta_content_clean(content='') + content=if not content.nil? + content=content.tr('"',"'"). + gsub(/&/,'&') + content=SiSU_XML_Munge::Trans.new(@md).char_enc.utf8(content) + else content + end + end def table_close '</font> </td></tr></table>' end @@ -558,7 +569,8 @@ WOK def prefix_a end def rights - rights=@md.rights.copyright.all.gsub(/^\s*Copyright\s+\(C\)/,'Copyright <sup>©</sup> ') + copyright=meta_content_clean(@md.rights.copyright.all) + rights=copyright(/^\s*Copyright\s+\(C\)/,'Copyright <sup>©</sup> ') %{<p class="small_left">Rights: #{rights}</p> <p />} end diff --git a/lib/sisu/v5/xml_odf_odt.rb b/lib/sisu/v5/xml_odf_odt.rb index 4e540fde..0c9dc7aa 100644 --- a/lib/sisu/v5/xml_odf_odt.rb +++ b/lib/sisu/v5/xml_odf_odt.rb @@ -71,6 +71,8 @@ module SiSU_XML_ODF_ODT include SiSU_XML_ODF_ODT_Format require_relative 'shared_metadata' # shared_metadata.rb require_relative 'txt_shared' # txt_shared.rb + require_relative 'xml_shared' # xml_shared.rb + include SiSU_XML_Munge @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 class Source begin diff --git a/lib/sisu/v5/xml_shared.rb b/lib/sisu/v5/xml_shared.rb index bd0e383b..d059cd7b 100644 --- a/lib/sisu/v5/xml_shared.rb +++ b/lib/sisu/v5/xml_shared.rb @@ -232,104 +232,6 @@ module SiSU_XML_Munge if @sys.locale =~/utf-?8/i # instead ucs for utf8 # String#encode Iñtërnâtiônàlizætiøn dob.obj=dob.obj.gsub(/ /u,' '). # space identify gsub(/ /u,' ') # space identify - else - dob.obj=dob.obj.gsub(/¢/u,'¢'). # ¢ - gsub(/£/u,'£'). # £ - gsub(/¥/u,'¥'). # ¥ - gsub(/§/u,'§'). # § - gsub(/©/u,'©'). # © - gsub(/ª/u,'ª'). # ª - gsub(/«/u,'«'). # « - gsub(/®/u,'®'). # ® - gsub(/°/u,'°'). # ° - gsub(/±/u,'±'). # ± - gsub(/²/u,'²'). # ² - gsub(/³/u,'³'). # ³ - gsub(/µ/u,'µ'). # µ - gsub(/¶/u,'¶'). # ¶ - gsub(/¹/u,'¹'). # ¹ - gsub(/º/u,'º'). # º - gsub(/»/u,'»'). # » - gsub(/¼/u,'¼'). # ¼ - gsub(/½/u,'½'). # ½ - gsub(/¾/u,'¾'). # ¾ - gsub(/×/u,'×'). # × - gsub(/÷/u,'÷'). # ÷ - gsub(/¿/u,'¿'). # ¿ - gsub(/À/u,'À'). # À - gsub(/Á/u,'Á'). # Á - gsub(/Â/u,'Â'). # Â - gsub(/Ã/u,'Ã'). # Ã - gsub(/Ä/u,'Ä'). # Ä - gsub(/Å/u,'Å'). # Å - gsub(/Æ/u,'Æ'). # Æ - gsub(/Ç/u,'Ç'). # Ç - gsub(/È/u,'È'). # È - gsub(/É/u,'É'). # É - gsub(/Ê/u,'Ê'). # Ê - gsub(/Ë/u,'Ë'). # Ë - gsub(/Ì/u,'Ì'). # Ì - gsub(/Í/u,'Í'). # Í - gsub(/Î/u,'Î'). # Î - gsub(/Ï/u,'Ï'). # Ï - gsub(/Ð/u,'Ð'). # Ð - gsub(/Ñ/u,'Ñ'). # Ñ - gsub(/Ò/u,'Ò'). # Ò - gsub(/Ó/u,'Ó'). # Ó - gsub(/Ô/u,'Ô'). # Ô - gsub(/Õ/u,'Õ'). # Õ - gsub(/Ö/u,'Ö'). # Ö - gsub(/Ø/u,'Ø'). # Ø - gsub(/Ù/u,'Ù'). # Ù - gsub(/Ú/u,'Ú'). # Ú - gsub(/Û/u,'Û'). # Û - gsub(/Ü/u,'Ü'). # Ü - gsub(/Ý/u,'Ý'). # Ý - gsub(/Þ/u,'Þ'). # Þ - gsub(/ß/u,'ß'). # ß - gsub(/à/u,'à'). # à - gsub(/á/u,'á'). # á - gsub(/â/u,'â'). # â - gsub(/ã/u,'ã'). # ã - gsub(/ä/u,'ä'). # ä - gsub(/å/u,'å'). # å - gsub(/æ/u,'æ'). # æ - gsub(/ç/u,'ç'). # ç - gsub(/è/u,'è'). # è - gsub(/é/u,'´'). # é - gsub(/ê/u,'ˆ'). # ê - gsub(/ë/u,'ë'). # ë - gsub(/ì/u,'ì'). # ì - gsub(/í/u,'´'). # í - gsub(/î/u,'î'). # î - gsub(/ï/u,'ï'). # ï - gsub(/ð/u,'ð'). # ð - gsub(/ñ/u,'ñ'). # ñ - gsub(/ò/u,'ò'). # ò - gsub(/ó/u,'ó'). # ó - gsub(/ô/u,'ô'). # ô - gsub(/õ/u,'õ'). # õ - gsub(/ö/u,'ö'). # ö - gsub(/ø/u,'ø'). # ø - gsub(/ù/u,'ù'). # ú - gsub(/ú/u,'ú'). # û - gsub(/û/u,'û'). # ü - gsub(/ü/u,'ü'). # ý - gsub(/þ/u,'þ'). # þ - gsub(/ÿ/u,'ÿ'). # ÿ - gsub(/‘/u,'&#lsquo;'). # ‘ # ‘ - gsub(/’/u,'&#rsquo;'). # ’ # ’ - gsub(/“/u,'“'). # “ # “ - gsub(/”/u,'”'). # ” # ” - gsub(/–/u,'–'). # – # – - gsub(/—/u,'—'). # — # — - gsub(/∝/u,'∝'). # ∝ # ∝ - gsub(/∞/u,'∞'). # ∞ # ∞ - gsub(/™/u,'™'). # ™ # ™ - gsub(/✠/u,'✠'). # ✠ - #gsub(/✠/u '†'). # † # † incorrect replacement † - gsub(/ /u,' '). # space identify - gsub(/ /u,' ') # space identify end end self @@ -411,7 +313,8 @@ module SiSU_XML_Munge %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). gsub(/#{Dx[:url_o]}/,"#{Dx[:url_o_xml]}"). gsub(/#{Dx[:url_c]}/,"#{Dx[:url_c_xml]}"). - gsub(/ |#{Mx[:nbsp]}/m,' ') + gsub(/ |#{Mx[:nbsp]}/m,' '). + gsub(/;&([^#]|(?:[^gl][^t]|[^a][^m][^p]|[^n][^b][^s][^p])[^;])/,';&\1') # pattern not to match dob end def markup_light(dob='') @@ -426,7 +329,8 @@ module SiSU_XML_Munge gsub(/&([^;]{1,5})/,'&\1'). #sort, rough estimate, revisit #WATCH found in node not sax gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/, "<image.path>#{@md.file.output_path.xml.rel_image}\/\\1</image.path>"). - gsub(/ |#{Mx[:nbsp]}/,' ') + gsub(/ |#{Mx[:nbsp]}/,' '). + gsub(/;&([^#]|(?:[^gl][^t]|[^a][^m][^p]|[^n][^b][^s][^p])[^;])/,';&\1') # pattern not to match wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17 dob.obj=tidywords(wordlist).join(' ').strip dob @@ -698,7 +602,8 @@ module SiSU_XML_Tags #Format end def meta_content_clean(content='') content=if not content.nil? - content=content.tr('"',"'") + content=content.tr('"',"'"). + gsub(/&/,'&') content=SiSU_XML_Munge::Trans.new(@md).char_enc.utf8(content) else content end diff --git a/lib/sisu/v6/ao_doc_str.rb b/lib/sisu/v6/ao_doc_str.rb index 6e7a103f..6be0e068 100644 --- a/lib/sisu/v6/ao_doc_str.rb +++ b/lib/sisu/v6/ao_doc_str.rb @@ -1308,7 +1308,10 @@ module SiSU_AO_DocumentStructureExtract STDERR.puts %{current level: #{structure_info.lv[node_ln]} (possible parent levels: #{structure_info.possible_parents(structure_info.lv[node_ln])}) parent level: #{structure_info.lv[node_parent_ln]} (possible child levels: #{structure_info.possible_children(structure_info.lv[node_parent_ln])}) SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end end end @@ -1327,7 +1330,10 @@ has incorrect level and/or parent level @title: SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}" } - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end unless (defined? @md.creator.author \ and @md.creator.author) @@ -1337,7 +1343,10 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}" :author: anonymous? SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}" } - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end end def ocn #and auto segment numbering increment @@ -1672,8 +1681,11 @@ or this level should be 6~ rather #{dob.lv}" STDERR.puts %{Substantive text objects must follow a level 1~ 2~ or 3~ heading: #{lev}~ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} puts dob.obj.gsub(/^(.{1,80})/,'"\1"') - $process_document = :skip - break + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + break + else exit + end end if not dob.obj =~/~#|-#/ ocn_flag=true @@ -1751,13 +1763,19 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} STDERR.puts %{The number of level A~ in this document: #{@lev_occurences[:a]} There must be one level A~ (no more and no less) SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end unless @lev_occurences[:l1] > 0 STDERR.puts %{The number of level 1~ in this document: #{@lev_occurences[:l1]} There must be at least one level 1~ (and as many as required) SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end @o_array end diff --git a/lib/sisu/v6/ao_numbering.rb b/lib/sisu/v6/ao_numbering.rb index a96df577..7a4e4cee 100644 --- a/lib/sisu/v6/ao_numbering.rb +++ b/lib/sisu/v6/ao_numbering.rb @@ -314,11 +314,11 @@ module SiSU_AO_Numbering possible_seg_name.to_s end end - def auto_seg_name(possible_seg_name,heading_num_is,lv,type) + def auto_seg_name(possible_seg_name,heading_num_is,dob,type) prefix=case type when :auto then Mx[:segname_prefix_auto_num_provide] when :extract then Mx[:segname_prefix_auto_num_extract] - else '_'*lv.to_i #should not occur + else '_'*dob.lv.to_i #should not occur end if possible_seg_name =~/^[0-9]+?\.$/m #!~/[.,:-]+/ possible_seg_name=possible_seg_name. @@ -326,35 +326,38 @@ module SiSU_AO_Numbering end chosen_seg_name=if possible_seg_name.to_s =~/^[0-9]+[.]?$/m \ and possible_seg_name.to_i <= heading_num_is.to_i \ - and lv == '1' + and dob.lv == '1' prefix + leading_zeros_fixed_width_number(possible_seg_name) elsif possible_seg_name.to_s =~/^[0-9]+[.,:-]*$/m \ - and lv == '1' + and dob.lv == '1' possible_seg_name=possible_seg_name.to_s. gsub(/(?:[:,-]|\W)/,'.'). gsub(/\.$/,'') prefix + possible_seg_name elsif possible_seg_name.to_s =~ /^[0-9]+[.,:-][0-9]+[.,:-]*$/m \ - and lv == '2' + and dob.lv == '2' possible_seg_name=possible_seg_name.to_s. gsub(/(?:[:,-]|\W)/,'.'). gsub(/\.$/,'') prefix + possible_seg_name elsif possible_seg_name.to_s =~ /^[0-9]+[.,:-][0-9]+[.,:-][0-9][\d.,:-]*$/m \ - and lv == '3' + and dob.lv == '3' possible_seg_name=possible_seg_name.to_s. gsub(/(?:[:,-]|\W)/,'.'). gsub(/\.$/,'') prefix + possible_seg_name - else Mx[:segname_prefix_auto_num_other]*lv.to_i + possible_seg_name.to_s + else + Mx[:segname_prefix_auto_num_other]*dob.lv.to_i \ + + possible_seg_name.to_s end @chosen_seg_names << chosen_seg_name if @chosen_seg_names.compact.uniq.length == @chosen_seg_names.compact.length #checks that all auto given seg names are unique chosen_seg_name else - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).mark("duplicated auto segment name: #{type} #{chosen_seg_name} - #{@chosen_seg_names}; manually name level 1 segments '1~given_name'") + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green). + mark("duplicated auto segment name: #{type} #{chosen_seg_name} - #{@chosen_seg_names}; manually name level 1 segments '1~given_name'\n #{@md.fns}\n #{dob.obj}") exit end end @@ -396,7 +399,7 @@ module SiSU_AO_Numbering and dob.obj =~/^\s*(?:\S+\s+)?([0-9][0-9.,:-]*)/m #heading starts with a recognised numeric or word followed by a recognised numeric construct, use that as name possible_seg_name=$1 possible_seg_name= - auto_seg_name(possible_seg_name,heading_num_is,dob.lv,:extract) + auto_seg_name(possible_seg_name,heading_num_is,dob,:extract) possible_seg_name=possible_seg_name. gsub(/(?:[:,-]|\W)/,'.'). gsub(/\.$/,'') @@ -421,7 +424,7 @@ module SiSU_AO_Numbering if dob.ln==4 \ and not dob.name #if still no segment name, provide a numerical one possible_seg_name= - auto_seg_name(art_filename_auto,heading_num_is,dob.lv,:auto) + auto_seg_name(art_filename_auto,heading_num_is,dob,:auto) if @md.seg_names.is_a?(Array) \ and not @md.seg_names.include?(possible_seg_name) dob.name=possible_seg_name diff --git a/lib/sisu/v6/harvest_authors.rb b/lib/sisu/v6/harvest_authors.rb index 762545c6..b27cf599 100644 --- a/lib/sisu/v6/harvest_authors.rb +++ b/lib/sisu/v6/harvest_authors.rb @@ -433,9 +433,9 @@ WOK manifest_at=if @env.output_dir_structure.by? == :language i[:file] + Sfx[:html] elsif @env.output_dir_structure.by? == :filetype - i[:file] + '.' + lang_code_insert + Sfx[:html] + i[:file] + lang_code_insert + Sfx[:html] elsif @env.output_dir_structure.by? == :filename - "./#{i[:file]}/#{i[:page]}" + './' + i[:file] + '/' + i[:page] else '' #error end work=[ diff --git a/lib/sisu/v6/html_format.rb b/lib/sisu/v6/html_format.rb index b2476719..acc62a74 100644 --- a/lib/sisu/v6/html_format.rb +++ b/lib/sisu/v6/html_format.rb @@ -198,7 +198,7 @@ module SiSU_HTML_Format button +=%{ <p class="tiny_left"><a href="#{@md.make.home_button_image[:link]}" target="_top"><img border="0" src="#{image_path}/#{@md.make.home_button_image[:home_button]}" width="#{@md.make.home_button_image[:w]}" height="#{@md.make.home_button_image[:h]}" alt="home icon -->" /></a></p>\n} elsif @md.home_button_links.is_a?(Array) @md.home_button_links.each do |links| - button +=%{ <p class="tiny_left"><a href="#{links[:url]}/" target="_top">\n #{links[:say]}\n </a></p>\n} + button +=%{ <p class="tiny_left"><a href="#{links[:url]}" target="_top">\n #{links[:say]}\n </a></p>\n} end end button +=%{ </td></tr>\n </table>} @@ -310,6 +310,15 @@ WOK end end def concordance_navigation_band + up_button=if @make.build.html_navigation? + %{</td> +<td width="5%" align="right"> + <a href="toc.html" target="_top" alt="->"> + #{png_nav.toc} + </a> +} + else '' + end if @make.build.html_top_band? %{<table summary="concordance navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> <tr><td width="20%"> @@ -317,29 +326,29 @@ WOK </td> <td width="75%" align="center"> #{doc_types} -</td> -<td width="5%" align="right"> - <a href="toc.html" target="_top" alt="->"> - #{png_nav.toc} - </a> +#{up_button} #{@vz.table_close} <p />} else '' end end def seg_head_navigation_band(page=:seg) - if page==:manifest - nxt=(@file.output_dir_structure.by_language_code? \ - || @file.output_dir_structure.by_filetype?) \ - ? "../html/#{@md.fnb}/toc#{@md.lang_code_insert}#{Sfx[:html]}" - : "toc#{@md.lang_code_insert}#{Sfx[:html]}" - firstseg=%{<a href="#{nxt}" target="_top" alt="->"> + if @make.build.html_navigation? + if page==:manifest + nxt=(@file.output_dir_structure.by_language_code? \ + || @file.output_dir_structure.by_filetype?) \ + ? "../html/#{@md.fnb}/toc#{@md.lang_code_insert}#{Sfx[:html]}" + : "toc#{@md.lang_code_insert}#{Sfx[:html]}" + firstseg=%{<a href="#{nxt}" target="_top" alt="->"> + #{png_nav.nxt}</a>} + elsif @md.firstseg =~/\S+/ + firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="->"> #{png_nav.nxt}</a>} - elsif @md.firstseg =~/\S+/ - firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="->"> - #{png_nav.nxt}</a>} + end + else '' end - %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> + if @make.build.html_top_band? + %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> <tr><td width="20%"> #{button_home(page)} </td> @@ -350,6 +359,8 @@ WOK #{firstseg} #{@vz.table_close} <p />} + else '' + end end def manifest_link(text) # @file=SiSU_Env::FileOp.new(@md) if @md diff --git a/lib/sisu/v6/hub_options.rb b/lib/sisu/v6/hub_options.rb index 336f0d93..6f9543d3 100644 --- a/lib/sisu/v6/hub_options.rb +++ b/lib/sisu/v6/hub_options.rb @@ -960,7 +960,7 @@ module SiSU_Commandline =~/"--(?:exc|no)-html-navigation-bar"|"--(?:exc|no)-navigation-bar"/ \ || act[:switch][:off].inspect =~/"html_navigation_bar"|"navbar"/ { bool: false, set: :off } - else { bool: true, set: :na } + else { bool: false, set: :na } end act[:segsubtoc]=if select_arr.inspect \ =~/"--inc-segsubtoc"/ diff --git a/lib/sisu/v6/manifest.rb b/lib/sisu/v6/manifest.rb index a0d4102f..5863ddb9 100644 --- a/lib/sisu/v6/manifest.rb +++ b/lib/sisu/v6/manifest.rb @@ -947,7 +947,7 @@ WOK harvest=(FileTest.file?("#{pth_local}/authors#{@fn_lng}.html") \ && FileTest.file?("#{pth_local}/topics#{@fn_lng}.html")) \ ? %{<p class="small"><a href="#{pth_rel_home}/index.html">.:</a> other document manifests: [<a href="#{pth_rel}/authors#{@fn_lng}.html">authors</a>] [<a href="#{pth_rel}/topics#{@fn_lng}.html">topics</a>] #{output_organised_by}</p>} - : %{<p class="small"><a href="#{pth_rel_home}/index.html">#{output_organised_by}</p>} + : %{<p class="small"><a href="#{pth_rel_home}">#{output_organised_by}</a></p>} manifest_title=%{<p class="bold">#{@translate.manifest_description}</p>#{harvest}} @manifest[:html] <<<<WOK <div id="horizontal_links"> diff --git a/lib/sisu/v6/se_processing.rb b/lib/sisu/v6/se_processing.rb index 32b2490a..15db8cff 100644 --- a/lib/sisu/v6/se_processing.rb +++ b/lib/sisu/v6/se_processing.rb @@ -309,7 +309,7 @@ module SiSU_Processing_Settings elsif env_rc.build.html_navigation_bar? ==:off false else - true + false end end def search_form? diff --git a/lib/sisu/v6/shared_metadata.rb b/lib/sisu/v6/shared_metadata.rb index dae28c6c..b51fc8f4 100644 --- a/lib/sisu/v6/shared_metadata.rb +++ b/lib/sisu/v6/shared_metadata.rb @@ -61,6 +61,7 @@ =end module SiSU_Metadata + require_relative 'xml_shared' # xml_shared.rb class Summary attr_accessor :tag,:inf,:class,:attrib def initialize(md,display_heading=false) @@ -73,6 +74,14 @@ module SiSU_Metadata language=l[:n] tr=SiSU_Translate::Source.new(@md,language) @attrib='md' + def meta_content_clean(content='') + content=if not content.nil? + content=content.tr('"',"'"). + gsub(/&/,'&') + content=SiSU_XML_Munge::Trans.new(@md).char_enc.utf8(content) + else content + end + end if @display_heading @tag,@inf=%{<b><u>Document Metadata</u></b>},'' meta << self.meta_para @@ -114,7 +123,7 @@ module SiSU_Metadata end if defined? @md.rights.all \ and @md.rights.all=~/\S+/ - @tag,@inf,@class=tr.rights,@md.rights.all,'dc' #15 + @tag,@inf,@class=tr.rights,meta_content_clean(@md.rights.all),'dc' #15 meta << self.meta_para end if defined? @md.classify.subject \ @@ -809,7 +818,8 @@ module SiSU_Metadata end def xml_docbook def meta_para - inf_xml=char_enc(@inf).utf8 + inf_xml=char_enc(@inf).amp + inf_xml=char_enc(inf_xml).utf8 inf_xml=char_enc(inf_xml).br <<WOK #{Ax[:tab]}<#{@tag}> @@ -842,6 +852,7 @@ WOK end def xml_dom def meta_para + inf_xml=char_enc(inf_xml).amp inf_xml=char_enc(@inf).utf8 inf_xml=char_enc(inf_xml).br <<WOK @@ -860,6 +871,7 @@ WOK end def xhtml_scroll def meta_para + inf_xml=char_enc(inf_xml).amp inf_xml=char_enc(@inf).utf8 inf_xml=char_enc(inf_xml).br <<WOK diff --git a/lib/sisu/v6/xhtml.rb b/lib/sisu/v6/xhtml.rb index 17f3a335..3bb33066 100644 --- a/lib/sisu/v6/xhtml.rb +++ b/lib/sisu/v6/xhtml.rb @@ -234,7 +234,7 @@ WOK end extract_endnotes(dob) dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>'). #footnote/endnote clean - gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean + gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') util=SiSU_TextUtils::Wrap.new(dob.obj,70) wrapped=util.line_wrap @@xml[:body] << if defined? dob.ocn diff --git a/lib/sisu/v6/xhtml_epub2.rb b/lib/sisu/v6/xhtml_epub2.rb index 26399ef7..44495ff3 100644 --- a/lib/sisu/v6/xhtml_epub2.rb +++ b/lib/sisu/v6/xhtml_epub2.rb @@ -71,6 +71,8 @@ module SiSU_XHTML_EPUB2 include SiSU_Particulars require_relative 'defaults' # defaults.rb include SiSU_Viz + require_relative 'xml_shared' # xml_shared.rb + include SiSU_XML_Munge require_relative 'xhtml_table' # xhtml_table.rb require_relative 'xhtml_epub2_format' # xhtml_epub2_format.rb include SiSU_XHTML_EPUB2_Format diff --git a/lib/sisu/v6/xml_format.rb b/lib/sisu/v6/xml_format.rb index 38cc7f85..e649fa51 100644 --- a/lib/sisu/v6/xml_format.rb +++ b/lib/sisu/v6/xml_format.rb @@ -191,15 +191,26 @@ module SiSU_XML_Format end if defined? @md.rights.all \ and @md.rights.all=~/\S+/ # DublinCore 15 - rights - @rdf_rights=%{ dc.rights="#{@md.rights.all}"\n} - @rights=%{<meta name="dc.rights" content="#{@md.rights.all}" />\n} + rights=meta_content_clean(@md.rights.all) + copyright=meta_content_clean(@md.rights.copyright.all) + @rdf_rights=%{ dc.rights="#{rights}"\n} + @rights=%{<meta name="dc.rights" content="#{rights}" />\n} end - @copyright=%{<meta name="copyright" content="#{@md.rights.copyright.all}" />\n} if @md.rights.copyright.all # possibly redundant see dc.rights + @copyright=%{<meta name="copyright" content="#{copyright}" />\n} \ + if @md.rights.copyright.all # possibly redundant see dc.rights @owner=%{<meta name="owner" content="#{@md.owner}" />\n} if @md.owner @keywords=%{<meta name="keywords" content="#{@md.keywords}" />\n} if @md.keywords @vz=SiSU_Viz::Defaults.new #margin,paragraph,table,banner,url,png,txt,color,font,nav_txt,nav_png,credits,js,php @index='index' end + def meta_content_clean(content='') + content=if not content.nil? + content=content.tr('"',"'"). + gsub(/&/,'&') + content=SiSU_XML_Munge::Trans.new(@md).char_enc.utf8(content) + else content + end + end def table_close '</font> </td></tr></table>' end @@ -558,7 +569,8 @@ WOK def prefix_a end def rights - rights=@md.rights.copyright.all.gsub(/^\s*Copyright\s+\(C\)/,'Copyright <sup>©</sup> ') + copyright=meta_content_clean(@md.rights.copyright.all) + rights=copyright(/^\s*Copyright\s+\(C\)/,'Copyright <sup>©</sup> ') %{<p class="small_left">Rights: #{rights}</p> <p />} end diff --git a/lib/sisu/v6/xml_odf_odt.rb b/lib/sisu/v6/xml_odf_odt.rb index 967812db..e6cfafe5 100644 --- a/lib/sisu/v6/xml_odf_odt.rb +++ b/lib/sisu/v6/xml_odf_odt.rb @@ -71,6 +71,8 @@ module SiSU_XML_ODF_ODT include SiSU_XML_ODF_ODT_Format require_relative 'shared_metadata' # shared_metadata.rb require_relative 'txt_shared' # txt_shared.rb + require_relative 'xml_shared' # xml_shared.rb + include SiSU_XML_Munge @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 class Source begin diff --git a/lib/sisu/v6/xml_shared.rb b/lib/sisu/v6/xml_shared.rb index 35d1132d..3ffda8f3 100644 --- a/lib/sisu/v6/xml_shared.rb +++ b/lib/sisu/v6/xml_shared.rb @@ -232,104 +232,6 @@ module SiSU_XML_Munge if @sys.locale =~/utf-?8/i # instead ucs for utf8 # String#encode Iñtërnâtiônàlizætiøn dob.obj=dob.obj.gsub(/ /u,' '). # space identify gsub(/ /u,' ') # space identify - else - dob.obj=dob.obj.gsub(/¢/u,'¢'). # ¢ - gsub(/£/u,'£'). # £ - gsub(/¥/u,'¥'). # ¥ - gsub(/§/u,'§'). # § - gsub(/©/u,'©'). # © - gsub(/ª/u,'ª'). # ª - gsub(/«/u,'«'). # « - gsub(/®/u,'®'). # ® - gsub(/°/u,'°'). # ° - gsub(/±/u,'±'). # ± - gsub(/²/u,'²'). # ² - gsub(/³/u,'³'). # ³ - gsub(/µ/u,'µ'). # µ - gsub(/¶/u,'¶'). # ¶ - gsub(/¹/u,'¹'). # ¹ - gsub(/º/u,'º'). # º - gsub(/»/u,'»'). # » - gsub(/¼/u,'¼'). # ¼ - gsub(/½/u,'½'). # ½ - gsub(/¾/u,'¾'). # ¾ - gsub(/×/u,'×'). # × - gsub(/÷/u,'÷'). # ÷ - gsub(/¿/u,'¿'). # ¿ - gsub(/À/u,'À'). # À - gsub(/Á/u,'Á'). # Á - gsub(/Â/u,'Â'). # Â - gsub(/Ã/u,'Ã'). # Ã - gsub(/Ä/u,'Ä'). # Ä - gsub(/Å/u,'Å'). # Å - gsub(/Æ/u,'Æ'). # Æ - gsub(/Ç/u,'Ç'). # Ç - gsub(/È/u,'È'). # È - gsub(/É/u,'É'). # É - gsub(/Ê/u,'Ê'). # Ê - gsub(/Ë/u,'Ë'). # Ë - gsub(/Ì/u,'Ì'). # Ì - gsub(/Í/u,'Í'). # Í - gsub(/Î/u,'Î'). # Î - gsub(/Ï/u,'Ï'). # Ï - gsub(/Ð/u,'Ð'). # Ð - gsub(/Ñ/u,'Ñ'). # Ñ - gsub(/Ò/u,'Ò'). # Ò - gsub(/Ó/u,'Ó'). # Ó - gsub(/Ô/u,'Ô'). # Ô - gsub(/Õ/u,'Õ'). # Õ - gsub(/Ö/u,'Ö'). # Ö - gsub(/Ø/u,'Ø'). # Ø - gsub(/Ù/u,'Ù'). # Ù - gsub(/Ú/u,'Ú'). # Ú - gsub(/Û/u,'Û'). # Û - gsub(/Ü/u,'Ü'). # Ü - gsub(/Ý/u,'Ý'). # Ý - gsub(/Þ/u,'Þ'). # Þ - gsub(/ß/u,'ß'). # ß - gsub(/à/u,'à'). # à - gsub(/á/u,'á'). # á - gsub(/â/u,'â'). # â - gsub(/ã/u,'ã'). # ã - gsub(/ä/u,'ä'). # ä - gsub(/å/u,'å'). # å - gsub(/æ/u,'æ'). # æ - gsub(/ç/u,'ç'). # ç - gsub(/è/u,'è'). # è - gsub(/é/u,'´'). # é - gsub(/ê/u,'ˆ'). # ê - gsub(/ë/u,'ë'). # ë - gsub(/ì/u,'ì'). # ì - gsub(/í/u,'´'). # í - gsub(/î/u,'î'). # î - gsub(/ï/u,'ï'). # ï - gsub(/ð/u,'ð'). # ð - gsub(/ñ/u,'ñ'). # ñ - gsub(/ò/u,'ò'). # ò - gsub(/ó/u,'ó'). # ó - gsub(/ô/u,'ô'). # ô - gsub(/õ/u,'õ'). # õ - gsub(/ö/u,'ö'). # ö - gsub(/ø/u,'ø'). # ø - gsub(/ù/u,'ù'). # ú - gsub(/ú/u,'ú'). # û - gsub(/û/u,'û'). # ü - gsub(/ü/u,'ü'). # ý - gsub(/þ/u,'þ'). # þ - gsub(/ÿ/u,'ÿ'). # ÿ - gsub(/‘/u,'&#lsquo;'). # ‘ # ‘ - gsub(/’/u,'&#rsquo;'). # ’ # ’ - gsub(/“/u,'“'). # “ # “ - gsub(/”/u,'”'). # ” # ” - gsub(/–/u,'–'). # – # – - gsub(/—/u,'—'). # — # — - gsub(/∝/u,'∝'). # ∝ # ∝ - gsub(/∞/u,'∞'). # ∞ # ∞ - gsub(/™/u,'™'). # ™ # ™ - gsub(/✠/u,'✠'). # ✠ - #gsub(/✠/u '†'). # † # † incorrect replacement † - gsub(/ /u,' '). # space identify - gsub(/ /u,' ') # space identify end end self @@ -411,7 +313,8 @@ module SiSU_XML_Munge %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). gsub(/#{Dx[:url_o]}/,"#{Dx[:url_o_xml]}"). gsub(/#{Dx[:url_c]}/,"#{Dx[:url_c_xml]}"). - gsub(/ |#{Mx[:nbsp]}/m,' ') + gsub(/ |#{Mx[:nbsp]}/m,' '). + gsub(/;&([^#]|(?:[^gl][^t]|[^a][^m][^p]|[^n][^b][^s][^p])[^;])/,';&\1') # pattern not to match dob end def markup_light(dob='') @@ -426,7 +329,8 @@ module SiSU_XML_Munge gsub(/&([^;]{1,5})/,'&\1'). #sort, rough estimate, revisit #WATCH found in node not sax gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/, "<image.path>#{@md.file.output_path.xml.rel_image}\/\\1</image.path>"). - gsub(/ |#{Mx[:nbsp]}/,' ') + gsub(/ |#{Mx[:nbsp]}/,' '). + gsub(/;&([^#]|(?:[^gl][^t]|[^a][^m][^p]|[^n][^b][^s][^p])[^;])/,';&\1') # pattern not to match wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17 dob.obj=tidywords(wordlist).join(' ').strip dob @@ -698,7 +602,8 @@ module SiSU_XML_Tags #Format end def meta_content_clean(content='') content=if not content.nil? - content=content.tr('"',"'") + content=content.tr('"',"'"). + gsub(/&/,'&') content=SiSU_XML_Munge::Trans.new(@md).char_enc.utf8(content) else content end |