aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/develop/txt_output.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/develop/txt_output.rb')
-rw-r--r--lib/sisu/develop/txt_output.rb30
1 files changed, 30 insertions, 0 deletions
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__
+