diff options
author | Ralph Amissah <ralph@amissah.com> | 2013-12-03 00:12:40 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2013-12-03 00:12:40 -0500 |
commit | 32bc91491fedf30aa4594f9466836e4df9a43dd2 (patch) | |
tree | 98ad402f078ad7f3a0e5e999d2d36fc01187206a | |
parent | v5: some file renaming related to: shared files & epub, odf:odt, plaintext (diff) |
v5: plaintext, rename & simplify
-rw-r--r-- | data/doc/sisu/CHANGELOG_v5 | 1 | ||||
-rw-r--r-- | lib/sisu/v5/txt_plain.rb | 22 |
2 files changed, 13 insertions, 10 deletions
diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index af0dff54..b84664c8 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -47,6 +47,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.1.0.orig.tar.xz abstract as representation of & extraction of document objects (dal (document abstraction layer)) * shared files e.g. shared_xml becomes xml_shared + * plaintext becomes txt_plain * epub becomes xhtml_epub2 * odf becomes xml_odf_odt * xml sax file renamed xml_sax.rb (from xml.rb) 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) |