diff options
author | Ralph Amissah <ralph@amissah.com> | 2014-11-20 22:44:43 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2014-12-08 00:18:15 -0500 |
commit | e0fcd082741e964c3564bc2be3e4c775deb99f00 (patch) | |
tree | a25932f40a96c734fbe61a36bc146e6b9cef4400 /lib/sisu/develop/txt_output.rb | |
parent | d: ao, rearrange, introduce new file (diff) |
d: txt outputs, reorganize, introduce new files
Diffstat (limited to 'lib/sisu/develop/txt_output.rb')
-rw-r--r-- | lib/sisu/develop/txt_output.rb | 30 |
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__ + |