From ec29e71378c31e5a43ea4ac163bbed5ac661fb14 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Fri, 5 Sep 2014 22:42:45 -0400
Subject: v5 v6: version & changelog

---
 data/doc/sisu/CHANGELOG_v5 | 7 +++++++
 data/doc/sisu/CHANGELOG_v6 | 7 +++++++
 data/sisu/v5/v/version.yml | 6 +++---
 data/sisu/v6/v/version.yml | 6 +++---
 setup/sisu_version.rb      | 4 ++--
 5 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index 474da965..d72b1767 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -31,6 +31,13 @@ v2 branch is removed; it is available in sisu =< 3.3.2
 
 %% Reverse Chronological:
 
+%% 5.6.5.orig.tar.xz (2014-09-05:35/5)
+http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_5.6.5
+http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_5.6.5-1
+http://www.jus.uio.no/sisu/pkg/src/sisu_5.6.5.orig.tar.xz
+  sisu_5.6.5.orig.tar.xz
+  sisu_5.6.5-1.dsc
+
 %% 5.6.4.orig.tar.xz (2014-09-01:35/1)
 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_5.6.4
 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_5.6.4-1
diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6
index 29136e1f..5fba6a12 100644
--- a/data/doc/sisu/CHANGELOG_v6
+++ b/data/doc/sisu/CHANGELOG_v6
@@ -21,6 +21,13 @@ v2 branch is removed; it is available in sisu =< 3.3.2
 
 %% Reverse Chronological:
 
+%% 6.2.6.orig.tar.xz (2014-09-05:35/5)
+http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_6.2.6
+http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_6.2.6-1
+http://www.jus.uio.no/sisu/pkg/src/sisu_6.2.6.orig.tar.xz
+  sisu_6.2.6.orig.tar.xz
+  sisu_6.2.6-1.dsc
+
 %% 6.2.5.orig.tar.xz (2014-09-01:35/1)
 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_6.2.5
 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_6.2.5-1
diff --git a/data/sisu/v5/v/version.yml b/data/sisu/v5/v/version.yml
index 2f531540..91755ba4 100644
--- a/data/sisu/v5/v/version.yml
+++ b/data/sisu/v5/v/version.yml
@@ -1,5 +1,5 @@
 ---
 :project: SiSU
-:version: 5.6.4
-:date_stamp: 2014w35/1
-:date: "2014-09-01"
+:version: 5.6.5
+:date_stamp: 2014w35/5
+:date: "2014-09-05"
diff --git a/data/sisu/v6/v/version.yml b/data/sisu/v6/v/version.yml
index 0239fe45..a0164ff7 100644
--- a/data/sisu/v6/v/version.yml
+++ b/data/sisu/v6/v/version.yml
@@ -1,5 +1,5 @@
 ---
 :project: SiSU
-:version: 6.2.5
-:date_stamp: 2014w35/1
-:date: "2014-09-01"
+:version: 6.2.6
+:date_stamp: 2014w35/5
+:date: "2014-09-05"
diff --git a/setup/sisu_version.rb b/setup/sisu_version.rb
index 768eb7db..5c1223d8 100644
--- a/setup/sisu_version.rb
+++ b/setup/sisu_version.rb
@@ -1,7 +1,7 @@
 #% constants
 module SiSUversion
-  SiSU_version_next_stable           = '5.6.4' #% set version stable current
-  SiSU_version_next_unstable         = '6.2.5' #% set version unstable dev
+  SiSU_version_next_stable           = '5.6.5' #% set version stable current
+  SiSU_version_next_unstable         = '6.2.6' #% set version unstable dev
   #% qi quick install file
   SiSU_version_generic_next_stable   = '5.4.x'
   SiSU_version_generic_next_unstable = '6.0.x'
-- 
cgit v1.2.3


From 94cf89b09cfd60a87d096926035aaec061a24c56 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Fri, 5 Sep 2014 22:45:07 -0400
Subject: v5 v6: link/path fixes

* manifest, link where no "document harvest"
* html, home button links url (remove slash)
* harvest_authors, by_filetype, manifest path
---
 data/doc/sisu/CHANGELOG_v5     | 5 +++++
 data/doc/sisu/CHANGELOG_v6     | 5 +++++
 lib/sisu/v5/harvest_authors.rb | 4 ++--
 lib/sisu/v5/html_format.rb     | 2 +-
 lib/sisu/v5/manifest.rb        | 2 +-
 lib/sisu/v6/harvest_authors.rb | 4 ++--
 lib/sisu/v6/html_format.rb     | 2 +-
 lib/sisu/v6/manifest.rb        | 2 +-
 8 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index d72b1767..089f9a5f 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -38,6 +38,11 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.6.5.orig.tar.xz
   sisu_5.6.5.orig.tar.xz
   sisu_5.6.5-1.dsc
 
+* link/path fixes,
+  * manifest, link where no "document harvest"
+  * html, home button links url (remove slash)
+  * harvest_authors, by_filetype, manifest path
+
 %% 5.6.4.orig.tar.xz (2014-09-01:35/1)
 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_5.6.4
 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_5.6.4-1
diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6
index 5fba6a12..2222fc85 100644
--- a/data/doc/sisu/CHANGELOG_v6
+++ b/data/doc/sisu/CHANGELOG_v6
@@ -28,6 +28,11 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.2.6.orig.tar.xz
   sisu_6.2.6.orig.tar.xz
   sisu_6.2.6-1.dsc
 
+* link/path fixes,
+  * manifest, link where no "document harvest"
+  * html, home button links url (remove slash)
+  * harvest_authors, by_filetype, manifest path
+
 %% 6.2.5.orig.tar.xz (2014-09-01:35/1)
 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_6.2.5
 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_6.2.5-1
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..16120d88 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 --&gt;" /></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>}
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/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..febfc30e 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 --&gt;" /></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>}
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">
-- 
cgit v1.2.3


From 8422ce1dca74dcae385c1a14c16e038e83d68afc Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Fri, 5 Sep 2014 22:49:57 -0400
Subject: v5 v6: shared_metadata, requires xml_shared

---
 data/doc/sisu/CHANGELOG_v5     | 2 ++
 data/doc/sisu/CHANGELOG_v6     | 2 ++
 lib/sisu/v5/shared_metadata.rb | 1 +
 lib/sisu/v6/shared_metadata.rb | 1 +
 4 files changed, 6 insertions(+)

diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index 089f9a5f..17889091 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -38,6 +38,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.6.5.orig.tar.xz
   sisu_5.6.5.orig.tar.xz
   sisu_5.6.5-1.dsc
 
+* shared_metadata, requires xml_shared
+
 * link/path fixes,
   * manifest, link where no "document harvest"
   * html, home button links url (remove slash)
diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6
index 2222fc85..6c043373 100644
--- a/data/doc/sisu/CHANGELOG_v6
+++ b/data/doc/sisu/CHANGELOG_v6
@@ -28,6 +28,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.2.6.orig.tar.xz
   sisu_6.2.6.orig.tar.xz
   sisu_6.2.6-1.dsc
 
+* shared_metadata, requires xml_shared
+
 * link/path fixes,
   * manifest, link where no "document harvest"
   * html, home button links url (remove slash)
diff --git a/lib/sisu/v5/shared_metadata.rb b/lib/sisu/v5/shared_metadata.rb
index 1f21af3f..405e7939 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)
diff --git a/lib/sisu/v6/shared_metadata.rb b/lib/sisu/v6/shared_metadata.rb
index dae28c6c..bef13903 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)
-- 
cgit v1.2.3


From 6a13e63f51e69dacefe580b9084006ae66d3fafc Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Fri, 5 Sep 2014 22:54:22 -0400
Subject: v5 v6: xml xhtml outputs, &amp; issues

---
 data/doc/sisu/CHANGELOG_v5     |   2 +
 data/doc/sisu/CHANGELOG_v6     |   2 +
 lib/sisu/v5/shared_metadata.rb |  15 +++++-
 lib/sisu/v5/xhtml.rb           |   2 +-
 lib/sisu/v5/xhtml_epub2.rb     |   2 +
 lib/sisu/v5/xml_format.rb      |  20 ++++++--
 lib/sisu/v5/xml_odf_odt.rb     |   2 +
 lib/sisu/v5/xml_shared.rb      | 107 +++--------------------------------------
 lib/sisu/v6/shared_metadata.rb |  15 +++++-
 lib/sisu/v6/xhtml.rb           |   2 +-
 lib/sisu/v6/xhtml_epub2.rb     |   2 +
 lib/sisu/v6/xml_format.rb      |  20 ++++++--
 lib/sisu/v6/xml_odf_odt.rb     |   2 +
 lib/sisu/v6/xml_shared.rb      | 107 +++--------------------------------------
 14 files changed, 84 insertions(+), 216 deletions(-)

diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index 17889091..443f07bf 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -38,6 +38,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.6.5.orig.tar.xz
   sisu_5.6.5.orig.tar.xz
   sisu_5.6.5-1.dsc
 
+* xml xhtml outputs, &amp; issues
+
 * shared_metadata, requires xml_shared
 
 * link/path fixes,
diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6
index 6c043373..22b9d305 100644
--- a/data/doc/sisu/CHANGELOG_v6
+++ b/data/doc/sisu/CHANGELOG_v6
@@ -28,6 +28,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.2.6.orig.tar.xz
   sisu_6.2.6.orig.tar.xz
   sisu_6.2.6-1.dsc
 
+* xml xhtml outputs, &amp; issues
+
 * shared_metadata, requires xml_shared
 
 * link/path fixes,
diff --git a/lib/sisu/v5/shared_metadata.rb b/lib/sisu/v5/shared_metadata.rb
index 405e7939..e6721964 100644
--- a/lib/sisu/v5/shared_metadata.rb
+++ b/lib/sisu/v5/shared_metadata.rb
@@ -74,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(/&/,'&amp;')
+          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
@@ -115,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 \
@@ -810,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}>
@@ -843,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
@@ -861,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(/&/,'&amp;')
+        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>&copy;</sup>&nbsp;')
+      copyright=meta_content_clean(@md.rights.copyright.all)
+      rights=copyright(/^\s*Copyright\s+\(C\)/,'Copyright <sup>&copy;</sup>&nbsp;')
       %{<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,'&cent;').      # &#162;
-            gsub(/£/u,'&pound;').     # &#163;
-            gsub(/¥/u,'&yen;').       # &#165;
-            gsub(/§/u,'&sect;').      # &#167;
-            gsub(/©/u,'&copy;').      # &#169;
-            gsub(/ª/u,'&ordf;').      # &#170;
-            gsub(/«/u,'&laquo;').     # &#171;
-            gsub(/®/u,'&reg;').       # &#174;
-            gsub(/°/u,'&deg;').       # &#176;
-            gsub(/±/u,'&plusmn;').    # &#177;
-            gsub(/²/u,'&sup2;').      # &#178;
-            gsub(/³/u,'&sup3;').      # &#179;
-            gsub(/µ/u,'&micro;').     # &#181;
-            gsub(/¶/u,'&para;').      # &#182;
-            gsub(/¹/u,'&sup1;').      # &#185;
-            gsub(/º/u,'&ordm;').      # &#186;
-            gsub(/»/u,'&raquo;').     # &#187;
-            gsub(/¼/u,'&frac14;').    # &#188;
-            gsub(/½/u,'&frac12;').    # &#189;
-            gsub(/¾/u,'&frac34;').    # &#190;
-            gsub(/×/u,'&times;').     # &#215;
-            gsub(/÷/u,'&divide;').    # &#247;
-            gsub(/¿/u,'&iquest;').    # &#191;
-            gsub(/À/u,'&Agrave;').    # &#192;
-            gsub(/Á/u,'&Aacute;').    # &#193;
-            gsub(/Â/u,'&Acirc;').     # &#194;
-            gsub(/Ã/u,'&Atilde;').    # &#195;
-            gsub(/Ä/u,'&Auml;').      # &#196;
-            gsub(/Å/u,'&Aring;').     # &#197;
-            gsub(/Æ/u,'&AElig;').     # &#198;
-            gsub(/Ç/u,'&Ccedil;').    # &#199;
-            gsub(/È/u,'&Egrave;').    # &#200;
-            gsub(/É/u,'&Eacute;').    # &#201;
-            gsub(/Ê/u,'&Ecirc;').     # &#202;
-            gsub(/Ë/u,'&Euml;').      # &#203;
-            gsub(/Ì/u,'&Igrave;').    # &#204;
-            gsub(/Í/u,'&Iacute;').    # &#205;
-            gsub(/Î/u,'&Icirc;').     # &#206;
-            gsub(/Ï/u,'&Iuml;').      # &#207;
-            gsub(/Ð/u,'&ETH;').       # &#208;
-            gsub(/Ñ/u,'&Ntilde;').    # &#209;
-            gsub(/Ò/u,'&Ograve;').    # &#210;
-            gsub(/Ó/u,'&Oacute;').    # &#211;
-            gsub(/Ô/u,'&Ocirc;').     # &#212;
-            gsub(/Õ/u,'&Otilde;').    # &#213;
-            gsub(/Ö/u,'&Ouml;').      # &#214;
-            gsub(/Ø/u,'&Oslash;').    # &#216;
-            gsub(/Ù/u,'&Ugrave;').    # &#217;
-            gsub(/Ú/u,'&Uacute;').    # &#218;
-            gsub(/Û/u,'&Ucirc;').     # &#219;
-            gsub(/Ü/u,'&Uuml;').      # &#220;
-            gsub(/Ý/u,'&Yacute;').    # &#221;
-            gsub(/Þ/u,'&THORN;').     # &#222;
-            gsub(/ß/u,'&szlig;').     # &#223;
-            gsub(/à/u,'&agrave;').    # &#224;
-            gsub(/á/u,'&aacute;').    # &#225;
-            gsub(/â/u,'&acirc;').     # &#226;
-            gsub(/ã/u,'&atilde;').    # &#227;
-            gsub(/ä/u,'&auml;').      # &#228;
-            gsub(/å/u,'&aring;').     # &#229;
-            gsub(/æ/u,'&aelig;').     # &#230;
-            gsub(/ç/u,'&ccedil;').    # &#231;
-            gsub(/è/u,'&egrave;').    # &#232;
-            gsub(/é/u,'&acute;').     # &#233;
-            gsub(/ê/u,'&circ;').      # &#234;
-            gsub(/ë/u,'&euml;').      # &#235;
-            gsub(/ì/u,'&igrave;').    # &#236;
-            gsub(/í/u,'&acute;').     # &#237;
-            gsub(/î/u,'&icirc;').     # &#238;
-            gsub(/ï/u,'&iuml;').      # &#239;
-            gsub(/ð/u,'&eth;').       # &#240;
-            gsub(/ñ/u,'&ntilde;').    # &#241;
-            gsub(/ò/u,'&ograve;').    # &#242;
-            gsub(/ó/u,'&oacute;').    # &#243;
-            gsub(/ô/u,'&ocirc;').     # &#244;
-            gsub(/õ/u,'&otilde;').    # &#245;
-            gsub(/ö/u,'&ouml;').      # &#246;
-            gsub(/ø/u,'&oslash;').    # &#248;
-            gsub(/ù/u,'&ugrave;').    # &#250;
-            gsub(/ú/u,'&uacute;').    # &#251;
-            gsub(/û/u,'&ucirc;').     # &#252;
-            gsub(/ü/u,'&uuml;').      # &#253;
-            gsub(/þ/u,'&thorn;').     # &#254;
-            gsub(/ÿ/u,'&yuml;').      # &#255;
-            gsub(/‘/u,'&#lsquo;').    # &lsquo;  # &#8216;
-            gsub(/’/u,'&#rsquo;').    # &rsquo;  # &#8217;
-            gsub(/“/u,'&ldquo;').     # &ldquo;  # &#8220;
-            gsub(/”/u,'&rdquo;').     # &rdquo;  # &#8221;
-            gsub(/–/u,'&ndash;').     # &ndash;  # &#8211;
-            gsub(/—/u,'&mdash;').     # &mdash;  # &#8212;
-            gsub(/∝/u,'&prop;').      # &prop;   # &#8733;
-            gsub(/∞/u,'&infin;').     # &infin;  # &#8734;
-            gsub(/™/u,'&trade;').     # &trade;  # &#8482;
-            gsub(/✠/u,'&#10016;').    # &#10016;
-            #gsub(/✠/u '&dagger;').    # &dagger; # &#8224; 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(/&nbsp;|#{Mx[:nbsp]}/m,'&#160;')
+        gsub(/&nbsp;|#{Mx[:nbsp]}/m,'&#160;').
+        gsub(/;&([^#]|(?:[^gl][^t]|[^a][^m][^p]|[^n][^b][^s][^p])[^;])/,';&amp;\1') # pattern not to match
       dob
     end
     def markup_light(dob='')
@@ -426,7 +329,8 @@ module SiSU_XML_Munge
         gsub(/&([^;]{1,5})/,'&amp;\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(/&nbsp;|#{Mx[:nbsp]}/,'&#160;')
+        gsub(/&nbsp;|#{Mx[:nbsp]}/,'&#160;').
+        gsub(/;&([^#]|(?:[^gl][^t]|[^a][^m][^p]|[^n][^b][^s][^p])[^;])/,';&amp;\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(/&/,'&amp;')
         content=SiSU_XML_Munge::Trans.new(@md).char_enc.utf8(content)
       else content
       end
diff --git a/lib/sisu/v6/shared_metadata.rb b/lib/sisu/v6/shared_metadata.rb
index bef13903..b51fc8f4 100644
--- a/lib/sisu/v6/shared_metadata.rb
+++ b/lib/sisu/v6/shared_metadata.rb
@@ -74,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(/&/,'&amp;')
+          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
@@ -115,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 \
@@ -810,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}>
@@ -843,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
@@ -861,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(/&/,'&amp;')
+        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>&copy;</sup>&nbsp;')
+      copyright=meta_content_clean(@md.rights.copyright.all)
+      rights=copyright(/^\s*Copyright\s+\(C\)/,'Copyright <sup>&copy;</sup>&nbsp;')
       %{<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,'&cent;').      # &#162;
-            gsub(/£/u,'&pound;').     # &#163;
-            gsub(/¥/u,'&yen;').       # &#165;
-            gsub(/§/u,'&sect;').      # &#167;
-            gsub(/©/u,'&copy;').      # &#169;
-            gsub(/ª/u,'&ordf;').      # &#170;
-            gsub(/«/u,'&laquo;').     # &#171;
-            gsub(/®/u,'&reg;').       # &#174;
-            gsub(/°/u,'&deg;').       # &#176;
-            gsub(/±/u,'&plusmn;').    # &#177;
-            gsub(/²/u,'&sup2;').      # &#178;
-            gsub(/³/u,'&sup3;').      # &#179;
-            gsub(/µ/u,'&micro;').     # &#181;
-            gsub(/¶/u,'&para;').      # &#182;
-            gsub(/¹/u,'&sup1;').      # &#185;
-            gsub(/º/u,'&ordm;').      # &#186;
-            gsub(/»/u,'&raquo;').     # &#187;
-            gsub(/¼/u,'&frac14;').    # &#188;
-            gsub(/½/u,'&frac12;').    # &#189;
-            gsub(/¾/u,'&frac34;').    # &#190;
-            gsub(/×/u,'&times;').     # &#215;
-            gsub(/÷/u,'&divide;').    # &#247;
-            gsub(/¿/u,'&iquest;').    # &#191;
-            gsub(/À/u,'&Agrave;').    # &#192;
-            gsub(/Á/u,'&Aacute;').    # &#193;
-            gsub(/Â/u,'&Acirc;').     # &#194;
-            gsub(/Ã/u,'&Atilde;').    # &#195;
-            gsub(/Ä/u,'&Auml;').      # &#196;
-            gsub(/Å/u,'&Aring;').     # &#197;
-            gsub(/Æ/u,'&AElig;').     # &#198;
-            gsub(/Ç/u,'&Ccedil;').    # &#199;
-            gsub(/È/u,'&Egrave;').    # &#200;
-            gsub(/É/u,'&Eacute;').    # &#201;
-            gsub(/Ê/u,'&Ecirc;').     # &#202;
-            gsub(/Ë/u,'&Euml;').      # &#203;
-            gsub(/Ì/u,'&Igrave;').    # &#204;
-            gsub(/Í/u,'&Iacute;').    # &#205;
-            gsub(/Î/u,'&Icirc;').     # &#206;
-            gsub(/Ï/u,'&Iuml;').      # &#207;
-            gsub(/Ð/u,'&ETH;').       # &#208;
-            gsub(/Ñ/u,'&Ntilde;').    # &#209;
-            gsub(/Ò/u,'&Ograve;').    # &#210;
-            gsub(/Ó/u,'&Oacute;').    # &#211;
-            gsub(/Ô/u,'&Ocirc;').     # &#212;
-            gsub(/Õ/u,'&Otilde;').    # &#213;
-            gsub(/Ö/u,'&Ouml;').      # &#214;
-            gsub(/Ø/u,'&Oslash;').    # &#216;
-            gsub(/Ù/u,'&Ugrave;').    # &#217;
-            gsub(/Ú/u,'&Uacute;').    # &#218;
-            gsub(/Û/u,'&Ucirc;').     # &#219;
-            gsub(/Ü/u,'&Uuml;').      # &#220;
-            gsub(/Ý/u,'&Yacute;').    # &#221;
-            gsub(/Þ/u,'&THORN;').     # &#222;
-            gsub(/ß/u,'&szlig;').     # &#223;
-            gsub(/à/u,'&agrave;').    # &#224;
-            gsub(/á/u,'&aacute;').    # &#225;
-            gsub(/â/u,'&acirc;').     # &#226;
-            gsub(/ã/u,'&atilde;').    # &#227;
-            gsub(/ä/u,'&auml;').      # &#228;
-            gsub(/å/u,'&aring;').     # &#229;
-            gsub(/æ/u,'&aelig;').     # &#230;
-            gsub(/ç/u,'&ccedil;').    # &#231;
-            gsub(/è/u,'&egrave;').    # &#232;
-            gsub(/é/u,'&acute;').     # &#233;
-            gsub(/ê/u,'&circ;').      # &#234;
-            gsub(/ë/u,'&euml;').      # &#235;
-            gsub(/ì/u,'&igrave;').    # &#236;
-            gsub(/í/u,'&acute;').     # &#237;
-            gsub(/î/u,'&icirc;').     # &#238;
-            gsub(/ï/u,'&iuml;').      # &#239;
-            gsub(/ð/u,'&eth;').       # &#240;
-            gsub(/ñ/u,'&ntilde;').    # &#241;
-            gsub(/ò/u,'&ograve;').    # &#242;
-            gsub(/ó/u,'&oacute;').    # &#243;
-            gsub(/ô/u,'&ocirc;').     # &#244;
-            gsub(/õ/u,'&otilde;').    # &#245;
-            gsub(/ö/u,'&ouml;').      # &#246;
-            gsub(/ø/u,'&oslash;').    # &#248;
-            gsub(/ù/u,'&ugrave;').    # &#250;
-            gsub(/ú/u,'&uacute;').    # &#251;
-            gsub(/û/u,'&ucirc;').     # &#252;
-            gsub(/ü/u,'&uuml;').      # &#253;
-            gsub(/þ/u,'&thorn;').     # &#254;
-            gsub(/ÿ/u,'&yuml;').      # &#255;
-            gsub(/‘/u,'&#lsquo;').    # &lsquo;  # &#8216;
-            gsub(/’/u,'&#rsquo;').    # &rsquo;  # &#8217;
-            gsub(/“/u,'&ldquo;').     # &ldquo;  # &#8220;
-            gsub(/”/u,'&rdquo;').     # &rdquo;  # &#8221;
-            gsub(/–/u,'&ndash;').     # &ndash;  # &#8211;
-            gsub(/—/u,'&mdash;').     # &mdash;  # &#8212;
-            gsub(/∝/u,'&prop;').      # &prop;   # &#8733;
-            gsub(/∞/u,'&infin;').     # &infin;  # &#8734;
-            gsub(/™/u,'&trade;').     # &trade;  # &#8482;
-            gsub(/✠/u,'&#10016;').    # &#10016;
-            #gsub(/✠/u '&dagger;').    # &dagger; # &#8224; 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(/&nbsp;|#{Mx[:nbsp]}/m,'&#160;')
+        gsub(/&nbsp;|#{Mx[:nbsp]}/m,'&#160;').
+        gsub(/;&([^#]|(?:[^gl][^t]|[^a][^m][^p]|[^n][^b][^s][^p])[^;])/,';&amp;\1') # pattern not to match
       dob
     end
     def markup_light(dob='')
@@ -426,7 +329,8 @@ module SiSU_XML_Munge
         gsub(/&([^;]{1,5})/,'&amp;\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(/&nbsp;|#{Mx[:nbsp]}/,'&#160;')
+        gsub(/&nbsp;|#{Mx[:nbsp]}/,'&#160;').
+        gsub(/;&([^#]|(?:[^gl][^t]|[^a][^m][^p]|[^n][^b][^s][^p])[^;])/,';&amp;\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(/&/,'&amp;')
         content=SiSU_XML_Munge::Trans.new(@md).char_enc.utf8(content)
       else content
       end
-- 
cgit v1.2.3


From 57c8b068358e785f80879a87e3f456ad24366ecf Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Fri, 5 Sep 2014 22:57:26 -0400
Subject: v5 v6: (for html) set default to navigation bar off

---
 data/doc/sisu/CHANGELOG_v5   | 2 ++
 data/doc/sisu/CHANGELOG_v6   | 2 ++
 lib/sisu/v5/hub_options.rb   | 2 +-
 lib/sisu/v5/se_processing.rb | 2 +-
 lib/sisu/v6/hub_options.rb   | 2 +-
 lib/sisu/v6/se_processing.rb | 2 +-
 6 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index 443f07bf..41443428 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -38,6 +38,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.6.5.orig.tar.xz
   sisu_5.6.5.orig.tar.xz
   sisu_5.6.5-1.dsc
 
+* (for html) set default to navigation bar off
+
 * xml xhtml outputs, &amp; issues
 
 * shared_metadata, requires xml_shared
diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6
index 22b9d305..783899f1 100644
--- a/data/doc/sisu/CHANGELOG_v6
+++ b/data/doc/sisu/CHANGELOG_v6
@@ -28,6 +28,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.2.6.orig.tar.xz
   sisu_6.2.6.orig.tar.xz
   sisu_6.2.6-1.dsc
 
+* (for html) set default to navigation bar off
+
 * xml xhtml outputs, &amp; issues
 
 * shared_metadata, requires xml_shared
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/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/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/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?
-- 
cgit v1.2.3


From 984b76e0779f3b465b9287b55119d2353423c27f Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Fri, 5 Sep 2014 22:59:44 -0400
Subject: v5 v6: html navigation, enable turn off (nav buttons on remaining
 html segments)

---
 data/doc/sisu/CHANGELOG_v5 |  2 ++
 data/doc/sisu/CHANGELOG_v6 |  2 ++
 lib/sisu/v5/html_format.rb | 41 ++++++++++++++++++++++++++---------------
 lib/sisu/v6/html_format.rb | 41 ++++++++++++++++++++++++++---------------
 4 files changed, 56 insertions(+), 30 deletions(-)

diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index 41443428..aed37d24 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -38,6 +38,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.6.5.orig.tar.xz
   sisu_5.6.5.orig.tar.xz
   sisu_5.6.5-1.dsc
 
+* html navigation, enable turn off (nav buttons on remaining html segments)
+
 * (for html) set default to navigation bar off
 
 * xml xhtml outputs, &amp; issues
diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6
index 783899f1..2e6a6f9b 100644
--- a/data/doc/sisu/CHANGELOG_v6
+++ b/data/doc/sisu/CHANGELOG_v6
@@ -28,6 +28,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.2.6.orig.tar.xz
   sisu_6.2.6.orig.tar.xz
   sisu_6.2.6-1.dsc
 
+* html navigation, enable turn off (nav buttons on remaining html segments)
+
 * (for html) set default to navigation bar off
 
 * xml xhtml outputs, &amp; issues
diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb
index 16120d88..aa002ec7 100644
--- a/lib/sisu/v5/html_format.rb
+++ b/lib/sisu/v5/html_format.rb
@@ -310,6 +310,15 @@ WOK
       end
     end
     def concordance_navigation_band
+      up_button=if @make.build.html_navigation?
+        %{</td>
+<td width="5%" align="right">
+  &nbsp;<a href="toc.html" target="_top" alt="-&gt;">
+      #{png_nav.toc}
+    </a>&nbsp;
+}
+      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">
-  &nbsp;<a href="toc.html" target="_top" alt="-&gt;">
-      #{png_nav.toc}
-    </a>&nbsp;
+#{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="-&gt;">
+      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="-&gt;">
+          #{png_nav.nxt}</a>}
+        elsif @md.firstseg =~/\S+/
+          firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="-&gt;">
         #{png_nav.nxt}</a>}
-      elsif @md.firstseg =~/\S+/
-        firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="-&gt;">
-      #{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
   &nbsp;#{firstseg}&nbsp;
 #{@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/html_format.rb b/lib/sisu/v6/html_format.rb
index febfc30e..acc62a74 100644
--- a/lib/sisu/v6/html_format.rb
+++ b/lib/sisu/v6/html_format.rb
@@ -310,6 +310,15 @@ WOK
       end
     end
     def concordance_navigation_band
+      up_button=if @make.build.html_navigation?
+        %{</td>
+<td width="5%" align="right">
+  &nbsp;<a href="toc.html" target="_top" alt="-&gt;">
+      #{png_nav.toc}
+    </a>&nbsp;
+}
+      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">
-  &nbsp;<a href="toc.html" target="_top" alt="-&gt;">
-      #{png_nav.toc}
-    </a>&nbsp;
+#{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="-&gt;">
+      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="-&gt;">
+          #{png_nav.nxt}</a>}
+        elsif @md.firstseg =~/\S+/
+          firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="-&gt;">
         #{png_nav.nxt}</a>}
-      elsif @md.firstseg =~/\S+/
-        firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="-&gt;">
-      #{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
   &nbsp;#{firstseg}&nbsp;
 #{@vz.table_close}
 <p />}
+      else ''
+      end
     end
     def manifest_link(text)
 #     @file=SiSU_Env::FileOp.new(@md) if @md
-- 
cgit v1.2.3


From cf1ec2346fbe9d0c54d887eb7cd79588dcf3606b Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Fri, 5 Sep 2014 23:17:24 -0400
Subject: v5 v6: ao_numbering, provide more information on duplicate numbering
 before stop

---
 data/doc/sisu/CHANGELOG_v5  |  2 ++
 data/doc/sisu/CHANGELOG_v6  |  2 ++
 lib/sisu/v5/ao_numbering.rb | 23 +++++++++++++----------
 lib/sisu/v6/ao_numbering.rb | 23 +++++++++++++----------
 4 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index aed37d24..90d95339 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -38,6 +38,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.6.5.orig.tar.xz
   sisu_5.6.5.orig.tar.xz
   sisu_5.6.5-1.dsc
 
+* ao_numbering, provide more information on duplicate numbering before stop
+
 * html navigation, enable turn off (nav buttons on remaining html segments)
 
 * (for html) set default to navigation bar off
diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6
index 2e6a6f9b..772c2df9 100644
--- a/data/doc/sisu/CHANGELOG_v6
+++ b/data/doc/sisu/CHANGELOG_v6
@@ -28,6 +28,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.2.6.orig.tar.xz
   sisu_6.2.6.orig.tar.xz
   sisu_6.2.6-1.dsc
 
+* ao_numbering, provide more information on duplicate numbering before stop
+
 * html navigation, enable turn off (nav buttons on remaining html segments)
 
 * (for html) set default to navigation bar off
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/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
-- 
cgit v1.2.3


From 98066f7dbc056c75b808b49f8406b7ac21118111 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Fri, 5 Sep 2014 23:20:13 -0400
Subject: v5 v6: ao_doc_str, if faulty document structure, stop; if --no-stop
 option, skip

---
 data/doc/sisu/CHANGELOG_v5 |  3 +++
 data/doc/sisu/CHANGELOG_v6 |  3 +++
 lib/sisu/v5/ao_doc_str.rb  | 32 +++++++++++++++++++++++++-------
 lib/sisu/v6/ao_doc_str.rb  | 32 +++++++++++++++++++++++++-------
 4 files changed, 56 insertions(+), 14 deletions(-)

diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index 90d95339..1fd44736 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -38,6 +38,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.6.5.orig.tar.xz
   sisu_5.6.5.orig.tar.xz
   sisu_5.6.5-1.dsc
 
+* ao_doc_str, if faulty document structure, stop; if --no-stop option, skip
+  processing document
+
 * ao_numbering, provide more information on duplicate numbering before stop
 
 * html navigation, enable turn off (nav buttons on remaining html segments)
diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6
index 772c2df9..a6ef4d23 100644
--- a/data/doc/sisu/CHANGELOG_v6
+++ b/data/doc/sisu/CHANGELOG_v6
@@ -28,6 +28,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.2.6.orig.tar.xz
   sisu_6.2.6.orig.tar.xz
   sisu_6.2.6-1.dsc
 
+* ao_doc_str, if faulty document structure, stop; if --no-stop option, skip
+  processing document
+
 * ao_numbering, provide more information on duplicate numbering before stop
 
 * html navigation, enable turn off (nav buttons on remaining html segments)
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/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
-- 
cgit v1.2.3