From 32bc91491fedf30aa4594f9466836e4df9a43dd2 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 3 Dec 2013 00:12:40 -0500 Subject: v5: plaintext, rename & simplify --- lib/sisu/v5/txt_plain.rb | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/txt_plain.rb b/lib/sisu/v5/txt_plain.rb index e6a8f46f..0cd50254 100644 --- a/lib/sisu/v5/txt_plain.rb +++ b/lib/sisu/v5/txt_plain.rb @@ -60,12 +60,10 @@ linefeed) =end -module SiSU_Plaintext +module SiSU_Txt_Plain require_relative 'ao' # ao.rb require_relative 'sysenv' # sysenv.rb include SiSU_Env - require_relative 'txt_plaint_format' # plaintext_format.rb - include SiSU_Plaintext_Format require_relative 'shared_metadata' # shared_metadata.rb require_relative 'txt_shared' # txt_shared.rb include SiSU_Param @@ -396,6 +394,16 @@ WOK end @@endnotes[:para]=[] end + def ocn_display(dob) + if @env.plaintext_ocn? + if defined? dob.ocn \ + and dob.ocn.is_a?(Fixnum) + (defined? dob.ocn) ? "\n#{Dx[:ocn_o]}#{dob.ocn}#{Dx[:ocn_c]}" : '' + else '' + end + else '' + end + end def markup(data) # Used for major markup instructions SiSU_Env::InfoEnv.new(@md.fns) @data_mod,@endnotes,@level,@cont,@copen,@plaintext_contents_close=Array.new(6){[]} @@ -466,13 +474,7 @@ WOK gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]'). gsub(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ - p_num='' - if @env.plaintext_ocn? - if defined? dob.ocn \ - and dob.ocn.is_a?(Fixnum) - p_num=SiSU_Plaintext_Format::ParagraphNumber.new(dob.ocn).display - end - end + p_num=ocn_display(dob) if dob.is==:heading \ or dob.is==:para plaintext_structure(dob,p_num) -- cgit v1.2.3