From e0fcd082741e964c3564bc2be3e4c775deb99f00 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 20 Nov 2014 22:44:43 -0500 Subject: d: txt outputs, reorganize, introduce new files --- lib/sisu/develop/txt_output.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 lib/sisu/develop/txt_output.rb (limited to 'lib/sisu/develop/txt_output.rb') diff --git a/lib/sisu/develop/txt_output.rb b/lib/sisu/develop/txt_output.rb new file mode 100644 index 00000000..98a295ef --- /dev/null +++ b/lib/sisu/develop/txt_output.rb @@ -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__ + -- cgit v1.2.3