d: xmls, reorganize, introduce new file
authorRalph Amissah <ralph@amissah.com>
Sun, 23 Nov 2014 06:01:27 +0000 (01:01 -0500)
committerRalph Amissah <ralph@amissah.com>
Mon, 8 Dec 2014 05:18:16 +0000 (00:18 -0500)
data/doc/sisu/CHANGELOG_v6
lib/sisu/develop/xhtml.rb
lib/sisu/develop/xhtml_table.rb
lib/sisu/develop/xml_dom.rb
lib/sisu/develop/xml_odf_odt.rb
lib/sisu/develop/xml_odf_odt_format.rb
lib/sisu/develop/xml_persist.rb [new file with mode: 0644]
lib/sisu/develop/xml_sax.rb

index 5eaa8f1af9964f3151bccef4728b4ea8b2a293bf..bc4f2fa74c2d554316350841fddc8bb0b9fe77ac 100644 (file)
@@ -75,6 +75,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.4.0.orig.tar.xz
 
   * epub, reorganize, introduce new file
 
+  * xmls, reorganize, introduce new file
+
 ** SiSU "UnFrozen" - prior to end of Debian Freeze
   (upstream bugfix 6.3.2 (5.7.2) intended for Jessie (packaged for Debian as
   5.7.1-2) was not accepted)
index bb5db51ba11d571a27d7c23b0350a04843469894..9e06d7b268dae4fefa6b56dc5f656570c3947b47 100644 (file)
@@ -63,10 +63,11 @@ module SiSU_XHTML
     include SiSU_XML_Munge
   require_relative 'xml_format'                         # xml_format.rb
     include SiSU_XML_Format
+  require_relative 'xml_persist'                        # xml_persist.rb
   require_relative 'rexml'                              # rexml.rb
     include SiSU_Rexml
   require_relative 'shared_metadata'                    # shared_metadata.rb
-  @@alt_id_count,@@tablehead,@@number_of_cols=0,0,0
+  @@alt_id_count=0
   @@tablefoot=''
   class Source
     def initialize(opt)
@@ -144,12 +145,12 @@ module SiSU_XHTML
       require_relative 'txt_shared'                     # txt_shared.rb
         include SiSU_TextUtils
       require_relative 'css'                            # css.rb
-      @@xml={ body: [], sisu: [], open: [], close: [], head: [] }
       def initialize(particulars)
         @env,@md,@ao_array=particulars.env,particulars.md,particulars.ao_array
         @tab="\t"
         @trans=SiSU_XML_Munge::Trans.new(@md)
         @sys=SiSU_Env::SystemCall.new
+        @per=SiSU_XML_Persist::Persist.new
       end
       def songsheet
         pre
@@ -202,7 +203,7 @@ WOK
       end
       def xml_head
         metadata=SiSU_Metadata::Summary.new(@md).xhtml_scroll.metadata
-        @@xml[:head] << metadata
+        @per.head << metadata
       end
       def name_tags(dob)
         tags=''
@@ -228,15 +229,15 @@ WOK
             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
+          @per.body << if defined? dob.ocn
             %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
           else                        "#{Ax[:tab]*0}<object>"
           end
-          @@xml[:body] << %{#{Ax[:tab]*1}<text class="#{type}">#{named}\n#{Ax[:tab]*2}#{wrapped}\n#{Ax[:tab]*1}</text>} unless lv  # main text, contents, body KEEP
-          @@xml[:body] << %{#{Ax[:tab]*1}<text class="h#{lv}">#{named}\n#{Ax[:tab]*2}#{wrapped}\n#{Ax[:tab]*1}</text>} if lv # main text, contents, body KEEP
-          @@xml[:body] << @endnotes.compact.join if @endnotes.length > 0 # main text, endnotes KEEP
-          @@xml[:body] << "#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>" if defined? dob.ocn
-          @@xml[:body] << "#{Ax[:tab]*0}</object>"
+          @per.body << %{#{Ax[:tab]*1}<text class="#{type}">#{named}\n#{Ax[:tab]*2}#{wrapped}\n#{Ax[:tab]*1}</text>} unless lv  # main text, contents, body KEEP
+          @per.body << %{#{Ax[:tab]*1}<text class="h#{lv}">#{named}\n#{Ax[:tab]*2}#{wrapped}\n#{Ax[:tab]*1}</text>} if lv # main text, contents, body KEEP
+          @per.body << @endnotes.compact.join if @endnotes.length > 0 # main text, endnotes KEEP
+          @per.body << "#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>" if defined? dob.ocn
+          @per.body << "#{Ax[:tab]*0}</object>"
           @endnotes=[]
         end
       end
@@ -246,12 +247,12 @@ WOK
         dob.obj=dob.obj.strip.
           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
-        @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
-        @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
-        @@xml[:body] << %{#{Ax[:tab]*1}<text class="block">#{named}#{Ax[:tab]*1}}
-        @@xml[:body] << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
-        @@xml[:body] << %{#{Ax[:tab]*1}</text>}
-        @@xml[:body] << "#{Ax[:tab]*0}</object>"
+        @per.body << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
+        @per.body << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
+        @per.body << %{#{Ax[:tab]*1}<text class="block">#{named}#{Ax[:tab]*1}}
+        @per.body << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
+        @per.body << %{#{Ax[:tab]*1}</text>}
+        @per.body << "#{Ax[:tab]*0}</object>"
       end
       def group_structure(dob)
         named=name_tags(dob)
@@ -259,42 +260,42 @@ WOK
         dob.obj=dob.obj.strip.
           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
-        @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
-        @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
-        @@xml[:body] << %{#{Ax[:tab]*1}<text class="group">#{named}#{Ax[:tab]*1}}
-        @@xml[:body] << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
-        @@xml[:body] << %{#{Ax[:tab]*1}</text>}
-        @@xml[:body] << "#{Ax[:tab]*0}</object>"
+        @per.body << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
+        @per.body << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
+        @per.body << %{#{Ax[:tab]*1}<text class="group">#{named}#{Ax[:tab]*1}}
+        @per.body << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
+        @per.body << %{#{Ax[:tab]*1}</text>}
+        @per.body << "#{Ax[:tab]*0}</object>"
       end
       def poem_structure(dob)
         named=name_tags(dob)
         dob=@trans.markup_group(dob)
         dob.obj=dob.obj.strip
-        @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
-        @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
-        @@xml[:body] << %{#{Ax[:tab]*1}<text class="verse">#{named}#{Ax[:tab]*1}}
-        @@xml[:body] << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
-        @@xml[:body] << %{#{Ax[:tab]*1}</text>}
-        @@xml[:body] << "#{Ax[:tab]*0}</object>"
+        @per.body << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
+        @per.body << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
+        @per.body << %{#{Ax[:tab]*1}<text class="verse">#{named}#{Ax[:tab]*1}}
+        @per.body << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
+        @per.body << %{#{Ax[:tab]*1}</text>}
+        @per.body << "#{Ax[:tab]*0}</object>"
       end
       def code_structure(dob)
         named=name_tags(dob)
         dob=@trans.markup_group(dob)
         dob.obj=dob.obj.gsub(/\s\s/,'&#160;&#160;').strip
-        @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
-        @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
-        @@xml[:body] << %{#{Ax[:tab]*1}<text class="code">#{named}#{Ax[:tab]*1}}
-        @@xml[:body] << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
-        @@xml[:body] << %{#{Ax[:tab]*1}</text>}
-        @@xml[:body] << "#{Ax[:tab]*0}</object>"
+        @per.body << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
+        @per.body << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
+        @per.body << %{#{Ax[:tab]*1}<text class="code">#{named}#{Ax[:tab]*1}}
+        @per.body << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
+        @per.body << %{#{Ax[:tab]*1}</text>}
+        @per.body << "#{Ax[:tab]*0}</object>"
       end
       def table_structure(dob)
         named=name_tags(dob)
         table=SiSU_XHTML_Shared::TableXHTML.new(dob)
-        @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
-        @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
-        @@xml[:body] << %{#{Ax[:tab]*2}#{named}#{table.table.obj}}
-        @@xml[:body] << "#{Ax[:tab]*0}</object>"
+        @per.body << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
+        @per.body << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
+        @per.body << %{#{Ax[:tab]*2}#{named}#{table.table.obj}}
+        @per.body << "#{Ax[:tab]*0}</object>"
       end
       def markup(data)
         @endnotes=[]
@@ -370,39 +371,38 @@ WOK
         end
         6.downto(4) do |x|
           y=x - 1; v=x - 3
-          @@xml[:body] << "#{Ax[:tab]*5}</content>\n#{Ax[:tab]*y}</contents#{v}>" if @level[x]==true
+          @per.body << "#{Ax[:tab]*5}</content>\n#{Ax[:tab]*y}</contents#{v}>" if @level[x]==true
         end
         3.downto(1) do |x|
           y=x - 1
-          @@xml[:body] << "#{Ax[:tab]*y}</heading#{x}>" if @level[x]==true
+          @per.body << "#{Ax[:tab]*y}</heading#{x}>" if @level[x]==true
         end
       end
       def pre
         rdf=SiSU_XML_Tags::RDF.new(@md)
-        @@xml[:head],@@xml[:body]=[],[]
+        @per.head,@per.body=[],[]
         stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xhtml').stylesheet
         encoding=(@sys.locale =~/utf-?8/i) \
         ? '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
         : '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'
-        @@xml[:open] =<<WOK
+        @per.open =<<WOK
 #{encoding}
 #{stylesheet.css_head_xml}
 #{rdf.comment_xml}
 <document>
 WOK
-        @@xml[:head] << %{<head>\n\t<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />}
-        @@xml[:body] << '<body>'
+        @per.head << %{<head>\n\t<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />}
+        @per.body << '<body>'
       end
       def post
-        @@xml[:head] << '</head>'
-        @@xml[:body] << '</body>'
-        @@xml[:close] = '</document>'
+        @per.head << '</head>'
+        @per.body << '</body>'
+        @per.close = '</document>'
       end
       def publish
         content=[]
-        content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata]
-        content << @@xml[:owner_details] if @md.stmp =~/\w\w/
-        content << @@xml[:tail] << @@xml[:close]
+        content << @per.open << @per.head << @per.body << @per.metadata
+        content << @per.tail << @per.close
         content=content.flatten.compact
         Output.new(content,@md).xhtml
         @@xml={}
index df5a2822ee5a6c4618da37b608758c6426a54ed2..9c3618c543c0b600a6e4dc0efe0d8928f31fda05 100644 (file)
@@ -58,7 +58,6 @@ module SiSU_XHTML_Table
   require_relative 'xhtml_parts'                         # xhtml_parts.rb
   class TableXHTML
     include SiSU_Parts_XHTML
-    @@tablehead=0
     @@tablefoot=[] #watch
     def initialize(table)
       @table_obj=table
index 3664820d24b8d962a3cf8badb5f4bd16afd8a724..b3d3adde316c9e71a43115cbec10923ac06d2c88 100644 (file)
@@ -64,10 +64,11 @@ module SiSU_XML_DOM
     include SiSU_XML_Munge
   require_relative 'xml_format'                         # xml_format.rb
     include SiSU_XML_Format
+  require_relative 'xml_persist'                        # xml_persist.rb
   require_relative 'rexml'                              # rexml.rb
     include SiSU_Rexml
   require_relative 'shared_metadata'                    # shared_metadata.rb
-  @@alt_id_count,@@tablehead,@@number_of_cols=0,0,0
+  @@alt_id_count=0
   @@tablefoot=''
   class Source
     def initialize(opt)
@@ -158,12 +159,12 @@ module SiSU_XML_DOM
       require_relative 'txt_shared'                     # txt_shared.rb
         include SiSU_TextUtils
       require_relative 'xhtml_shared'                   # decide use, whether xml rather than xhtml
-      @@xml={ body: [], open: [], close: [], head: [], sc: [] }
       def initialize(particulars)
         @env,             @md,           @ao_arr=
           particulars.env,particulars.md,particulars.ao_array
         @trans=SiSU_XML_Munge::Trans.new(@md)
         @sys=SiSU_Env::SystemCall.new
+        @per=SiSU_XML_Persist::Persist.new
       end
       def songsheet
         pre
@@ -182,7 +183,7 @@ module SiSU_XML_DOM
       end
       def xml_head
         metadata=SiSU_Metadata::Summary.new(@md).xml_dom.metadata
-        @@xml[:head] << metadata
+        @per.head << metadata
       end
       def xml_sc(md='')
         sc=if @md.sc_info
@@ -204,7 +205,7 @@ module SiSU_XML_DOM
 WOK
         else ''
         end
-        @@xml[:sc]=sc
+        @per.sc=sc
       end
       def xml_element(dob,xml_el='',xml_content='',type='norm')
         n=n1=n2=n3=0
@@ -221,7 +222,7 @@ WOK
         else ''
         end
         xml_el ||=''
-        @@xml[:body] <<<<WOK
+        @per.body <<<<WOK
 #{Ax[:tab]*n}#{xml_el}
 #{Ax[:tab]*n1}<heading>
 #{Ax[:tab]*n2}<object id="#{dob.ocn}">
@@ -262,26 +263,26 @@ WOK
             if @cont[1] \
             or @cont[2] \
             or @cont[3]
-              @@xml[:body] << "#{Ax[:tab]*5}</content>"
+              @per.body << "#{Ax[:tab]*5}</content>"
             end
             @cont[1]=false if @cont[1]
             @cont[2]=false if @cont[2]
             @cont[3]=false if @cont[3]
             ####### attempt to close contents
             if @copen[4] # 4~
-              [4,3,2,1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+              [4,3,2,1].each { |v| @per.body << "#{Ax[:tab]*n}</contents#{v}>" }
               @copen[1]=@copen[2]=@copen[3]=@copen[4]=false
             elsif @copen[3] # 3~
-              [3,2,1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+              [3,2,1].each { |v| @per.body << "#{Ax[:tab]*n}</contents#{v}>" }
               @copen[1]=@copen[2]=@copen[3]=false
             elsif @copen[2] # 2~
-              [2,1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+              [2,1].each { |v| @per.body << "#{Ax[:tab]*n}</contents#{v}>" }
               @copen[1]=@copen[2]=@copen[3]=false
             elsif @copen[1] # 1~
-              [1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+              [1].each { |v| @per.body << "#{Ax[:tab]*n}</contents#{v}>" }
               @copen[1]=@copen[2]=@copen[3]=false
             end
-            @@xml[:body] << "#{Ax[:tab]*y}</heading#{x}>" if @level[x]
+            @per.body << "#{Ax[:tab]*y}</heading#{x}>" if @level[x]
             @level[x]=false
           end
         when 4..7
@@ -295,29 +296,29 @@ WOK
           xml_content="\n#{Ax[:tab]*5}<content>"
           case lv
           when 4
-            @@xml[:body] << "#{Ax[:tab]*5}</content>" if @cont[1]
+            @per.body << "#{Ax[:tab]*5}</content>" if @cont[1]
             if @copen[4]==true # 4~
-              [4,3,2,1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+              [4,3,2,1].each { |v| @per.body << "#{Ax[:tab]*n}</contents#{v}>" }
             elsif @copen[3]==true # 3~
-              [3,2,1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+              [3,2,1].each { |v| @per.body << "#{Ax[:tab]*n}</contents#{v}>" }
             elsif @copen[2]==true # 2~
-              [2,1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+              [2,1].each { |v| @per.body << "#{Ax[:tab]*n}</contents#{v}>" }
             elsif @copen[1]==true # 1~
-              [1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+              [1].each { |v| @per.body << "#{Ax[:tab]*n}</contents#{v}>" }
             end
             @cont[1]=true
           when 5
             if @cont[3] \
             or @cont[2] \
             or @cont[1]
-              @@xml[:body] << "#{Ax[:tab]*5}</content>"
+              @per.body << "#{Ax[:tab]*5}</content>"
             end
             if @copen[4]==true  #4~
-              [4,3,2].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+              [4,3,2].each { |v| @per.body << "#{Ax[:tab]*n}</contents#{v}>" }
             elsif @copen[3]==true  #3~
-              [3,2].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+              [3,2].each { |v| @per.body << "#{Ax[:tab]*n}</contents#{v}>" }
             elsif @copen[2]==true #2~
-              [2].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+              [2].each { |v| @per.body << "#{Ax[:tab]*n}</contents#{v}>" }
             end
             @cont[2]=true
           when 6
@@ -325,12 +326,12 @@ WOK
             or @cont[3] \
             or @cont[2] \
             or @cont[1]
-              @@xml[:body] << "#{Ax[:tab]*5}</content>"
+              @per.body << "#{Ax[:tab]*5}</content>"
             end
             if @copen[4] #4~
-              [4,3].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+              [4,3].each { |v| @per.body << "#{Ax[:tab]*n}</contents#{v}>" }
             elsif @copen[3] #3~
-              [3].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+              [3].each { |v| @per.body << "#{Ax[:tab]*n}</contents#{v}>" }
             end
             @cont[3]=true
           when 7
@@ -338,10 +339,10 @@ WOK
             or @cont[3] \
             or @cont[2] \
             or @cont[1]
-              @@xml[:body] << "#{Ax[:tab]*5}</content>"
+              @per.body << "#{Ax[:tab]*5}</content>"
             end
             if @copen[4] #4~
-              [4].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+              [4].each { |v| @per.body << "#{Ax[:tab]*n}</contents#{v}>" }
             end
             @cont[4]=true
           end
@@ -357,15 +358,15 @@ WOK
         if defined? dob.obj # main text, contents, body KEEP
           if defined? dob.ocn \
           and dob.ocn
-            @@xml[:body] << %{#{Ax[:tab]*6}<object id="#{dob.ocn}">}
-            @@xml[:body] << %{#{Ax[:tab]*7}<ocn>#{dob.ocn}</ocn>} if defined? dob.ocn
+            @per.body << %{#{Ax[:tab]*6}<object id="#{dob.ocn}">}
+            @per.body << %{#{Ax[:tab]*7}<ocn>#{dob.ocn}</ocn>} if defined? dob.ocn
           end
-          #@@xml[:body] << %{#{Ax[:tab]*7}<text class="#{type}">#{dob.obj}</text>}
-          #@@xml[:body] << %{#{Ax[:tab]*7}<text class="#{dob.is}">#{Ax[:tab]*1}}
-          @@xml[:body] << %{#{Ax[:tab]*7}<text class="#{type}">#{Ax[:tab]*1}}
-          @@xml[:body] << %{#{Ax[:tab]*8}#{dob.obj}#{Ax[:tab]*1}}
-          @@xml[:body] << %{#{Ax[:tab]*7}</text>}
-          @@xml[:body] << %{#{Ax[:tab]*6}</object>}
+          #@per.body << %{#{Ax[:tab]*7}<text class="#{type}">#{dob.obj}</text>}
+          #@per.body << %{#{Ax[:tab]*7}<text class="#{dob.is}">#{Ax[:tab]*1}}
+          @per.body << %{#{Ax[:tab]*7}<text class="#{type}">#{Ax[:tab]*1}}
+          @per.body << %{#{Ax[:tab]*8}#{dob.obj}#{Ax[:tab]*1}}
+          @per.body << %{#{Ax[:tab]*7}</text>}
+          @per.body << %{#{Ax[:tab]*6}</object>}
         end
       end
       def block_structure(dob)
@@ -523,16 +524,16 @@ WOK
           y=x - 1; v=x - 3
           if @level[x]==true #2004w36 bug fix? watch/test previous logic broke on free.for.all @coontent_flag introduced
             if @content_flag==true
-              @@xml[:body] << "#{Ax[:tab]*5}</content>\n#{Ax[:tab]*y}</contents#{v}>"
+              @per.body << "#{Ax[:tab]*5}</content>\n#{Ax[:tab]*y}</contents#{v}>"
               @content_flag=false
             else
-              @@xml[:body] << "\n#{Ax[:tab]*y}</contents#{v}>"
+              @per.body << "\n#{Ax[:tab]*y}</contents#{v}>"
             end
           end
         end
         3.downto(1) do |x|
           y=x - 1
-          @@xml[:body] << "#{Ax[:tab]*y}</heading#{x}>" if @level[x]==true
+          @per.body << "#{Ax[:tab]*y}</heading#{x}>" if @level[x]==true
         end
       end
       def pre
@@ -541,29 +542,28 @@ WOK
         encoding=if @sys.locale =~/utf-?8/i then '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
         else                                     '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'
         end
-        @@xml[:open] =<<WOK
+        @per.open =<<WOK
 #{encoding}
 #{stylesheet.css_head_xml}
 #{rdf.comment_xml}
 <document>
 WOK
-        @@xml[:head] << '<head>'
-        @@xml[:body] << '<body>'
+        @per.head << '<head>'
+        @per.body << '<body>'
       end
       def post
-        @@xml[:head] << @@xml[:sc]
-        @@xml[:head] << '</head>'
-        @@xml[:body] << '</body>'
-        @@xml[:close] = '</document>'
+        @per.head << @per.sc
+        @per.head << '</head>'
+        @per.body << '</body>'
+        @per.close << '</document>'
       end
       def publish
         content=[]
-        content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata]
-        content << @@xml[:owner_details] if @md.stmp =~/\w\w/
-        content << @@xml[:tail] << @@xml[:close]
+        content << @per.open << @per.head << @per.body # << @per.metadata
+        content << @per.tail << @per.close
         content=content.flatten.compact
         Output.new(content,@md).xml
-        @@xml[:head],@@xml[:body],@@xml[:tail]=[],[],[] # check whether should be nil
+        @per.head,@per.body,@per.tail=[],[],[] # check whether should be nil
       end
     end
     class Output
index de1dde96fc61b42b37d02d5ad35259ae487cfcd8..16a77e7a0cdd0945b73b30ba10576cdf7b857cd1 100644 (file)
@@ -67,7 +67,8 @@ module SiSU_XML_ODF_ODT
   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
+  require_relative 'xml_persist'                        # xml_persist.rb
+  @@alt_id_count,@@alt_id_count=0,0
   class Source
     begin
       require 'zlib'
@@ -128,7 +129,6 @@ module SiSU_XML_ODF_ODT
       require_relative 'txt_shared'                     # txt_shared.rb
       include SiSU_Parts_XML
       @@img_count=0
-      @@odf={ body: [], head: [], toc: [],  metadata: [], tail: [], book_idx: [], endnotes: [] }
       @@docstart=true
       @@fns=nil
       def initialize(particulars)
@@ -140,6 +140,7 @@ module SiSU_XML_ODF_ODT
       end
       def songsheet
         begin
+          @per=SiSU_XML_Persist::Persist.new
           pre
           @data=markup(@ao_array)
           publish
@@ -187,18 +188,18 @@ module SiSU_XML_ODF_ODT
           end
           idx_arr << x.strip if x.is_a?(String)
         end
-        @@odf[:book_idx]=idx_arr.join
+        @per.book_idx=idx_arr.join
       end
       end
       def odf_metadata
-        @@odf[:metadata]=SiSU_Metadata::Summary.new(@md).
+        @per.metadata=SiSU_Metadata::Summary.new(@md).
           odf.metadata
       end
       def odf_tail
         manifest="#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}"
-        @@odf[:tail] << %{<text:p text:style-name="P_normal">Available document outputs: <br /> &lt;<text:a xl:type="simple" xl:href="#{manifest}">#{manifest}</text:a>&gt;</text:p>}
-        @@odf[:tail] << %{\n<text:p text:style-name="P_normal">SiSU: &lt;<text:a xl:type="simple" xl:href="http://www.jus.uio.no/lm">www.jus.uio.no/sisu</text:a>&gt; and &lt;<text:a xl:type="simple" xl:href="http://www.sisudoc.org">www.sisudoc.org</text:a>&gt;</text:p>}
-        @@odf[:tail] << "\n</office:text></office:body></office:document-content>"
+        @per.tail << %{<text:p text:style-name="P_normal">Available document outputs: <br /> &lt;<text:a xl:type="simple" xl:href="#{manifest}">#{manifest}</text:a>&gt;</text:p>}
+        @per.tail << %{\n<text:p text:style-name="P_normal">SiSU: &lt;<text:a xl:type="simple" xl:href="http://www.jus.uio.no/lm">www.jus.uio.no/sisu</text:a>&gt; and &lt;<text:a xl:type="simple" xl:href="http://www.sisudoc.org">www.sisudoc.org</text:a>&gt;</text:p>}
+        @per.tail << "\n</office:text></office:body></office:document-content>"
       end
       def set_bookmark_tag(dob)
         SiSU_XML_ODF_ODT_Format::Tags.new.set_bookmark_tag(dob)
@@ -616,26 +617,26 @@ module SiSU_XML_ODF_ODT
           end
         end
         if dob.is==:heading
-          @@odf[:body] << heading(dob,p_num).obj << break_line*2
+          @per.body << heading(dob,p_num).obj << break_line*2
           if SiSU_Env::ProcessingSettings.new(md).build.toc?
             if dob.lv =~/[A-D1]/i
-              @@odf[:toc] << toc(dob,p_num).obj
+              @per.toc << toc(dob,p_num).obj
             end
           end
         elsif dob.is ==:verse
-          @@odf[:body] << poem(dob,p_num).obj << break_line*2
+          @per.body << poem(dob,p_num).obj << break_line*2
         elsif dob.is==:group
-          @@odf[:body] << group(dob,p_num).obj << break_line*2
+          @per.body << group(dob,p_num).obj << break_line*2
         elsif dob.is==:block
-          @@odf[:body] << block(dob,p_num).obj << break_line*2
+          @per.body << block(dob,p_num).obj << break_line*2
         elsif dob.is==:code
-          @@odf[:body] << code(dob,p_num).obj << break_line*2
+          @per.body << code(dob,p_num).obj << break_line*2
         elsif dob.is==:table #elsif dob.obj =~ /<!Th?ยก/u
-          @@odf[:body] << table(dob,p_num).obj << break_line*2
+          @per.body << table(dob,p_num).obj << break_line*2
         elsif dob.is==:break
-          @@odf[:body] << obj_break(dob).obj << break_line*2
+          @per.body << obj_break(dob).obj << break_line*2
         else
-          @@odf[:body] << normal(dob,p_num).obj << break_line*2 # main text, contents, body KEEP
+          @per.body << normal(dob,p_num).obj << break_line*2 # main text, contents, body KEEP
         end
         @@endnotes_para=[]
       end
@@ -803,20 +804,20 @@ WOK
 WOK
         x=x.strip
         x=x.gsub(/\n+/m,'') unless @md.opt.act[:maintenance][:set]==:on
-        @@odf[:head] << x
+        @per.head << x
       end
       def publish
         content=[]
         br_pg='<text:p text:style-name="P_normal_page_new"> </text:p>'
         content <<
-          @@odf[:head] <<
-          @@odf[:toc] <<
+          @per.head <<
+          @per.toc <<
           br_pg <<
-          @@odf[:body] <<
-          @@odf[:book_idx] <<
+          @per.body <<
+          @per.book_idx <<
           br_pg <<
-          @@odf[:metadata] <<
-          @@odf[:tail]
+          @per.metadata <<
+          @per.tail
         SiSU_XML_ODF_ODT::Source::Output.new(content,@md,@env).odf
         @@odf={ head: [], toc: [], body: [], tail: [], book_idx: [], metadata: [] }
       end
index 8bd83e091c29bd7fc27dcb45fcb17e9b9e104d0b..efe5e733953068c017b6926c1031d94bda424604 100644 (file)
@@ -162,7 +162,7 @@ module SiSU_XML_ODF_ODT_Format
     end
   end
   class Table
-    @@tablehead,@@table_counter=0,0 #reinitialise on new file
+    @@table_counter=0
     @@tablefoot=[] #watch
     @@fns=''
     def initialize(md,dob,p_num)
diff --git a/lib/sisu/develop/xml_persist.rb b/lib/sisu/develop/xml_persist.rb
new file mode 100644 (file)
index 0000000..6fb52eb
--- /dev/null
@@ -0,0 +1,126 @@
+# encoding: utf-8
+=begin
+
+* Name: SiSU
+
+** Description: documents, structuring, processing, publishing, search
+*** html segment generation, processing
+
+** Author: Ralph Amissah
+  <ralph@amissah.com>
+  <ralph.amissah@gmail.com>
+
+** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+  2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
+  All Rights Reserved.
+
+** License: GPL 3 or later:
+
+  SiSU, a framework for document structuring, publishing and search
+
+  Copyright (C) Ralph Amissah
+
+  This program is free software: you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published by the Free
+  Software Foundation, either version 3 of the License, or (at your option)
+  any later version.
+
+  This program is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+  more details.
+
+  You should have received a copy of the GNU General Public License along with
+  this program. If not, see <http://www.gnu.org/licenses/>.
+
+  If you have Internet connection, the latest version of the GPL should be
+  available at these locations:
+  <http://www.fsf.org/licensing/licenses/gpl.html>
+  <http://www.gnu.org/licenses/gpl.html>
+
+  <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+** SiSU uses:
+  * Standard SiSU markup syntax,
+  * Standard SiSU meta-markup syntax, and the
+  * Standard SiSU object citation numbering and system
+
+** Hompages:
+  <http://www.jus.uio.no/sisu>
+  <http://www.sisudoc.org>
+
+** Git
+  <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
+  <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/develop/xml_persist.rb;hb=HEAD>
+
+=end
+module SiSU_XML_Persist
+  class Persist
+    @@persist=nil
+    attr_accessor :head,:toc,:body,:tail,:open,:close,:sc,:endnotes,:book_idx,:metadata
+    #attr_accessor :head,:body,:tail,:open,:close,:sc
+#@@odf={ body: [], head: [], toc: [],  metadata: [], tail: [], book_idx: [], endnotes: [] }
+    def initialize(args=nil)
+      @@persist=args=(args ? args : (@@persist || persist_init_hash_values))
+      @head=args[:head]
+      @toc=args[:toc]
+      @body=args[:body]
+      @tail=args[:tail]
+      @open=args[:open]
+      @close=args[:close]
+      @sc=args[:sc]
+      @endnotes=args[:endnotes]
+      @book_idx=args[:book_idx]
+      @metadata=args[:metadata]
+    end
+    def head
+      @head
+    end
+    def toc
+      @toc
+    end
+    def body
+      @body
+    end
+    def tail
+      @tail
+    end
+    def open
+      @open
+    end
+    def close
+      @close
+    end
+    def sc
+      @sc
+    end
+    def endnotes
+      @endnotes
+    end
+    def book_idx
+      @book_idx
+    end
+    def metadata
+      @metadata
+    end
+    def persist_init_hash_values
+      {
+        head: [],
+        toc: [],
+        body: [],
+        tail: [],
+        open: [],
+        close: [],
+        sc: [],
+        endnotes: [],
+        book_idx: [],
+        metadata: [],
+      }
+    end
+    def persist_init
+      @@persist=nil
+      Persist.new(persist_init_hash_values)
+    end
+  end
+end
+__END__
index 3a193a6a7c2a6a5bb705c1a45fc7fbb4e37240e7..81e2423d979a1af60023e8a834199fbd7777450b 100644 (file)
@@ -63,10 +63,11 @@ module SiSU_XML_SAX
     include SiSU_XML_Munge
   require_relative 'xml_format'                         # xml_format.rb
     include SiSU_XML_Format
+  require_relative 'xml_persist'                        # xml_persist.rb
   require_relative 'rexml'                              # rexml.rb
     include SiSU_Rexml
   require_relative 'shared_metadata'                    # shared_metadata.rb
-  @@alt_id_count,@@tablehead,@@number_of_cols=0,0,0
+  @@alt_id_count=0
   @@tablefoot=''
   class Source
     def initialize(opt)
@@ -159,12 +160,12 @@ module SiSU_XML_SAX
         include SiSU_TextUtils
       require_relative 'css'                            # css.rb
       require_relative 'xhtml_shared'                   # decide use, whether xml rather than xhtml
-      @@xml={ body: [], open: [], close: [], head: [] }
       def initialize(particulars)
         @env,             @md,           @ao_arr=
           particulars.env,particulars.md,particulars.ao_array
         @trans=SiSU_XML_Munge::Trans.new(@md)
         @sys=SiSU_Env::SystemCall.new
+        @per=SiSU_XML_Persist::Persist.new
       end
       def songsheet
         pre
@@ -219,7 +220,7 @@ WOK
       end
       def xml_head
         metadata=SiSU_Metadata::Summary.new(@md).xml_sax.metadata
-        @@xml[:head] << metadata
+        @per.head << metadata
       end
       def xml_sc(md='')
         sc=if @md.sc_info
@@ -241,7 +242,7 @@ WOK
 WOK
         else ''
         end
-        @@xml[:sc]=sc
+        @per.sc=sc
       end
       def xml_structure(dob,type='norm')
         if dob.is==:heading
@@ -257,16 +258,16 @@ WOK
         util=SiSU_TextUtils::Wrap.new(dob.obj,70)
         wrapped=util.line_wrap
         #end
-        @@xml[:body] << if defined? dob.ocn; %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
+        @per.body << if defined? dob.ocn; %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
         else                              "#{Ax[:tab]*0}<object>"
         end
-        @@xml[:body] << "#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>" if defined? dob.ocn
-        @@xml[:body] << if lv; %{#{Ax[:tab]*1}<text class="h#{lv}">\n#{Ax[:tab]*2}#{wrapped}\n#{Ax[:tab]*1}</text>}
+        @per.body << "#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>" if defined? dob.ocn
+        @per.body << if lv; %{#{Ax[:tab]*1}<text class="h#{lv}">\n#{Ax[:tab]*2}#{wrapped}\n#{Ax[:tab]*1}</text>}
         else                   %{#{Ax[:tab]*1}<text class="#{type}">\n#{Ax[:tab]*2}#{wrapped}\n#{Ax[:tab]*1}</text>} # main text, contents, body KEEP
         end
-        @@xml[:body] << @endnotes if @endnotes
-        ##@@xml[:body] << "#{Ax[:tab]*1}<text>#{dob[@regx,2]}</text>" if dob[@regx,2] # old unwrapped main text, contents, body KEEP
-        @@xml[:body] << "#{Ax[:tab]*0}</object>"
+        @per.body << @endnotes if @endnotes
+        ##@per.body << "#{Ax[:tab]*1}<text>#{dob[@regx,2]}</text>" if dob[@regx,2] # old unwrapped main text, contents, body KEEP
+        @per.body << "#{Ax[:tab]*0}</object>"
         @endnotes=[]
       end
       def block_structure(dob='')
@@ -275,13 +276,13 @@ WOK
           gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
         dob=@trans.markup_block(dob)
         dob.obj=dob.obj.strip
-        @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
-        @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
-        @@xml[:body] << %{#{Ax[:tab]*1}<text class="block">#{Ax[:tab]*1}}
-        @@xml[:body] << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
-        @@xml[:body] << %{#{Ax[:tab]*1}</text>}
-        @@xml[:body] << "#{Ax[:tab]*0}</object>"
-        @@xml[:body] << @endnotes if @endnotes
+        @per.body << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
+        @per.body << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
+        @per.body << %{#{Ax[:tab]*1}<text class="block">#{Ax[:tab]*1}}
+        @per.body << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
+        @per.body << %{#{Ax[:tab]*1}</text>}
+        @per.body << "#{Ax[:tab]*0}</object>"
+        @per.body << @endnotes if @endnotes
         @endnotes=[]
       end
       def group_structure(dob='')
@@ -290,48 +291,48 @@ WOK
           gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
         dob=@trans.markup_group(dob)
         dob.obj=dob.obj.strip
-        @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
-        @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
-        @@xml[:body] << %{#{Ax[:tab]*1}<text class="group">#{Ax[:tab]*1}}
-        @@xml[:body] << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
-        @@xml[:body] << %{#{Ax[:tab]*1}</text>}
-        @@xml[:body] << "#{Ax[:tab]*0}</object>"
-        @@xml[:body] << @endnotes if @endnotes
+        @per.body << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
+        @per.body << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
+        @per.body << %{#{Ax[:tab]*1}<text class="group">#{Ax[:tab]*1}}
+        @per.body << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
+        @per.body << %{#{Ax[:tab]*1}</text>}
+        @per.body << "#{Ax[:tab]*0}</object>"
+        @per.body << @endnotes if @endnotes
         @endnotes=[]
       end
       def poem_structure(dob='')
         dob=@trans.markup_group(dob)
         #dob.obj.gsub(/\s\s/,'&#160;&#160;')
         dob.obj=dob.obj.strip
-        @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
-        @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
-        @@xml[:body] << %{#{Ax[:tab]*1}<text class="verse">#{Ax[:tab]*1}}
-        @@xml[:body] << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
-        @@xml[:body] << %{#{Ax[:tab]*1}</text>}
-        @@xml[:body] << %{#{Ax[:tab]*0}</object>}
+        @per.body << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
+        @per.body << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
+        @per.body << %{#{Ax[:tab]*1}<text class="verse">#{Ax[:tab]*1}}
+        @per.body << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
+        @per.body << %{#{Ax[:tab]*1}</text>}
+        @per.body << %{#{Ax[:tab]*0}</object>}
       end
       def code_structure(dob='')
         dob=@trans.markup_group(dob)
         dob.obj=dob.obj.gsub(/\s\s/,'&#160;&#160;').strip
-        @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
-        @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
-        @@xml[:body] << %{#{Ax[:tab]*1}<text class="code">#{Ax[:tab]*1}}
-        @@xml[:body] << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
-        @@xml[:body] << %{#{Ax[:tab]*1}</text>}
-        @@xml[:body] << "#{Ax[:tab]*0}</object>"
+        @per.body << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
+        @per.body << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
+        @per.body << %{#{Ax[:tab]*1}<text class="code">#{Ax[:tab]*1}}
+        @per.body << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
+        @per.body << %{#{Ax[:tab]*1}</text>}
+        @per.body << "#{Ax[:tab]*0}</object>"
       end
       def table_structure(dob)
         table=SiSU_XHTML_Shared::TableXHTML.new(dob)
-        @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
-        @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
-        @@xml[:body] << %{#{Ax[:tab]*1}<text class="table">#{Ax[:tab]*1}}
-        @@xml[:body] << %{#{Ax[:tab]*2}#{table.table.obj}}
-        @@xml[:body] << %{#{Ax[:tab]*1}</text>}
-        #@@xml[:body] << %{#{tab*1}</text>}
-        @@xml[:body] << "#{Ax[:tab]*0}</object>"
-       #@@xml[:body] << %{#{Ax[:tab]*0}<object id="#{ocn}">}
-       #@@xml[:body] << %{#{Ax[:tab]*1}#{table}\n#{Ax[:tab]*1}} # unless lv  # main text, contents, body KEEP
-       #@@xml[:body] << "#{Ax[:tab]*0}</object>"
+        @per.body << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
+        @per.body << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
+        @per.body << %{#{Ax[:tab]*1}<text class="table">#{Ax[:tab]*1}}
+        @per.body << %{#{Ax[:tab]*2}#{table.table.obj}}
+        @per.body << %{#{Ax[:tab]*1}</text>}
+        #@per.body << %{#{tab*1}</text>}
+        @per.body << "#{Ax[:tab]*0}</object>"
+       #@per.body << %{#{Ax[:tab]*0}<object id="#{ocn}">}
+       #@per.body << %{#{Ax[:tab]*1}#{table}\n#{Ax[:tab]*1}} # unless lv  # main text, contents, body KEEP
+       #@per.body << "#{Ax[:tab]*0}</object>"
        #@endnotes=[]
       end
       def markup(data)
@@ -403,7 +404,7 @@ WOK
               elsif dob.obj =~/(Owner Details)/
 #               txt_obj={ txt: '<br /><a name="owner.details">Owner Details</a>' }
 #               format_scroll=FormatScroll.new(@md,txt_obj)
-#               @@xml[:owner_details]=format_scroll.bold_para
+#               @per.owner_details=format_scroll.bold_para
                 dob.obj=''
               end
               if dob.obj =~/<a name="n\d+">/ \
@@ -424,41 +425,41 @@ WOK
         end
         7.downto(4) do |x|
           y=x - 1; v=x - 3
-          @@xml[:body] << "#{Ax[:tab]*5}</content>\n#{Ax[:tab]*y}</contents#{v}>" if @level[x]==true
+          @per.body << "#{Ax[:tab]*5}</content>\n#{Ax[:tab]*y}</contents#{v}>" if @level[x]==true
         end
         3.downto(1) do |x|
           y=x - 1
-          @@xml[:body] << "#{Ax[:tab]*y}</heading#{x}>" if @level[x]==true
+          @per.body << "#{Ax[:tab]*y}</heading#{x}>" if @level[x]==true
         end
-        #7.downto(1) { |x| y=x - 1; @@xml[:body] << "#{Ax[:tab]*y}</level #{x}>" if @level[x]==true }
+        #7.downto(1) { |x| y=x - 1; @per.body << "#{Ax[:tab]*y}</level #{x}>" if @level[x]==true }
       end
       def pre
         rdf=SiSU_XML_Tags::RDF.new(@md)
-        @@xml[:head],@@xml[:body]=[],[]
+        @per.head,@per.body=[],[]
         stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xml_sax').stylesheet
         encoding=if @sys.locale =~/utf-?8/i then '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
         else                                     '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'
         end
-        @@xml[:open] =<<WOK
+        @per.open =<<WOK
 #{encoding}
 #{stylesheet.css_head_xml}
 #{rdf.comment_xml}
 <document>
 WOK
-        @@xml[:head] << '<head>'
-        @@xml[:body] << '<body>'
+        @per.head << '<head>'
+        @per.body << '<body>'
       end
       def post
-        @@xml[:head] << @@xml[:sc]
-        @@xml[:head] << '</head>'
-        @@xml[:body] << '</body>'
-        @@xml[:close] = '</document>'
+        @per.head << @per.sc
+        @per.head << '</head>'
+        @per.body << '</body>'
+        @per.close = '</document>'
       end
       def publish
         content=[]
-        content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata]
-        content << @@xml[:owner_details] if @md.stmp =~/\w\w/
-        content << @@xml[:tail] << @@xml[:close]
+        content << @per.open << @per.head << @per.body #<< @per.metadata
+        #content << @per.owner_details if @md.stmp =~/\w\w/
+        content << @per.tail << @per.close
         content=content.flatten.compact
         Output.new(content,@md).xml
         @@xml={}