d: txt outputs, reorganize, introduce new files
authorRalph Amissah <ralph@amissah.com>
Fri, 21 Nov 2014 03:44:43 +0000 (22:44 -0500)
committerRalph Amissah <ralph@amissah.com>
Mon, 8 Dec 2014 05:18:15 +0000 (00:18 -0500)
15 files changed:
data/doc/sisu/CHANGELOG_v6
lib/sisu/develop/manpage.rb
lib/sisu/develop/txt_asciidoc.rb
lib/sisu/develop/txt_asciidoc_decorate.rb [new file with mode: 0644]
lib/sisu/develop/txt_markdown.rb
lib/sisu/develop/txt_markdown_decorate.rb [new file with mode: 0644]
lib/sisu/develop/txt_output.rb [new file with mode: 0644]
lib/sisu/develop/txt_plain.rb
lib/sisu/develop/txt_plain_decorate.rb [new file with mode: 0644]
lib/sisu/develop/txt_read.rb [new file with mode: 0644]
lib/sisu/develop/txt_rst.rb
lib/sisu/develop/txt_rst_decorate.rb [new file with mode: 0644]
lib/sisu/develop/txt_textile.rb
lib/sisu/develop/txt_textile_decorate.rb [new file with mode: 0644]
lib/sisu/develop/wikispeak.rb

index 7f1266dc51cc0bcde1e0eb9664d3c7b66dbe9e32..37a809189690097484807ae9461cf8bb03619906 100644 (file)
@@ -67,6 +67,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.4.0.orig.tar.xz
 
   * ao, rearrange, introduce new file
 
+  * txt outputs, reorganize, introduce new files
+
 ** 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 2d46a22901b5cc6c61c40a23a95a83ccbffac143..75d4c360d5ab8575de38592670913cb0cdbc94c5 100644 (file)
@@ -63,10 +63,12 @@ module SiSU_Manpage
     include SiSU_ManpageFormat
   require_relative 'shared_metadata'                    # shared_metadata.rb
   require_relative 'generic_parts'                      # generic_parts.rb
+  require_relative 'txt_read'                           # txt_read.rb
   require_relative 'txt_shared'                         # txt_shared.rb
-  @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
+  @@alt_id_count,@@alt_id_count=0,0
   @@tablefoot=''
   class Source
+    include SiSU_Txt_Read
     def initialize(opt)
       @opt=opt
       if @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
@@ -77,37 +79,14 @@ module SiSU_Manpage
     end
     def read
       begin
-        @md=SiSU_Param::Parameters.new(@opt).get
-        @env=SiSU_Env::InfoEnv.new(@opt.fns)
-        tool=(@opt.act[:verbose][:set]==:on \
-        || @opt.act[:verbose_plus][:set]==:on \
-        || @opt.act[:maintenance][:set]==:on) \
-        ?  "#{@env.program.text_editor} #{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}"
-        : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
-        (@opt.act[:verbose][:set]==:on \
-        || @opt.act[:verbose_plus][:set]==:on \
-        || @opt.act[:maintenance][:set]==:on) \
-        && @opt.act[:quiet][:set]==:on \
-        ? SiSU_Screen::Ansi.new(
-            @opt.act[:color_state][:set],
-            'Manpage',
-            tool
-          ).green_hi_blue
-        : SiSU_Screen::Ansi.new(
-            @opt.act[:color_state][:set],
-            'Manpage',
-            tool
-          ).green_title_hi
-        if (@opt.act[:verbose_plus][:set]==:on \
-        || @opt.act[:maintenance][:set]==:on)
-          SiSU_Screen::Ansi.new(
-            @opt.act[:color_state][:set],
-            @opt.fns,
-            "#{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}"
-          ).flow
-        end
-        @ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
-        SiSU_Manpage::Source::Scroll.new(@md,@ao_array).songsheet
+        md=SiSU_Param::Parameters.new(@opt).get
+        specific={
+          description:     'Manpage',
+          output_path:     md.file.output_path.manpage.dir,
+          output_file:     md.file.base_filename.manpage,
+        }
+        read_generic(@opt,specific)
+        SiSU_Manpage::Source::Scroll.new(md,@ao_array,@wrap_width).songsheet
       rescue
         SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
           __LINE__.to_s + ':' + __FILE__
@@ -121,8 +100,8 @@ module SiSU_Manpage
       include SiSU_Parts_Generic
       include SiSU_TextUtils
       @@endnotes={ para: [], end: [] }
-      def initialize(md,data)
-        @md,@data=md,data
+      def initialize(md,data,wrap_width)
+        @md,@data,@wrap_width=md,data,wrap_width
         @tab="\t"
         @@notes=:end
         @manpage={ body: [], open: [], close: [], head: [], metadata: [], tail: [], endnotes: [] }
@@ -153,8 +132,8 @@ module SiSU_Manpage
         notes=@n.flatten
         notes.each do |e|
           util=(e.to_s =~/^\[[\d*+]+\]:/) \
-          ? (SiSU_TextUtils::Wrap.new(e.to_s,78,4,1))
-          : (SiSU_TextUtils::Wrap.new(e.to_s,78,0,1))
+          ? (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,4,1))
+          : (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,0,1))
           wrap=util.line_wrap
           wrap=if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m
             wrap.gsub(/(^|&nbsp;|#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*'). #man page requires
@@ -219,19 +198,19 @@ WOK
             if dob.indent =~/[1-9]/ \
             and dob.indent == dob.hang
               util=if dob.bullet_
-                SiSU_TextUtils::Wrap.new("* #{paragraph}",78,dob.indent.to_i*2)
-              else SiSU_TextUtils::Wrap.new(paragraph,78,dob.indent.to_i*2)
+                SiSU_TextUtils::Wrap.new("* #{paragraph}",@wrap_width,dob.indent.to_i*2)
+              else SiSU_TextUtils::Wrap.new(paragraph,@wrap_width,dob.indent.to_i*2)
               end
             elsif dob.hang =~/[0-9]/ \
             and dob.indent != dob.hang                     # NOT yet implemented
-              util=SiSU_TextUtils::Wrap.new(paragraph,78,dob.indent.to_i*2)
+              util=SiSU_TextUtils::Wrap.new(paragraph,@wrap_width,dob.indent.to_i*2)
             else
               util=if dob.bullet_
-                SiSU_TextUtils::Wrap.new("* #{paragraph}",78,0)
-              else SiSU_TextUtils::Wrap.new(paragraph,78,0)
+                SiSU_TextUtils::Wrap.new("* #{paragraph}",@wrap_width,0)
+              else SiSU_TextUtils::Wrap.new(paragraph,@wrap_width,0)
               end
             end
-          else util=SiSU_TextUtils::Wrap.new(paragraph,78,0)
+          else util=SiSU_TextUtils::Wrap.new(paragraph,@wrap_width,0)
           end
           w=util.line_wrap
           w=w.gsub(/^(\\\.)/,' \1')
@@ -239,7 +218,7 @@ WOK
         end
         if lv
           times=wrapped.length
-          times=78 if times > 78
+          times=@wrap_width if times > @wrap_width
           @manpage[:body] << case lv
           when 0    then '.SH ' << wrapped.upcase << break_line << break_line
           when 1..3 then '.SH ' << wrapped.upcase << break_line << break_line
@@ -387,42 +366,11 @@ WOK
         content << @@endnotes[:end] if @@notes==:end
         content << manpage[:metadata]
         content << manpage[:tail]
-        Output.new(@md,content).manpage
+        outputfile=SiSU_Env::FileOp.new(@md).write_file.manpage
+        Txt_Output::Output.new.document(content,outputfile)
         @@endnotes={ para: [], end: [] }
       end
     end
-    class Output <Source
-      include SiSU_Param
-      include SiSU_Env
-      def initialize(md,content)
-        @md,@content=md,content
-      end
-      def manpage                                                            #%manpage output
-        SiSU_Env::FileOp.new(@md).mkdir
-        filename_manpage=SiSU_Env::FileOp.new(@md).write_file.manpage
-        @sisu=[]
-        emptyline=0
-        @content.each do |para|                                                # this is a hack
-          if para.is_a?(Array) \
-          and para.length > 0
-            para.each do |line|
-              if line
-                line=line.gsub(/[ \t]+$/m,'').
-                  gsub(/^\A[ ]*\Z/m,'')
-                (line=~/^\A\Z/) \
-                ? (emptyline+=1)
-                : emptyline=0
-                if emptyline < 2                     #remove additional empty lines
-                  filename_manpage.puts line           #unix manpage
-                end
-              end
-            end
-          else filename_manpage.puts para          #unix manpage # /^([*=-]|\.){5}/
-          end
-        end
-        filename_manpage.close
-      end
-    end
   end
 end
 __END__
index 0b7fa6694896ab166b1c9c36e32c42ae01fe1cc9..14bb3f09eb2e599eb875ac6642cdf5295d3c04ef 100644 (file)
@@ -60,11 +60,15 @@ module SiSU_Txt_AsciiDoc
     include SiSU_Env
   require_relative 'shared_metadata'                    # shared_metadata.rb
   require_relative 'generic_parts'                      # generic_parts.rb
+  require_relative 'txt_read'                           # txt_read.rb
   require_relative 'txt_shared'                         # txt_shared.rb
+  require_relative 'txt_asciidoc_decorate'              # txt_decorate.rb
+  require_relative 'txt_output'                         # txt_output.rb
   include SiSU_Param
-  @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
+  @@alt_id_count,@@alt_id_count=0,0
   @@tablefoot=''
   class Source
+    include SiSU_Txt_Read
     def initialize(opt)
       @opt=opt
       unless @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
@@ -74,46 +78,13 @@ module SiSU_Txt_AsciiDoc
     def read
       begin
         md=SiSU_Param::Parameters.new(@opt).get
-        env=SiSU_Env::InfoEnv.new(@opt.fns)
-        unless @opt.act[:quiet][:set]==:on
-          tool=(@opt.act[:verbose][:set]==:on \
-          || @opt.act[:verbose_plus][:set]==:on \
-          || @opt.act[:maintenance][:set]==:on) \
-          ? "#{env.program.text_editor} #{md.file.output_path.asciidoc.dir}/#{md.file.base_filename.asciidoc}"
-          : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
-          (@opt.act[:verbose][:set]==:on \
-          || @opt.act[:verbose_plus][:set]==:on \
-          || @opt.act[:maintenance][:set]==:on) \
-          ? SiSU_Screen::Ansi.new(
-              @opt.act[:color_state][:set],
-              'AsciiDoc (plaintext utf-8)',
-              tool
-            ).green_hi_blue
-          : SiSU_Screen::Ansi.new(
-              @opt.act[:color_state][:set],
-              'AsciiDoc (plaintext utf-8)',
-              tool
-            ).green_title_hi
-          if (@opt.act[:verbose_plus][:set]==:on \
-          || @opt.act[:maintenance][:set]==:on)
-            SiSU_Screen::Ansi.new(
-              @opt.act[:color_state][:set],
-              @opt.fns,
-              "#{md.file.output_path.asciidoc.dir}/#{md.file.base_filename.asciidoc}"
-            ).flow
-          end
-        end
-        ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
-        wrap_width=if defined? md.make.plaintext_wrap \
-        and md.make.plaintext_wrap
-          md.make.plaintext_wrap
-        elsif defined? env.plaintext_wrap \
-        and env.plaintext_wrap
-          env.plaintext_wrap
-        else 78
-        end
-        #wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78
-        SiSU_Txt_AsciiDoc::Source::Scroll.new(md,ao_array,wrap_width).songsheet
+        specific={
+          description:     'AsciiDoc (plaintext utf-8)',
+          output_path:     md.file.output_path.asciidoc.dir,
+          output_file:     md.file.base_filename.asciidoc,
+        }
+        read_generic(@opt,specific)
+        SiSU_Txt_AsciiDoc::Source::Scroll.new(md,@ao_array,@wrap_width).songsheet
       rescue
         SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
           __LINE__.to_s + ':' + __FILE__
@@ -125,6 +96,7 @@ module SiSU_Txt_AsciiDoc
     class Scroll <Source
       include SiSU_Parts_Generic
       include SiSU_TextUtils
+      include SiSU_Decorate_Txt_AsciiDoc
       @@endnotes={ para: [], end: [] }
       def initialize(md,data,wrap_width)
         @md,@data,@wrap_width=md,data,wrap_width
@@ -185,153 +157,6 @@ at:
 * SiSU #{the_url.sisu_txt}
 WOK
       end
-      def decorate
-        def heading
-          def inline
-            def l0
-              '='
-            end
-            def l1
-              '=='
-            end
-            def l2
-              '==='
-            end
-            def l3
-              '===='
-            end
-            def l4
-              '====='
-            end
-            def l5
-              '' #'======' #logical
-            end
-            self
-          end
-          def underscore
-            def l0
-              '='
-            end
-            def l1
-              '-'
-            end
-            def l2
-              '~'
-            end
-            def l3
-              '^'
-            end
-            def l4
-              '+'
-            end
-            def l5
-              '.' #'.' #proposed
-            end
-            self
-          end
-          self
-        end
-        def bold
-          def open
-            '*'
-          end
-          def close
-            '*'
-          end
-          self
-        end
-        def italics
-          def open
-            '_'
-          end
-          def close
-            '_'
-          end
-          self
-        end
-        def underscore
-          def open
-            ''
-          end
-          def close
-            ''
-          end
-          self
-        end
-       #def emphasis
-       #  def open
-       #    ''
-       #  end
-       #  def close
-       #    ''
-       #  end
-       #  self
-       #end
-        def cite
-          def open
-            '"'
-          end
-          def close
-            '"'
-          end
-          self
-        end
-        def insert
-          def open
-            ''
-          end
-          def close
-            ''
-          end
-          self
-        end
-        def strike
-          def open
-            '-'
-          end
-          def close
-            '-'
-          end
-          self
-        end
-        def superscript
-          def open
-            '^'
-          end
-          def close
-            '^'
-          end
-          self
-        end
-        def subscript
-          def open
-            '~'
-          end
-          def close
-            '~'
-          end
-          self
-        end
-        def hilite #bold
-          def open
-            '*'
-          end
-          def close
-            '*'
-          end
-          self
-        end
-        def monospace
-          def open
-            '+'
-          end
-          def close
-            '+'
-          end
-          self
-        end
-        self
-      end
       def heading_decorated_inline(dob)
         if dob.is==:heading
           heading_inline = case dob.lc
@@ -519,41 +344,11 @@ WOK
         content << plaintext[:metadata]
         content << "#{break_line}#{divider*@wrap_width}#{break_line}" if @md.stmp =~/\w+/ #not used?
         content << plaintext[:tail]
-        Output.new(content,@md).asciidoc
+        outputfile=SiSU_Env::FileOp.new(@md).write_file.asciidoc
+        Txt_Output::Output.new.document(content,outputfile)
         @@endnotes={ para: [], end: [] }
       end
     end
-    class Output <Source
-      include SiSU_Param
-      include SiSU_Env
-      def initialize(content,md)
-        @content,@md=content,md
-      end
-      def asciidoc
-        file_plaintext=SiSU_Env::FileOp.new(@md).write_file.asciidoc
-        @sisu=[]
-        emptyline=0
-        @content.each do |para|                                                # this is a hack
-          if para.is_a?(Array) \
-          and para.length > 0
-            para.each do |line|
-              if line
-                line=line.gsub(/[ \t]+$/m,'').
-                  gsub(/^\A[ ]*\Z/m,'')
-                (line=~/^\A\Z/) \
-                ? (emptyline+=1)
-                : emptyline=0
-                if emptyline < 2                     #remove additional empty lines
-                  file_plaintext.puts line
-                end
-              end
-            end
-          else file_plaintext.puts para          #unix plaintext # /^([*=-]|\.){5}/
-          end
-        end
-        file_plaintext.close
-      end
-    end
   end
 end
 __END__
diff --git a/lib/sisu/develop/txt_asciidoc_decorate.rb b/lib/sisu/develop/txt_asciidoc_decorate.rb
new file mode 100644 (file)
index 0000000..c63d508
--- /dev/null
@@ -0,0 +1,207 @@
+# encoding: utf-8
+=begin
+
+* Name: SiSU
+
+** Description: documents, structuring, processing, publishing, search
+*** plaintext decoration
+
+** 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/txt_asciidoc_decorate.rb;hb=HEAD>
+
+=end
+
+module SiSU_Decorate_Txt_AsciiDoc
+  def decorate
+    def heading
+      def inline
+        def l0
+          '='
+        end
+        def l1
+          '=='
+        end
+        def l2
+          '==='
+        end
+        def l3
+          '===='
+        end
+        def l4
+          '====='
+        end
+        def l5
+          '' #'======' #logical
+        end
+        self
+      end
+      def underscore
+        def l0
+          '='
+        end
+        def l1
+          '-'
+        end
+        def l2
+          '~'
+        end
+        def l3
+          '^'
+        end
+        def l4
+          '+'
+        end
+        def l5
+          '.' #'.' #proposed
+        end
+        self
+      end
+      self
+    end
+    def bold
+      def open
+        '*'
+      end
+      def close
+        '*'
+      end
+      self
+    end
+    def italics
+      def open
+        '_'
+      end
+      def close
+        '_'
+      end
+      self
+    end
+    def underscore
+      def open
+        ''
+      end
+      def close
+        ''
+      end
+      self
+    end
+   #def emphasis
+   #  def open
+   #    ''
+   #  end
+   #  def close
+   #    ''
+   #  end
+   #  self
+   #end
+    def cite
+      def open
+        '"'
+      end
+      def close
+        '"'
+      end
+      self
+    end
+    def insert
+      def open
+        ''
+      end
+      def close
+        ''
+      end
+      self
+    end
+    def strike
+      def open
+        '-'
+      end
+      def close
+        '-'
+      end
+      self
+    end
+    def superscript
+      def open
+        '^'
+      end
+      def close
+        '^'
+      end
+      self
+    end
+    def subscript
+      def open
+        '~'
+      end
+      def close
+        '~'
+      end
+      self
+    end
+    def hilite #bold
+      def open
+        '*'
+      end
+      def close
+        '*'
+      end
+      self
+    end
+    def monospace
+      def open
+        '+'
+      end
+      def close
+        '+'
+      end
+      self
+    end
+    self
+  end
+end
+__END__
index 52f3b9115b3509d1d21d40c4831780c7ebf2c622..e927c0eccdf7736e43166251ee4fd18486256ea8 100644 (file)
@@ -60,11 +60,15 @@ module SiSU_Txt_Markdown
     include SiSU_Env
   require_relative 'shared_metadata'                    # shared_metadata.rb
   require_relative 'generic_parts'                      # generic_parts.rb
+  require_relative 'txt_read'                           # txt_read.rb
   require_relative 'txt_shared'                         # txt_shared.rb
+  require_relative 'txt_markdown_decorate'              # txt_markdown_decorate.rb
+  require_relative 'txt_output'                         # txt_output.rb
   include SiSU_Param
-  @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
+  @@alt_id_count,@@alt_id_count=0,0
   @@tablefoot=''
   class Source
+    include SiSU_Txt_Read
     def initialize(opt)
       @opt=opt
       unless @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
@@ -74,45 +78,13 @@ module SiSU_Txt_Markdown
     def read
       begin
         md=SiSU_Param::Parameters.new(@opt).get
-        env=SiSU_Env::InfoEnv.new(@opt.fns)
-        unless @opt.act[:quiet][:set]==:on
-          tool=(@opt.act[:verbose][:set]==:on \
-          || @opt.act[:verbose_plus][:set]==:on \
-          || @opt.act[:maintenance][:set]==:on) \
-          ? "#{env.program.text_editor} #{md.file.output_path.markdown.dir}/#{md.file.base_filename.markdown}"
-          : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
-          (@opt.act[:verbose][:set]==:on \
-          || @opt.act[:verbose_plus][:set]==:on \
-          || @opt.act[:maintenance][:set]==:on) \
-          ? SiSU_Screen::Ansi.new(
-              @opt.act[:color_state][:set],
-              'Markdown (plaintext utf-8)',
-              tool
-            ).green_hi_blue
-          : SiSU_Screen::Ansi.new(
-              @opt.act[:color_state][:set],
-              'Markdown (plaintext utf-8)',
-              tool
-            ).green_title_hi
-          if (@opt.act[:verbose_plus][:set]==:on \
-          || @opt.act[:maintenance][:set]==:on)
-            SiSU_Screen::Ansi.new(
-              @opt.act[:color_state][:set],
-              @opt.fns,"#{md.file.output_path.markdown.dir}/#{md.file.base_filename.markdown}"
-            ).flow
-          end
-        end
-        ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
-        wrap_width=if defined? md.make.plaintext_wrap \
-        and md.make.plaintext_wrap
-          md.make.plaintext_wrap
-        elsif defined? env.plaintext_wrap \
-        and env.plaintext_wrap
-          env.plaintext_wrap
-        else 78
-        end
-        #wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78
-        SiSU_Txt_Markdown::Source::Scroll.new(md,ao_array,wrap_width).songsheet
+        specific={
+          description:     'Markdown (plaintext utf-8)',
+          output_path:     md.file.output_path.markdown.dir,
+          output_file:     md.file.base_filename.markdown,
+        }
+        read_generic(@opt,specific)
+        SiSU_Txt_Markdown::Source::Scroll.new(md,@ao_array,@wrap_width).songsheet
       rescue
         SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
           __LINE__.to_s + ':' + __FILE__
@@ -124,6 +96,7 @@ module SiSU_Txt_Markdown
     class Scroll <Source
       include SiSU_Parts_Generic
       include SiSU_TextUtils
+      include SiSU_Decorate_Txt_Markdown
       @@endnotes={ para: [], end: [] }
       def initialize(md,data,wrap_width)
         @md,@data,@wrap_width=md,data,wrap_width
@@ -152,10 +125,10 @@ module SiSU_Txt_Markdown
           if n =~/#{Mx[:br_line]}|#{Mx[:br_nl]}/
             fix = n.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/) #watch #added
             fix.each do |x|
-              unless x.empty?; @n << x
+              unless x.empty? then @n << x
               end
             end
-          else                 @n << n
+          else                     @n << n
           end
         end
         notes=@n.flatten
@@ -220,153 +193,6 @@ at:
 * SiSU #{the_url.sisu_txt}
 WOK
       end
-      def decorate
-        def heading
-          def inline                   #atx
-            def l0
-              '#'
-            end
-            def l1
-              '##'
-            end
-            def l2
-              '###'
-            end
-            def l3
-              '####'
-            end
-            def l4
-              '#####'
-            end
-            def l5
-              '######'
-            end
-            self
-          end
-          def underscore               #Setext
-            def l1
-              '='
-            end
-            def l2
-              '-'
-            end
-            def l3
-              ''
-            end
-            def l4
-              ''
-            end
-            def l5
-              ''
-            end
-            def l6
-              ''
-            end
-            self
-          end
-          self
-        end
-        def bold
-          def open
-            '**'
-          end
-          def close
-            '**'
-          end
-          self
-        end
-        def italics
-          def open
-            '*'
-          end
-          def close
-            '*'
-          end
-          self
-        end
-        def underscore
-          def open
-            '_'
-          end
-          def close
-            '_'
-          end
-          self
-        end
-       #def emphasis
-       #  def open
-       #    ''
-       #  end
-       #  def close
-       #    ''
-       #  end
-       #  self
-       #end
-        def cite
-          def open
-            '"'
-          end
-          def close
-            '"'
-          end
-          self
-        end
-        def insert
-          def open
-            '+'
-          end
-          def close
-            '+'
-          end
-          self
-        end
-        def strike
-          def open
-            '-'
-          end
-          def close
-            '-'
-          end
-          self
-        end
-        def superscript
-          def open
-            '^'
-          end
-          def close
-            '^'
-          end
-          self
-        end
-        def subscript
-          def open
-            '['
-          end
-          def close
-            ']'
-          end
-          self
-        end
-        def hilite
-          def open
-            '**'
-          end
-          def close
-            '**'
-          end
-          self
-        end
-        def monospace
-          def open
-            '`'
-          end
-          def close
-            '`'
-          end
-          self
-        end
-        self
-      end
       def heading_decorated_inline(dob)
         if dob.is==:heading
           heading_inline = case dob.lc
@@ -553,41 +379,11 @@ WOK
         content << plaintext[:metadata]
         content << "#{break_line}#{divider*@wrap_width}#{break_line}" if @md.stmp =~/\w+/ #not used?
         content << plaintext[:tail]
-        Output.new(content,@md).markdown
+        outputfile=SiSU_Env::FileOp.new(@md).write_file.markdown
+        Txt_Output::Output.new.document(content,outputfile)
         @@endnotes={ para: [], end: [] }
       end
     end
-    class Output <Source
-      include SiSU_Param
-      include SiSU_Env
-      def initialize(content,md)
-        @content,@md=content,md
-      end
-      def markdown
-        file_plaintext=SiSU_Env::FileOp.new(@md).write_file.markdown
-        @sisu=[]
-        emptyline=0
-        @content.each do |para|                                                # this is a hack
-          if para.is_a?(Array) \
-          and para.length > 0
-            para.each do |line|
-              if line
-                line=line.gsub(/[ \t]+$/m,'').
-                  gsub(/^\A[ ]*\Z/m,'')
-                (line=~/^\A\Z/) \
-                ? (emptyline+=1)
-                : emptyline=0
-                if emptyline < 2                     #remove additional empty lines
-                  file_plaintext.puts line
-                end
-              end
-            end
-          else file_plaintext.puts para          #unix plaintext # /^([*=-]|\.){5}/
-          end
-        end
-        file_plaintext.close
-      end
-    end
   end
 end
 __END__
diff --git a/lib/sisu/develop/txt_markdown_decorate.rb b/lib/sisu/develop/txt_markdown_decorate.rb
new file mode 100644 (file)
index 0000000..20029ef
--- /dev/null
@@ -0,0 +1,207 @@
+# encoding: utf-8
+=begin
+
+* Name: SiSU
+
+** Description: documents, structuring, processing, publishing, search
+*** plaintext decoration
+
+** 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/txt_markdown_decorate.rb;hb=HEAD>
+
+=end
+
+module SiSU_Decorate_Txt_Markdown
+  def decorate
+    def heading
+      def inline                   #atx
+        def l0
+          '#'
+        end
+        def l1
+          '##'
+        end
+        def l2
+          '###'
+        end
+        def l3
+          '####'
+        end
+        def l4
+          '#####'
+        end
+        def l5
+          '######'
+        end
+        self
+      end
+      def underscore               #Setext
+        def l1
+          '='
+        end
+        def l2
+          '-'
+        end
+        def l3
+          ''
+        end
+        def l4
+          ''
+        end
+        def l5
+          ''
+        end
+        def l6
+          ''
+        end
+        self
+      end
+      self
+    end
+    def bold
+      def open
+        '**'
+      end
+      def close
+        '**'
+      end
+      self
+    end
+    def italics
+      def open
+        '*'
+      end
+      def close
+        '*'
+      end
+      self
+    end
+    def underscore
+      def open
+        '_'
+      end
+      def close
+        '_'
+      end
+      self
+    end
+   #def emphasis
+   #  def open
+   #    ''
+   #  end
+   #  def close
+   #    ''
+   #  end
+   #  self
+   #end
+    def cite
+      def open
+        '"'
+      end
+      def close
+        '"'
+      end
+      self
+    end
+    def insert
+      def open
+        '+'
+      end
+      def close
+        '+'
+      end
+      self
+    end
+    def strike
+      def open
+        '-'
+      end
+      def close
+        '-'
+      end
+      self
+    end
+    def superscript
+      def open
+        '^'
+      end
+      def close
+        '^'
+      end
+      self
+    end
+    def subscript
+      def open
+        '['
+      end
+      def close
+        ']'
+      end
+      self
+    end
+    def hilite
+      def open
+        '**'
+      end
+      def close
+        '**'
+      end
+      self
+    end
+    def monospace
+      def open
+        '`'
+      end
+      def close
+        '`'
+      end
+      self
+    end
+    self
+  end
+end
+__END__
diff --git a/lib/sisu/develop/txt_output.rb b/lib/sisu/develop/txt_output.rb
new file mode 100644 (file)
index 0000000..98a295e
--- /dev/null
@@ -0,0 +1,30 @@
+module Txt_Output
+  class Output
+    include SiSU_Param
+    include SiSU_Env
+    def document(content,outputfile)
+      emptyline=0
+      content.each do |para|           # this is a hack
+        if para.is_a?(Array) \
+        and para.length > 0
+          para.each do |line|
+            if line
+              line=line.gsub(/[ \t]+$/m,'').
+                gsub(/^\A[ ]*\Z/m,'')
+              (line=~/^\A\Z/) \
+              ? (emptyline+=1)
+              : emptyline=0
+              if emptyline < 2         #remove additional empty lines
+                outputfile.puts line
+              end
+            end
+          end
+        else outputfile.puts para      #unix plaintext # /^([*=-]|\.){5}/
+        end
+      end
+      outputfile.close
+    end
+  end
+end
+__END__
+
index 2c31470839e7c50a1a356de5a20053fd8c690767..2c19c7d26185bacc1b7480a706b70e2a25602bc3 100644 (file)
@@ -60,11 +60,15 @@ module SiSU_Txt_Plain
     include SiSU_Env
   require_relative 'shared_metadata'                    # shared_metadata.rb
   require_relative 'generic_parts'                      # generic_parts.rb
+  require_relative 'txt_read'                           # txt_read.rb
   require_relative 'txt_shared'                         # txt_shared.rb
+  require_relative 'txt_plain_decorate'                 # txt_plain_decorate.rb
+  require_relative 'txt_output'                         # txt_output.rb
   include SiSU_Param
-  @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
+  @@alt_id_count,@@alt_id_count=0,0
   @@tablefoot=''
   class Source
+    include SiSU_Txt_Read
     def initialize(opt)
       @opt=opt
       unless @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
@@ -74,46 +78,13 @@ module SiSU_Txt_Plain
     def read
       begin
         md=SiSU_Param::Parameters.new(@opt).get
-        env=SiSU_Env::InfoEnv.new(@opt.fns)
-        unless @opt.act[:quiet][:set]==:on
-          tool=(@opt.act[:verbose][:set]==:on \
-          || @opt.act[:verbose_plus][:set]==:on \
-          || @opt.act[:maintenance][:set]==:on) \
-          ? "#{env.program.text_editor} #{md.file.output_path.txt.dir}/#{md.file.base_filename.txt}"
-          : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
-          (@opt.act[:verbose][:set]==:on \
-          || @opt.act[:verbose_plus][:set]==:on \
-          || @opt.act[:maintenance][:set]==:on) \
-          ? SiSU_Screen::Ansi.new(
-              @opt.act[:color_state][:set],
-              'Plaintext',
-              tool
-            ).green_hi_blue
-          : SiSU_Screen::Ansi.new(
-              @opt.act[:color_state][:set],
-              'Plaintext',
-              tool
-            ).green_title_hi
-          if (@opt.act[:verbose_plus][:set]==:on \
-          || @opt.act[:maintenance][:set]==:on)
-            SiSU_Screen::Ansi.new(
-              @opt.act[:color_state][:set],
-              @opt.fns,
-              "#{md.file.output_path.txt.dir}/#{md.file.base_filename.txt}"
-            ).flow
-          end
-        end
-        ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
-        wrap_width=if defined? md.make.plaintext_wrap \
-        and md.make.plaintext_wrap
-          md.make.plaintext_wrap
-        elsif defined? env.plaintext_wrap \
-        and env.plaintext_wrap
-          env.plaintext_wrap
-        else 78
-        end
-        #wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78
-        SiSU_Txt_Plain::Source::Scroll.new(md,ao_array,wrap_width).songsheet
+        specific={
+          description:     'Plaintext (utf-8)',
+          output_path:     md.file.output_path.txt.dir,
+          output_file:     md.file.base_filename.txt,
+        }
+        read_generic(@opt,specific)
+        SiSU_Txt_Plain::Source::Scroll.new(md,@ao_array,@wrap_width).songsheet
       rescue
         SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
           __LINE__.to_s + ':' + __FILE__
@@ -125,6 +96,7 @@ module SiSU_Txt_Plain
     class Scroll <Source
       include SiSU_Parts_Generic
       include SiSU_TextUtils
+      include SiSU_Decorate_Txt_Plain
       @@endnotes={ para: [], end: [] }
       def initialize(md,data,wrap_width)
         @md,@data,@wrap_width=md,data,wrap_width
@@ -133,7 +105,7 @@ module SiSU_Txt_Plain
         @@endnotes_=case md.opt.selections.str
         when /--footnote/ then false
         when /--endnote/  then true
-        else              true
+        else                   true
         end
         @plaintext={ body: [], open: [], close: [], head: [], metadata: [], tail: [] }
       end
@@ -221,135 +193,6 @@ at:
 * SiSU #{the_url.sisu_txt}
 WOK
       end
-      def decorate
-        def heading_underscore
-          def l0
-            '='
-          end
-          def l1
-            '*'
-          end
-          def l2
-            '+'
-          end
-          def l3
-            '~'
-          end
-          def l4
-            '-'
-          end
-          def l5
-            '.'
-          end
-          def l6
-            '.'
-          end
-          def l7
-            '.'
-          end
-          self
-        end
-        def bold
-          def open
-            '*'
-          end
-          def close
-            '*'
-          end
-          self
-        end
-        def italics
-          def open
-            '/'
-          end
-          def close
-            '/'
-          end
-          self
-        end
-        def underscore
-          def open
-            '_'
-          end
-          def close
-            '_'
-          end
-          self
-        end
-       #def emphasis
-       #  def open
-       #    ''
-       #  end
-       #  def close
-       #    ''
-       #  end
-       #  self
-       #end
-        def cite
-          def open
-            '"'
-          end
-          def close
-            '"'
-          end
-          self
-        end
-        def insert
-          def open
-            '+'
-          end
-          def close
-            '+'
-          end
-          self
-        end
-        def strike
-          def open
-            '-'
-          end
-          def close
-            '-'
-          end
-          self
-        end
-        def superscript
-          def open
-            '^'
-          end
-          def close
-            '^'
-          end
-          self
-        end
-        def subscript
-          def open
-            '['
-          end
-          def close
-            ']'
-          end
-          self
-        end
-        def hilite
-          def open
-            '*'
-          end
-          def close
-            '*'
-          end
-          self
-        end
-        def monospace
-          def open
-            '#'
-          end
-          def close
-            '#'
-          end
-          self
-        end
-        self
-      end
       def plaintext_structure(dob='',p_num='') #% Used to extract the structure of a document
         lv=n=n3=nil
         if dob.is==:heading
@@ -535,41 +378,11 @@ WOK
         content << plaintext[:metadata]
         content << "#{break_line}#{divider*@wrap_width}#{break_line}" if @md.stmp =~/\w+/ #not used?
         content << plaintext[:tail]
-        Output.new(content,@md).plaintext
+        outputfile=SiSU_Env::FileOp.new(@md).write_file.txt
+        Txt_Output::Output.new.document(content,outputfile)
         @@endnotes={ para: [], end: [] }
       end
     end
-    class Output <Source
-      include SiSU_Param
-      include SiSU_Env
-      def initialize(content,md)
-        @content,@md=content,md
-      end
-      def plaintext                                                            #%plaintext output
-        file_plaintext=SiSU_Env::FileOp.new(@md).write_file.txt
-        @sisu=[]
-        emptyline=0
-        @content.each do |para|                                                # this is a hack
-          if para.is_a?(Array) \
-          and para.length > 0
-            para.each do |line|
-              if line
-                line=line.gsub(/[ \t]+$/m,'').
-                  gsub(/^\A[ ]*\Z/m,'')
-                (line=~/^\A\Z/) \
-                ? (emptyline+=1)
-                : emptyline=0
-                if emptyline < 2                     #remove additional empty lines
-                  file_plaintext.puts line
-                end
-              end
-            end
-          else file_plaintext.puts para          #unix plaintext # /^([*=-]|\.){5}/
-          end
-        end
-        file_plaintext.close
-      end
-    end
   end
 end
 __END__
@@ -585,13 +398,13 @@ __END__
   subscript_o:               '[',          subscript_c:              ']',
   hilite_o:                  '*',          hilite_c:                 '*',
   monospace_o:               '',           monospace_c:              '',
-  po_bold_o:                 '!{',         po_bold_c:                '}!',
-  po_italics_o:              '/{',         po_italics_c:             '}/',
-  po_underscore_o:           '_{',         po_underscore_c:          '}_',
-  po_cite_o:                 '"{',         po_cite_c:                '}"',
-  po_insert_o:               '+{',         po_insert_c:              '}+',
-  po_strike_o:               '-{',         po_strike_c:              '}-',
-  po_superscript_o:          '^{',         po_superscript_c:         '}^',
-  po_subscript_o:            ',{',         po_subscript_c:           '},',
-  po_hilite_o:               '*{',         po_hilite_c:              '}*',
-  po_monospace_o:            '#{',         po_monospace_c:           '}#',
+  p_bold_o:                  '!{',         p_bold_c:                 '}!',
+  p_italics_o:               '/{',         p_italics_c:              '}/',
+  p_underscore_o:            '_{',         p_underscore_c:           '}_',
+  p_cite_o:                  '"{',         p_cite_c:                 '}"',
+  p_insert_o:                '+{',         p_insert_c:               '}+',
+  p_strike_o:                '-{',         p_strike_c:               '}-',
+  p_superscript_o:           '^{',         p_superscript_c:          '}^',
+  p_subscript_o:             ',{',         p_subscript_c:            '},',
+  p_hilite_o:                '*{',         p_hilite_c:               '}*',
+  p_monospace_o:             '#{',         p_monospace_c:            '}#',
diff --git a/lib/sisu/develop/txt_plain_decorate.rb b/lib/sisu/develop/txt_plain_decorate.rb
new file mode 100644 (file)
index 0000000..6bceb9c
--- /dev/null
@@ -0,0 +1,189 @@
+# encoding: utf-8
+=begin
+
+* Name: SiSU
+
+** Description: documents, structuring, processing, publishing, search
+*** plaintext decoration
+
+** 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/txt_plain_decorate.rb;hb=HEAD>
+
+=end
+
+module SiSU_Decorate_Txt_Plain
+  def decorate
+    def heading_underscore
+      def l0
+        '='
+      end
+      def l1
+        '*'
+      end
+      def l2
+        '+'
+      end
+      def l3
+        '~'
+      end
+      def l4
+        '-'
+      end
+      def l5
+        '.'
+      end
+      def l6
+        '.'
+      end
+      def l7
+        '.'
+      end
+      self
+    end
+    def bold
+      def open
+        '*'
+      end
+      def close
+        '*'
+      end
+      self
+    end
+    def italics
+      def open
+        '/'
+      end
+      def close
+        '/'
+      end
+      self
+    end
+    def underscore
+      def open
+        '_'
+      end
+      def close
+        '_'
+      end
+      self
+    end
+   #def emphasis
+   #  def open
+   #    ''
+   #  end
+   #  def close
+   #    ''
+   #  end
+   #  self
+   #end
+    def cite
+      def open
+        '"'
+      end
+      def close
+        '"'
+      end
+      self
+    end
+    def insert
+      def open
+        '+'
+      end
+      def close
+        '+'
+      end
+      self
+    end
+    def strike
+      def open
+        '-'
+      end
+      def close
+        '-'
+      end
+      self
+    end
+    def superscript
+      def open
+        '^'
+      end
+      def close
+        '^'
+      end
+      self
+    end
+    def subscript
+      def open
+        '['
+      end
+      def close
+        ']'
+      end
+      self
+    end
+    def hilite
+      def open
+        '*'
+      end
+      def close
+        '*'
+      end
+      self
+    end
+    def monospace
+      def open
+        '#'
+      end
+      def close
+        '#'
+      end
+      self
+    end
+    self
+  end
+end
+__END__
diff --git a/lib/sisu/develop/txt_read.rb b/lib/sisu/develop/txt_read.rb
new file mode 100644 (file)
index 0000000..204b94c
--- /dev/null
@@ -0,0 +1,109 @@
+# encoding: utf-8
+=begin
+
+* Name: SiSU
+
+** Description: documents, structuring, processing, publishing, search
+*** plaintext (smarttext) generation, asciidoc
+
+** 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/txt_read.rb;hb=HEAD>
+
+=end
+module SiSU_Txt_Read
+  require_relative 'se'                                 # se.rb
+    include SiSU_Env
+  def read_generic(opt,specific)
+    begin
+      env=SiSU_Env::InfoEnv.new(opt.fns)
+      unless opt.act[:quiet][:set]==:on
+        tool=(opt.act[:verbose][:set]==:on \
+        || opt.act[:verbose_plus][:set]==:on \
+        || opt.act[:maintenance][:set]==:on) \
+        ? "#{env.program.text_editor} #{specific[:output_path]}/#{specific[:output_file]}"
+        : "[#{opt.f_pth[:lng_is]}] #{opt.fno}"
+        (opt.act[:verbose][:set]==:on \
+        || opt.act[:verbose_plus][:set]==:on \
+        || opt.act[:maintenance][:set]==:on) \
+        ? SiSU_Screen::Ansi.new(
+            opt.act[:color_state][:set],
+            specific[:description],
+            tool
+          ).green_hi_blue
+        : SiSU_Screen::Ansi.new(
+            opt.act[:color_state][:set],
+            specific[:description],
+            tool
+          ).green_title_hi
+        if (opt.act[:verbose_plus][:set]==:on \
+        || opt.act[:maintenance][:set]==:on)
+          SiSU_Screen::Ansi.new(
+            opt.act[:color_state][:set],
+            opt.fns,
+            "#{specific[:output_path]}/#{specific[:output_file]}"
+          ).flow
+        end
+      end
+      @ao_array=SiSU_AO::Source.new(opt).get # ao file drawn here
+      @wrap_width=if defined? md.make.plaintext_wrap \
+      and md.make.plaintext_wrap
+        md.make.plaintext_wrap
+      elsif defined? env.plaintext_wrap \
+      and env.plaintext_wrap
+        env.plaintext_wrap
+      else 78
+      end
+      #wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78
+    rescue
+      SiSU_Errors::Rescued.new($!,$@,opt.selections.str,opt.fns).location do
+        __LINE__.to_s + ':' + __FILE__
+      end
+    ensure
+    end
+  end
+end
+
index 052051fe9145d905332a1bfc5f5013446ff74869..a596fa85ca51e066a62e43f204652c88820d266d 100644 (file)
@@ -60,11 +60,15 @@ module SiSU_Txt_rST
     include SiSU_Env
   require_relative 'shared_metadata'                    # shared_metadata.rb
   require_relative 'generic_parts'                      # generic_parts.rb
+  require_relative 'txt_read'                           # txt_read.rb
   require_relative 'txt_shared'                         # txt_shared.rb
+  require_relative 'txt_rst_decorate'                   # txt_rst_decorate.rb
+  require_relative 'txt_output'                         # txt_output.rb
   include SiSU_Param
-  @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
+  @@alt_id_count,@@alt_id_count=0,0
   @@tablefoot=''
   class Source
+    include SiSU_Txt_Read
     def initialize(opt)
       @opt=opt
       unless @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
@@ -74,46 +78,13 @@ module SiSU_Txt_rST
     def read
       begin
         md=SiSU_Param::Parameters.new(@opt).get
-        env=SiSU_Env::InfoEnv.new(@opt.fns)
-        unless @opt.act[:quiet][:set]==:on
-          tool=(@opt.act[:verbose][:set]==:on \
-          || @opt.act[:verbose_plus][:set]==:on \
-          || @opt.act[:maintenance][:set]==:on) \
-          ? "#{env.program.text_editor} #{md.file.output_path.rst.dir}/#{md.file.base_filename.rst}"
-          : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
-          (@opt.act[:verbose][:set]==:on \
-          || @opt.act[:verbose_plus][:set]==:on \
-          || @opt.act[:maintenance][:set]==:on) \
-          ? SiSU_Screen::Ansi.new(
-              @opt.act[:color_state][:set],
-              'rST (plaintext utf-8)',
-              tool
-            ).green_hi_blue
-          : SiSU_Screen::Ansi.new(
-              @opt.act[:color_state][:set],
-              'rST (plaintext utf-8)',
-              tool
-            ).green_title_hi
-          if (@opt.act[:verbose_plus][:set]==:on \
-          || @opt.act[:maintenance][:set]==:on)
-            SiSU_Screen::Ansi.new(
-              @opt.act[:color_state][:set],
-              @opt.fns,
-              "#{md.file.output_path.rst.dir}/#{md.file.base_filename.rst}"
-            ).flow
-          end
-        end
-        ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
-        wrap_width=if defined? md.make.plaintext_wrap \
-        and md.make.plaintext_wrap
-          md.make.plaintext_wrap
-        elsif defined? env.plaintext_wrap \
-        and env.plaintext_wrap
-          env.plaintext_wrap
-        else 78
-        end
-        #wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78
-        SiSU_Txt_rST::Source::Scroll.new(md,ao_array,wrap_width).songsheet
+        specific={
+          description:     'rST (plaintext utf-8)',
+          output_path:     md.file.output_path.rst.dir,
+          output_file:     md.file.base_filename.rst,
+        }
+        read_generic(@opt,specific)
+        SiSU_Txt_rST::Source::Scroll.new(md,@ao_array,@wrap_width).songsheet
       rescue
         SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
           __LINE__.to_s + ':' + __FILE__
@@ -125,6 +96,7 @@ module SiSU_Txt_rST
     class Scroll <Source
       include SiSU_Parts_Generic
       include SiSU_TextUtils
+      include SiSU_Decorate_Txt_rST
       @@endnotes={ para: [], end: [] }
       def initialize(md,data,wrap_width)
         @md,@data,@wrap_width=md,data,wrap_width
@@ -221,132 +193,6 @@ at:
 * SiSU #{the_url.sisu_txt}
 WOK
       end
-      def decorate
-        def heading
-          def underscore
-            def l0
-              '='
-            end
-            def l1
-              '-'
-            end
-            def l2
-              '`'
-            end
-            def l3
-              ':'
-            end
-            def l4
-              "'"
-            end
-            def l5
-              '"'
-            end
-            self
-          end
-          self
-        end
-        def bold
-          def open
-            '*'
-          end
-          def close
-            '*'
-          end
-          self
-        end
-        def italics
-          def open
-            '/'
-          end
-          def close
-            '/'
-          end
-          self
-        end
-        def underscore
-          def open
-            '_'
-          end
-          def close
-            '_'
-          end
-          self
-        end
-       #def emphasis
-       #  def open
-       #    ''
-       #  end
-       #  def close
-       #    ''
-       #  end
-       #  self
-       #end
-        def cite
-          def open
-            '"'
-          end
-          def close
-            '"'
-          end
-          self
-        end
-        def insert
-          def open
-            '+'
-          end
-          def close
-            '+'
-          end
-          self
-        end
-        def strike
-          def open
-            '-'
-          end
-          def close
-            '-'
-          end
-          self
-        end
-        def superscript
-          def open
-            '^'
-          end
-          def close
-            '^'
-          end
-          self
-        end
-        def subscript
-          def open
-            '['
-          end
-          def close
-            ']'
-          end
-          self
-        end
-        def hilite
-          def open
-            '*'
-          end
-          def close
-            '*'
-          end
-          self
-        end
-        def monospace
-          def open
-            '#'
-          end
-          def close
-            '#'
-          end
-          self
-        end
-        self
-      end
       def heading_decorated_underscore(dob,times,p_num)
         if dob.is==:heading
           #times=@wrap_width if times > @wrap_width
@@ -515,41 +361,11 @@ WOK
         content << plaintext[:metadata]
         content << "#{break_line}#{divider*@wrap_width}#{break_line}" if @md.stmp =~/\w+/ #not used?
         content << plaintext[:tail]
-        Output.new(content,@md).rst
+        outputfile=SiSU_Env::FileOp.new(@md).write_file.rst
+        Txt_Output::Output.new.document(content,outputfile)
         @@endnotes={ para: [], end: [] }
       end
     end
-    class Output <Source
-      include SiSU_Param
-      include SiSU_Env
-      def initialize(content,md)
-        @content,@md=content,md
-      end
-      def rst
-        file_plaintext=SiSU_Env::FileOp.new(@md).write_file.rst
-        @sisu=[]
-        emptyline=0
-        @content.each do |para|                                                # this is a hack
-          if para.is_a?(Array) \
-          and para.length > 0
-            para.each do |line|
-              if line
-                line=line.gsub(/[ \t]+$/m,'').
-                  gsub(/^\A[ ]*\Z/m,'')
-                (line=~/^\A\Z/) \
-                ? (emptyline+=1)
-                : emptyline=0
-                if emptyline < 2                     #remove additional empty lines
-                  file_plaintext.puts line
-                end
-              end
-            end
-          else file_plaintext.puts para          #unix plaintext # /^([*=-]|\.){5}/
-          end
-        end
-        file_plaintext.close
-      end
-    end
   end
 end
 __END__
diff --git a/lib/sisu/develop/txt_rst_decorate.rb b/lib/sisu/develop/txt_rst_decorate.rb
new file mode 100644 (file)
index 0000000..6f1de7f
--- /dev/null
@@ -0,0 +1,186 @@
+# encoding: utf-8
+=begin
+
+* Name: SiSU
+
+** Description: documents, structuring, processing, publishing, search
+*** plaintext decoration
+
+** 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/txt_rst_decorate.rb;hb=HEAD>
+
+=end
+
+module SiSU_Decorate_Txt_rST
+  def decorate
+    def heading
+      def underscore
+        def l0
+          '='
+        end
+        def l1
+          '-'
+        end
+        def l2
+          '`'
+        end
+        def l3
+          ':'
+        end
+        def l4
+          "'"
+        end
+        def l5
+          '"'
+        end
+        self
+      end
+      self
+    end
+    def bold
+      def open
+        '*'
+      end
+      def close
+        '*'
+      end
+      self
+    end
+    def italics
+      def open
+        '/'
+      end
+      def close
+        '/'
+      end
+      self
+    end
+    def underscore
+      def open
+        '_'
+      end
+      def close
+        '_'
+      end
+      self
+    end
+   #def emphasis
+   #  def open
+   #    ''
+   #  end
+   #  def close
+   #    ''
+   #  end
+   #  self
+   #end
+    def cite
+      def open
+        '"'
+      end
+      def close
+        '"'
+      end
+      self
+    end
+    def insert
+      def open
+        '+'
+      end
+      def close
+        '+'
+      end
+      self
+    end
+    def strike
+      def open
+        '-'
+      end
+      def close
+        '-'
+      end
+      self
+    end
+    def superscript
+      def open
+        '^'
+      end
+      def close
+        '^'
+      end
+      self
+    end
+    def subscript
+      def open
+        '['
+      end
+      def close
+        ']'
+      end
+      self
+    end
+    def hilite
+      def open
+        '*'
+      end
+      def close
+        '*'
+      end
+      self
+    end
+    def monospace
+      def open
+        '#'
+      end
+      def close
+        '#'
+      end
+      self
+    end
+    self
+  end
+end
+__END__
index 4aa9c87f2299def54cf1b2c902f6d96e5146093d..d777587ee8d3fd68c5d45e53cd2182a259be3a97 100644 (file)
@@ -60,12 +60,16 @@ module SiSU_Txt_Textile
     include SiSU_Env
   require_relative 'shared_metadata'                    # shared_metadata.rb
   require_relative 'generic_parts'                      # generic_parts.rb
+  require_relative 'txt_read'                           # txt_read.rb
   require_relative 'txt_shared'                         # txt_shared.rb
+  require_relative 'txt_textile_decorate'               # txt_textile_decorate.rb
+  require_relative 'txt_output'                         # txt_output.rb
   include SiSU_Param
-  @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
+  @@alt_id_count,@@alt_id_count=0,0
   @@tablefoot=''
   class Source
-    include SiSU_Parts_Generic
+    include SiSU_Txt_Read
+    #include SiSU_Parts_Generic
     def initialize(opt)
       @opt=opt
       unless @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
@@ -75,46 +79,13 @@ module SiSU_Txt_Textile
     def read
       begin
         md=SiSU_Param::Parameters.new(@opt).get
-        env=SiSU_Env::InfoEnv.new(@opt.fns)
-        unless @opt.act[:quiet][:set]==:on
-          tool=(@opt.act[:verbose][:set]==:on \
-          || @opt.act[:verbose_plus][:set]==:on \
-          || @opt.act[:maintenance][:set]==:on) \
-          ? "#{env.program.text_editor} #{md.file.output_path.textile.dir}/#{md.file.base_filename.textile}"
-          : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
-          (@opt.act[:verbose][:set]==:on \
-          || @opt.act[:verbose_plus][:set]==:on \
-          || @opt.act[:maintenance][:set]==:on) \
-          ? SiSU_Screen::Ansi.new(
-              @opt.act[:color_state][:set],
-              'Textile (plaintext utf-8)',
-              tool
-            ).green_hi_blue
-          : SiSU_Screen::Ansi.new(
-              @opt.act[:color_state][:set],
-              'Textile (plaintext utf-8)',
-              tool
-            ).green_title_hi
-          if (@opt.act[:verbose_plus][:set]==:on \
-          || @opt.act[:maintenance][:set]==:on)
-            SiSU_Screen::Ansi.new(
-              @opt.act[:color_state][:set],
-              @opt.fns,
-              "#{md.file.output_path.textile.dir}/#{md.file.base_filename.textile}"
-            ).flow
-          end
-        end
-        ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
-        wrap_width=if defined? md.make.plaintext_wrap \
-        and md.make.plaintext_wrap
-          md.make.plaintext_wrap
-        elsif defined? env.plaintext_wrap \
-        and env.plaintext_wrap
-          env.plaintext_wrap
-        else 78
-        end
-        #wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78
-        SiSU_Txt_Textile::Source::Scroll.new(md,ao_array,wrap_width).songsheet
+        specific={
+          description:     'Textile (plaintext utf-8)',
+          output_path:     md.file.output_path.textile.dir,
+          output_file:     md.file.base_filename.textile,
+        }
+        read_generic(@opt,specific)
+        SiSU_Txt_Textile::Source::Scroll.new(md,@ao_array,@wrap_width).songsheet
       rescue
         SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
           __LINE__.to_s + ':' + __FILE__
@@ -126,6 +97,7 @@ module SiSU_Txt_Textile
     class Scroll <Source
       include SiSU_Parts_Generic
       include SiSU_TextUtils
+      include SiSU_Decorate_Txt_Textile
       @@endnotes={ para: [], end: [] }
       def initialize(md,data,wrap_width)
         @md,@data,@wrap_width=md,data,wrap_width
@@ -222,143 +194,19 @@ at:
 * SiSU #{the_url.sisu_txt}
 WOK
       end
-      def decorate
-        def heading
-          def inline
-            def l0
-              'h1. '
-            end
-            def l1
-              'h2. '
-            end
-            def l2
-              'h3. '
-            end
-            def l3
-              'h4. '
-            end
-            def l4
-              'h5. '
-            end
-            def l5
-              'h6. '
-            end
-            self
-          end
-          self
-        end
-        def bold
-          def open
-            '*'
-          end
-          def close
-            '*'
-          end
-          self
-        end
-        def italics
-          def open
-            '_'
-          end
-          def close
-            '_'
-          end
-          self
-        end
-        def underscore
-          def open
-            '+'
-          end
-          def close
-            '+'
-          end
-          self
-        end
-       #def emphasis
-       #  def open
-       #    ''
-       #  end
-       #  def close
-       #    ''
-       #  end
-       #  self
-       #end
-        def cite
-          def open
-            '"'
-          end
-          def close
-            '"'
-          end
-          self
-        end
-        def insert
-          def open
-            ''
-          end
-          def close
-            ''
-          end
-          self
-        end
-        def strike
-          def open
-            '-'
-          end
-          def close
-            '-'
-          end
-          self
-        end
-        def superscript
-          def open
-            '^'
-          end
-          def close
-            '^'
-          end
-          self
-        end
-        def subscript
-          def open
-            '~'
-          end
-          def close
-            '~'
-          end
-          self
-        end
-        def hilite
-          def open
-            '*'
-          end
-          def close
-            '*'
-          end
-          self
-        end
-        def monospace
-          def open
-            ''
-          end
-          def close
-            ''
-          end
-          self
-        end
-        self
-      end
       def heading_decorated_inline(dob)
-        heading_inline = case dob.lc
-        when 0 then decorate.heading.inline.l0
-        when 1 then decorate.heading.inline.l1
-        when 2 then decorate.heading.inline.l2
-        when 3 then decorate.heading.inline.l3
-        when 4 then decorate.heading.inline.l4
-        when 5 then decorate.heading.inline.l5
-        when 6 then decorate.heading.inline.l6
+        if dob.is==:heading
+          heading_inline = case dob.lc
+          when 0 then decorate.heading.inline.l0
+          when 1 then decorate.heading.inline.l1
+          when 2 then decorate.heading.inline.l2
+          when 3 then decorate.heading.inline.l3
+          when 4 then decorate.heading.inline.l4
+          when 5 then decorate.heading.inline.l5
+          when 6 then decorate.heading.inline.l6
+          end
+          heading_inline + ' ' +  dob.obj
         end
-        heading_inline + ' ' +  dob.obj
       end
       def plaintext_structure(dob='',p_num='') #% Used to extract the structure of a document
         util=nil
@@ -509,41 +357,11 @@ WOK
         content << plaintext[:metadata]
         content << "#{break_line}#{divider*@wrap_width}#{break_line}" if @md.stmp =~/\w+/ #not used?
         content << plaintext[:tail]
-        Output.new(content,@md).textile
+        outputfile=SiSU_Env::FileOp.new(@md).write_file.textile
+        Txt_Output::Output.new.document(content,outputfile)
         @@endnotes={ para: [], end: [] }
       end
     end
-    class Output <Source
-      include SiSU_Param
-      include SiSU_Env
-      def initialize(content,md)
-        @content,@md=content,md
-      end
-      def textile
-        file_plaintext=SiSU_Env::FileOp.new(@md).write_file.textile
-        @sisu=[]
-        emptyline=0
-        @content.each do |para|                                                # this is a hack
-          if para.is_a?(Array) \
-          and para.length > 0
-            para.each do |line|
-              if line
-                line=line.gsub(/[ \t]+$/m,'').
-                  gsub(/^\A[ ]*\Z/m,'')
-                (line=~/^\A\Z/) \
-                ? (emptyline+=1)
-                : emptyline=0
-                if emptyline < 2                     #remove additional empty lines
-                  file_plaintext.puts line
-                end
-              end
-            end
-          else file_plaintext.puts para          #unix plaintext # /^([*=-]|\.){5}/
-          end
-        end
-        file_plaintext.close
-      end
-    end
   end
 end
 __END__
diff --git a/lib/sisu/develop/txt_textile_decorate.rb b/lib/sisu/develop/txt_textile_decorate.rb
new file mode 100644 (file)
index 0000000..03fdc68
--- /dev/null
@@ -0,0 +1,186 @@
+# encoding: utf-8
+=begin
+
+* Name: SiSU
+
+** Description: documents, structuring, processing, publishing, search
+*** plaintext decoration
+
+** 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/txt_textile_decorate.rb;hb=HEAD>
+
+=end
+
+module SiSU_Decorate_Txt_Textile
+  def decorate
+    def heading
+      def inline
+        def l0
+          'h1. '
+        end
+        def l1
+          'h2. '
+        end
+        def l2
+          'h3. '
+        end
+        def l3
+          'h4. '
+        end
+        def l4
+          'h5. '
+        end
+        def l5
+          'h6. '
+        end
+        self
+      end
+      self
+    end
+    def bold
+      def open
+        '*'
+      end
+      def close
+        '*'
+      end
+      self
+    end
+    def italics
+      def open
+        '_'
+      end
+      def close
+        '_'
+      end
+      self
+    end
+    def underscore
+      def open
+        '+'
+      end
+      def close
+        '+'
+      end
+      self
+    end
+   #def emphasis
+   #  def open
+   #    ''
+   #  end
+   #  def close
+   #    ''
+   #  end
+   #  self
+   #end
+    def cite
+      def open
+        '"'
+      end
+      def close
+        '"'
+      end
+      self
+    end
+    def insert
+      def open
+        ''
+      end
+      def close
+        ''
+      end
+      self
+    end
+    def strike
+      def open
+        '-'
+      end
+      def close
+        '-'
+      end
+      self
+    end
+    def superscript
+      def open
+        '^'
+      end
+      def close
+        '^'
+      end
+      self
+    end
+    def subscript
+      def open
+        '~'
+      end
+      def close
+        '~'
+      end
+      self
+    end
+    def hilite
+      def open
+        '*'
+      end
+      def close
+        '*'
+      end
+      self
+    end
+    def monospace
+      def open
+        ''
+      end
+      def close
+        ''
+      end
+      self
+    end
+    self
+  end
+end
+__END__
index 5a740696a0301e3b204c46398445b30e38768366..d16828582c100376e9b4bc77e3b4a2d068c3fe2d 100644 (file)
@@ -64,7 +64,7 @@ module SiSU_Wikispeak
     include Format
   require_relative 'html_parts'                         # html_parts.rb
   require_relative 'txt_shared'
-  @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
+  @@alt_id_count,@@alt_id_count=0,0
   @@tablefoot=''
   class Source
     def initialize(opt)