From a151893efedaebc26d26a8f8611fb688a6de6d4f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 5 Feb 2014 00:56:10 -0500 Subject: v5 v6: ocn: strict html; turn on/off rules for txt & odf --- data/doc/sisu/CHANGELOG_v5 | 4 ++++ data/doc/sisu/CHANGELOG_v6 | 4 ++++ lib/sisu/v5/concordance.rb | 9 +++++---- lib/sisu/v5/constants.rb | 1 + lib/sisu/v5/html.rb | 9 +++++---- lib/sisu/v5/html_format.rb | 25 ++++++++++++++++--------- lib/sisu/v5/html_lite_shared.rb | 7 ++++--- lib/sisu/v5/html_minitoc.rb | 5 +++-- lib/sisu/v5/txt_plain.rb | 3 ++- lib/sisu/v5/xml_odf_odt.rb | 7 ++++--- lib/sisu/v5/xml_odf_odt_format.rb | 19 ++++++++++++++----- lib/sisu/v6/concordance.rb | 9 +++++---- lib/sisu/v6/constants.rb | 1 + lib/sisu/v6/html.rb | 9 +++++---- lib/sisu/v6/html_format.rb | 25 ++++++++++++++++--------- lib/sisu/v6/html_lite_shared.rb | 7 ++++--- lib/sisu/v6/html_minitoc.rb | 5 +++-- lib/sisu/v6/txt_plain.rb | 3 ++- lib/sisu/v6/xml_odf_odt.rb | 7 ++++--- lib/sisu/v6/xml_odf_odt_format.rb | 19 ++++++++++++++----- 20 files changed, 116 insertions(+), 62 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index a5e9059a..e59d839d 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -49,6 +49,10 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.3.1.orig.tar.xz (various changes, e.g. ocn [url]#37 only available as [url]#o37) * tags +* ocn turn on/off rules + * txt + * odt + * error/warn messages, including wrappers round require %% 5.3.0.orig.tar.xz (2014-01-26:03/7) diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6 index 27269b3f..a1183d8f 100644 --- a/data/doc/sisu/CHANGELOG_v6 +++ b/data/doc/sisu/CHANGELOG_v6 @@ -39,6 +39,10 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.0.1.orig.tar.xz (various changes, e.g. ocn [url]#37 only available as [url]#o37) * tags +* ocn turn on/off rules + * txt + * odt + * error/warn messages, including wrappers round require %% 6.0.0.orig.tar.xz (2014-01-26:03/7) diff --git a/lib/sisu/v5/concordance.rb b/lib/sisu/v5/concordance.rb index 55892ab7..b9030123 100644 --- a/lib/sisu/v5/concordance.rb +++ b/lib/sisu/v5/concordance.rb @@ -240,12 +240,13 @@ WOK end end protected - def location_scroll(wordlocation,show) - %{#{wordlocation}; } + def location_scroll(wordlocation,show) # not used + %{#{wordlocation}; } end - def location_seg(wordlocation,show) ##fix + def location_seg(wordlocation,show) unless wordlocation.nil? - wl=wordlocation.gsub(/(.+?)\#(\d+)/,"\\1#{@md.lang_code_insert}#{Sfx[:html]}#\\2") + wl=wordlocation.gsub(/(.+?)\#(\d+)/, + "\\1#{@md.lang_code_insert}#{Sfx[:html]}##{Mx[:ocn_id_char]}\\2") # id="o\d+" always available; a name="\d+" not available if html strict used case wordlocation when /#{@rxp_t1}|@rxp_t2}|#{@rxp_t3}/ %{[H]#{show}, } diff --git a/lib/sisu/v5/constants.rb b/lib/sisu/v5/constants.rb index e84c0901..fea57ce8 100644 --- a/lib/sisu/v5/constants.rb +++ b/lib/sisu/v5/constants.rb @@ -101,6 +101,7 @@ Xx={ html_relative1: '※', } Mx={ + ocn_id_char: 'o', meta_o: '〔@', meta_c: '〕', lv_o_0: 0, lv_o_1: 1, diff --git a/lib/sisu/v5/html.rb b/lib/sisu/v5/html.rb index 1b738561..ef62b9bd 100644 --- a/lib/sisu/v5/html.rb +++ b/lib/sisu/v5/html.rb @@ -245,6 +245,7 @@ module SiSU_HTML def initialize(md=nil,data='') @data,@md=data,md @vz=SiSU_Viz::Defaults.new + @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md end def songsheet #extracts toc for scroll & seg @@ -356,7 +357,7 @@ WOK title=if dob.ocn ==0 then linkname else @@toc[:scr] << '
' - %{#{linkname}} + %{#{linkname}} end txt_obj={ txt: title } format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) @@ -398,7 +399,7 @@ WOK end else @@toc[:scr] << '
' - %{#{linkname}} + %{#{linkname}} end txt_obj={ txt: title } format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) @@ -515,7 +516,7 @@ WOK } f=@md.file.base_filename.html_seg(fnh) p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) - lnk_n_txt=%{ + lnk_n_txt=%{ #{linkname} } txt_obj={ txt: lnk_n_txt } @@ -540,7 +541,7 @@ WOK } f=@md.file.base_filename.html_seg(fnh) p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) - lnk_n_txt=%{ + lnk_n_txt=%{ #{linkname} } txt_obj={ txt: lnk_n_txt } diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb index 0dc65a06..e0be4f8a 100644 --- a/lib/sisu/v5/html_format.rb +++ b/lib/sisu/v5/html_format.rb @@ -66,30 +66,36 @@ module SiSU_HTML_Format def initialize(md,ocn) @md,@ocn=md,ocn.to_s @ocn ||='' + @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier + @make=SiSU_Env::ProcessingSettings.new(@md) end def ocn_display - make=SiSU_Env::ProcessingSettings.new(@md) - if make.build.ocn? - ocn_class='ocn' + if @make.build.ocn? if @ocn.to_i==0 \ or @ocn.empty? - %{} + '' else + name=(@make.build.html_strict?) ? '' : %{ name="#{@ocn}"} @ocn.gsub(/^(\d+|)$/, - %{}) + %{}) end else - %{} + '' end end def name - (@ocn==nil || @ocn.empty?) ? '' : %{} + if @make.build.html_strict? \ + or @ocn==(nil || @ocn.empty?) + '' + else + %{} + end end def id #w3c? "tidy" complains about numbers as identifiers ! annoying (@ocn==nil || @ocn.empty?) ? '' : %{id="o#{@ocn}"} end def goto - (@ocn==nil || @ocn.empty?) ? '' : %{} + (@ocn==nil || @ocn.empty?) ? '' : %{} end end class HeadInformation @@ -1233,6 +1239,7 @@ WOK end def subtoc_lev(tag,attrib) @txt=clean(@txt) + @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier txt=if @txt \ and @txt =~/<\/?i>|/mi @txt.gsub(/<\/?i>|/mi,'') #removes name markers from subtoc, go directly to substantive text @@ -1246,7 +1253,7 @@ WOK gsub(/ \d+<\/sup> /m,'') end %{<#{tag} class="#{attrib}"> - #{txt} #{note} + #{txt} #{note} } end def subtoc_lev5 diff --git a/lib/sisu/v5/html_lite_shared.rb b/lib/sisu/v5/html_lite_shared.rb index 8c447352..e109debc 100644 --- a/lib/sisu/v5/html_lite_shared.rb +++ b/lib/sisu/v5/html_lite_shared.rb @@ -83,6 +83,7 @@ module SiSU_FormatShared end @tab="\t" @brace_url=SiSU_Viz::Defaults.new.url_decoration + @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier @@tablehead,@@tablefoot=[],[] @vz=SiSU_Viz::Defaults.new @env=SiSU_Env::InfoEnv.new(@md.fns) @@ -205,7 +206,7 @@ GSUB %{

#{h[:txt]}

\n} << "\n" end def lev_toc_hname - %{

#{@txt}

\n} #<< "\n" + %{

#{@txt}

\n} #<< "\n" end def lev_toc h={ txt: txt, class: "toc#{@lv}", type: 'toc' } @@ -309,10 +310,10 @@ GSUB def paragraph attrib=%{class="#{@attrib}" } if @ocn - id=%{id="#{@ocn}" } + id=%{id="#{Mx[:ocn_id_char]}#{@ocn}" } type=%{type="substantive" } else - id=%{id="none" } + id='' type=%{type="comment" } end header=%{header="#{@hname}" } if @hname diff --git a/lib/sisu/v5/html_minitoc.rb b/lib/sisu/v5/html_minitoc.rb index dae74c46..5366b127 100644 --- a/lib/sisu/v5/html_minitoc.rb +++ b/lib/sisu/v5/html_minitoc.rb @@ -71,6 +71,7 @@ def initialize(md,data) @md,@data=md,data @pat_strip_heading_name=/(.+?)<\/a>/ + @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md end def songsheet @@ -204,7 +205,7 @@ fn: @@seg_url, } f=@md.file.base_filename.html_seg(fnh) - lnk_n_txt=%{ + lnk_n_txt=%{ #{txt.obj} } txt_obj={ txt: lnk_n_txt } @@ -223,7 +224,7 @@ fn: @@seg_url, } f=@md.file.base_filename.html_seg(fnh) - lnk_n_txt=%{ + lnk_n_txt=%{ #{txt.obj} } txt_obj={ txt: lnk_n_txt } diff --git a/lib/sisu/v5/txt_plain.rb b/lib/sisu/v5/txt_plain.rb index ca944a1f..e27e9231 100644 --- a/lib/sisu/v5/txt_plain.rb +++ b/lib/sisu/v5/txt_plain.rb @@ -400,7 +400,8 @@ WOK @@endnotes[:para]=[] end def ocn_display(dob) - if @env.plaintext_ocn? + make=SiSU_Env::ProcessingSettings.new(@md) + if make.build.plaintext_ocn? if defined? dob.ocn \ and dob.ocn.is_a?(Fixnum) (defined? dob.ocn) ? "\n#{Dx[:ocn_o]}#{dob.ocn}#{Dx[:ocn_c]}" : '' diff --git a/lib/sisu/v5/xml_odf_odt.rb b/lib/sisu/v5/xml_odf_odt.rb index 8c3d4a98..d2ab0477 100644 --- a/lib/sisu/v5/xml_odf_odt.rb +++ b/lib/sisu/v5/xml_odf_odt.rb @@ -121,6 +121,7 @@ module SiSU_XML_ODF_ODT @@fns=nil def initialize(particulars) @md,@env,@ao_array=particulars.md,particulars.env,particulars.ao_array + @make=SiSU_Env::ProcessingSettings.new(@md) @vz=SiSU_Viz::Defaults.new @tab="\t" @brace_url=SiSU_Viz::Defaults.new.url_decoration @@ -556,10 +557,10 @@ module SiSU_XML_ODF_ODT end p_num={ display: '', set_ref: '' } if dob.is !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ - if @env.odt_ocn? + if @make.build.odt_ocn? if defined? dob.ocn \ and dob.ocn.is_a?(Fixnum) - p_num=SiSU_XML_ODF_ODT_Format::ParagraphNumber.new(dob.ocn).set_bookmark_and_display + p_num=SiSU_XML_ODF_ODT_Format::ParagraphNumber.new(@make,dob.ocn).set_bookmark_and_display end end end @@ -682,7 +683,7 @@ module SiSU_XML_ODF_ODT and (dob.obj =~/~metadata/ or dob =~/#{Mx[:lv_o]}1:meta#{Mx[:lv_x]}\s*Document Information/) #fix Mx[:lv_o] if dob.is !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ #check if defined? dob.ocn and dob.ocn =~/\d+/ - @p_num=SiSU_XML_ODF_ODT_Format::ParagraphNumber.new(dob.ocn) + @p_num=SiSU_XML_ODF_ODT_Format::ParagraphNumber.new(@make,dob.ocn) end if dob.is ==:heading \ || dob.is ==:para \ diff --git a/lib/sisu/v5/xml_odf_odt_format.rb b/lib/sisu/v5/xml_odf_odt_format.rb index 2a092011..b56e4284 100644 --- a/lib/sisu/v5/xml_odf_odt_format.rb +++ b/lib/sisu/v5/xml_odf_odt_format.rb @@ -65,17 +65,26 @@ module SiSU_XML_ODF_ODT_Format include SiSU_Param include SiSU_Viz class ParagraphNumber - def initialize(paranum) + def initialize(make,paranum) + @make=make @paranum=/(\d+)/m.match(paranum.to_s)[1] end def set_ref_and_display - set_ref=@paranum.gsub(/(\d+)/,' ') - disp=@paranum.gsub(/(\d+)/,%{ #{Dx[:ocn_o]}\\1#{Dx[:ocn_c]}}) + set_ref=@paranum.gsub(/(\d+)/, + ' ') + disp=@paranum.gsub(/(\d+)/, + (@make.build.odt_ocn?) \ + ? %{ #{Dx[:ocn_o]}\\1#{Dx[:ocn_c]}} + : '') { display: disp, set_ref: set_ref } end def set_bookmark_and_display - set_ref=@paranum.gsub(/(\d+)/,' ') - disp=@paranum.gsub(/(\d+)/,%{ #{Dx[:ocn_o]}\\1#{Dx[:ocn_c]}}) + set_ref=@paranum.gsub(/(\d+)/, + ' ') + disp=@paranum.gsub(/(\d+)/, + (@make.build.odt_ocn?) \ + ? %{ #{Dx[:ocn_o]}\\1#{Dx[:ocn_c]}} + : '') { display: disp, set_ref: set_ref } end def name diff --git a/lib/sisu/v6/concordance.rb b/lib/sisu/v6/concordance.rb index a20178ab..5422056f 100644 --- a/lib/sisu/v6/concordance.rb +++ b/lib/sisu/v6/concordance.rb @@ -240,12 +240,13 @@ WOK end end protected - def location_scroll(wordlocation,show) - %{#{wordlocation}; } + def location_scroll(wordlocation,show) # not used + %{#{wordlocation}; } end - def location_seg(wordlocation,show) ##fix + def location_seg(wordlocation,show) unless wordlocation.nil? - wl=wordlocation.gsub(/(.+?)\#(\d+)/,"\\1#{@md.lang_code_insert}#{Sfx[:html]}#\\2") + wl=wordlocation.gsub(/(.+?)\#(\d+)/, + "\\1#{@md.lang_code_insert}#{Sfx[:html]}##{Mx[:ocn_id_char]}\\2") # id="o\d+" always available; a name="\d+" not available if html strict used case wordlocation when /#{@rxp_t1}|@rxp_t2}|#{@rxp_t3}/ %{[H]#{show}, } diff --git a/lib/sisu/v6/constants.rb b/lib/sisu/v6/constants.rb index 34ff92e7..390df5a4 100644 --- a/lib/sisu/v6/constants.rb +++ b/lib/sisu/v6/constants.rb @@ -101,6 +101,7 @@ Xx={ html_relative1: '※', } Mx={ + ocn_id_char: 'o', meta_o: '〔@', meta_c: '〕', lv_o_0: 0, lv_o_1: 1, diff --git a/lib/sisu/v6/html.rb b/lib/sisu/v6/html.rb index 148672e5..f1651326 100644 --- a/lib/sisu/v6/html.rb +++ b/lib/sisu/v6/html.rb @@ -245,6 +245,7 @@ module SiSU_HTML def initialize(md=nil,data='') @data,@md=data,md @vz=SiSU_Viz::Defaults.new + @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md end def songsheet #extracts toc for scroll & seg @@ -356,7 +357,7 @@ WOK title=if dob.ocn ==0 then linkname else @@toc[:scr] << '
' - %{#{linkname}} + %{#{linkname}} end txt_obj={ txt: title } format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) @@ -398,7 +399,7 @@ WOK end else @@toc[:scr] << '
' - %{#{linkname}} + %{#{linkname}} end txt_obj={ txt: title } format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) @@ -515,7 +516,7 @@ WOK } f=@md.file.base_filename.html_seg(fnh) p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) - lnk_n_txt=%{ + lnk_n_txt=%{ #{linkname} } txt_obj={ txt: lnk_n_txt } @@ -540,7 +541,7 @@ WOK } f=@md.file.base_filename.html_seg(fnh) p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) - lnk_n_txt=%{ + lnk_n_txt=%{ #{linkname} } txt_obj={ txt: lnk_n_txt } diff --git a/lib/sisu/v6/html_format.rb b/lib/sisu/v6/html_format.rb index 18d42e14..ddfaaa70 100644 --- a/lib/sisu/v6/html_format.rb +++ b/lib/sisu/v6/html_format.rb @@ -66,30 +66,36 @@ module SiSU_HTML_Format def initialize(md,ocn) @md,@ocn=md,ocn.to_s @ocn ||='' + @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier + @make=SiSU_Env::ProcessingSettings.new(@md) end def ocn_display - make=SiSU_Env::ProcessingSettings.new(@md) - if make.build.ocn? - ocn_class='ocn' + if @make.build.ocn? if @ocn.to_i==0 \ or @ocn.empty? - %{} + '' else + name=(@make.build.html_strict?) ? '' : %{ name="#{@ocn}"} @ocn.gsub(/^(\d+|)$/, - %{}) + %{}) end else - %{} + '' end end def name - (@ocn==nil || @ocn.empty?) ? '' : %{} + if @make.build.html_strict? \ + or @ocn==(nil || @ocn.empty?) + '' + else + %{} + end end def id #w3c? "tidy" complains about numbers as identifiers ! annoying (@ocn==nil || @ocn.empty?) ? '' : %{id="o#{@ocn}"} end def goto - (@ocn==nil || @ocn.empty?) ? '' : %{} + (@ocn==nil || @ocn.empty?) ? '' : %{} end end class HeadInformation @@ -1233,6 +1239,7 @@ WOK end def subtoc_lev(tag,attrib) @txt=clean(@txt) + @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier txt=if @txt \ and @txt =~/<\/?i>|/mi @txt.gsub(/<\/?i>|/mi,'') #removes name markers from subtoc, go directly to substantive text @@ -1246,7 +1253,7 @@ WOK gsub(/ \d+<\/sup> /m,'') end %{<#{tag} class="#{attrib}"> - #{txt} #{note} + #{txt} #{note} } end def subtoc_lev5 diff --git a/lib/sisu/v6/html_lite_shared.rb b/lib/sisu/v6/html_lite_shared.rb index b675fbd3..88510f04 100644 --- a/lib/sisu/v6/html_lite_shared.rb +++ b/lib/sisu/v6/html_lite_shared.rb @@ -83,6 +83,7 @@ module SiSU_FormatShared end @tab="\t" @brace_url=SiSU_Viz::Defaults.new.url_decoration + @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier @@tablehead,@@tablefoot=[],[] @vz=SiSU_Viz::Defaults.new @env=SiSU_Env::InfoEnv.new(@md.fns) @@ -205,7 +206,7 @@ GSUB %{

#{h[:txt]}

\n} << "\n" end def lev_toc_hname - %{

#{@txt}

\n} #<< "\n" + %{

#{@txt}

\n} #<< "\n" end def lev_toc h={ txt: txt, class: "toc#{@lv}", type: 'toc' } @@ -309,10 +310,10 @@ GSUB def paragraph attrib=%{class="#{@attrib}" } if @ocn - id=%{id="#{@ocn}" } + id=%{id="#{Mx[:ocn_id_char]}#{@ocn}" } type=%{type="substantive" } else - id=%{id="none" } + id='' type=%{type="comment" } end header=%{header="#{@hname}" } if @hname diff --git a/lib/sisu/v6/html_minitoc.rb b/lib/sisu/v6/html_minitoc.rb index 0bb2794f..13045b0d 100644 --- a/lib/sisu/v6/html_minitoc.rb +++ b/lib/sisu/v6/html_minitoc.rb @@ -71,6 +71,7 @@ def initialize(md,data) @md,@data=md,data @pat_strip_heading_name=/(.+?)<\/a>/ + @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md end def songsheet @@ -204,7 +205,7 @@ fn: @@seg_url, } f=@md.file.base_filename.html_seg(fnh) - lnk_n_txt=%{ + lnk_n_txt=%{ #{txt.obj} } txt_obj={ txt: lnk_n_txt } @@ -223,7 +224,7 @@ fn: @@seg_url, } f=@md.file.base_filename.html_seg(fnh) - lnk_n_txt=%{ + lnk_n_txt=%{ #{txt.obj} } txt_obj={ txt: lnk_n_txt } diff --git a/lib/sisu/v6/txt_plain.rb b/lib/sisu/v6/txt_plain.rb index bb97f679..1aa08f0e 100644 --- a/lib/sisu/v6/txt_plain.rb +++ b/lib/sisu/v6/txt_plain.rb @@ -400,7 +400,8 @@ WOK @@endnotes[:para]=[] end def ocn_display(dob) - if @env.plaintext_ocn? + make=SiSU_Env::ProcessingSettings.new(@md) + if make.build.plaintext_ocn? if defined? dob.ocn \ and dob.ocn.is_a?(Fixnum) (defined? dob.ocn) ? "\n#{Dx[:ocn_o]}#{dob.ocn}#{Dx[:ocn_c]}" : '' diff --git a/lib/sisu/v6/xml_odf_odt.rb b/lib/sisu/v6/xml_odf_odt.rb index 707e7a20..0457ad7d 100644 --- a/lib/sisu/v6/xml_odf_odt.rb +++ b/lib/sisu/v6/xml_odf_odt.rb @@ -121,6 +121,7 @@ module SiSU_XML_ODF_ODT @@fns=nil def initialize(particulars) @md,@env,@ao_array=particulars.md,particulars.env,particulars.ao_array + @make=SiSU_Env::ProcessingSettings.new(@md) @vz=SiSU_Viz::Defaults.new @tab="\t" @brace_url=SiSU_Viz::Defaults.new.url_decoration @@ -556,10 +557,10 @@ module SiSU_XML_ODF_ODT end p_num={ display: '', set_ref: '' } if dob.is !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ - if @env.odt_ocn? + if @make.build.odt_ocn? if defined? dob.ocn \ and dob.ocn.is_a?(Fixnum) - p_num=SiSU_XML_ODF_ODT_Format::ParagraphNumber.new(dob.ocn).set_bookmark_and_display + p_num=SiSU_XML_ODF_ODT_Format::ParagraphNumber.new(@make,dob.ocn).set_bookmark_and_display end end end @@ -682,7 +683,7 @@ module SiSU_XML_ODF_ODT and (dob.obj =~/~metadata/ or dob =~/#{Mx[:lv_o]}1:meta#{Mx[:lv_x]}\s*Document Information/) #fix Mx[:lv_o] if dob.is !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ #check if defined? dob.ocn and dob.ocn =~/\d+/ - @p_num=SiSU_XML_ODF_ODT_Format::ParagraphNumber.new(dob.ocn) + @p_num=SiSU_XML_ODF_ODT_Format::ParagraphNumber.new(@make,dob.ocn) end if dob.is ==:heading \ || dob.is ==:para \ diff --git a/lib/sisu/v6/xml_odf_odt_format.rb b/lib/sisu/v6/xml_odf_odt_format.rb index bc7fadea..b2539dfd 100644 --- a/lib/sisu/v6/xml_odf_odt_format.rb +++ b/lib/sisu/v6/xml_odf_odt_format.rb @@ -65,17 +65,26 @@ module SiSU_XML_ODF_ODT_Format include SiSU_Param include SiSU_Viz class ParagraphNumber - def initialize(paranum) + def initialize(make,paranum) + @make=make @paranum=/(\d+)/m.match(paranum.to_s)[1] end def set_ref_and_display - set_ref=@paranum.gsub(/(\d+)/,' ') - disp=@paranum.gsub(/(\d+)/,%{ #{Dx[:ocn_o]}\\1#{Dx[:ocn_c]}}) + set_ref=@paranum.gsub(/(\d+)/, + ' ') + disp=@paranum.gsub(/(\d+)/, + (@make.build.odt_ocn?) \ + ? %{ #{Dx[:ocn_o]}\\1#{Dx[:ocn_c]}} + : '') { display: disp, set_ref: set_ref } end def set_bookmark_and_display - set_ref=@paranum.gsub(/(\d+)/,' ') - disp=@paranum.gsub(/(\d+)/,%{ #{Dx[:ocn_o]}\\1#{Dx[:ocn_c]}}) + set_ref=@paranum.gsub(/(\d+)/, + ' ') + disp=@paranum.gsub(/(\d+)/, + (@make.build.odt_ocn?) \ + ? %{ #{Dx[:ocn_o]}\\1#{Dx[:ocn_c]}} + : '') { display: disp, set_ref: set_ref } end def name -- cgit v1.2.3